Package org.geotools.data.shapefile.dbf

Examples of org.geotools.data.shapefile.dbf.DbaseFileHeader


            Integer geometryType = SpatialDatabaseService.convertJtsClassToGeometryType(geometryClass);
     
      // TODO ask charset to user?
      DbaseFileReader dbfReader = new DbaseFileReader(shpFiles, shpMemoryMapped, charset);
      try {
        DbaseFileHeader dbaseFileHeader = dbfReader.getHeader();
             
        String[] fieldsName = new String[dbaseFileHeader.getNumFields()+1];
        fieldsName[0] = "ID";
        for (int i = 1; i < fieldsName.length; i++) {
          fieldsName[i] = dbaseFileHeader.getFieldName(i-1);
        }
       
        Transaction tx = database.beginTx();
        try {
          if (crs != null) {
            layer.setCoordinateReferenceSystem(crs);
          }

          if (geometryType != null) {
            layer.setGeometryType(geometryType);
          }
         
          layer.mergeExtraPropertyNames(fieldsName);
          tx.success();
        } finally {
          tx.close();
        }
       
        monitor.begin(dbaseFileHeader.getNumRecords());
        try {
          Record record;
          Geometry geometry;
          Object[] values;
                    ArrayList<Object> fields = new ArrayList<Object>();
View Full Code Here

TOP

Related Classes of org.geotools.data.shapefile.dbf.DbaseFileHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.