Package org.geotools.data.shapefile

Examples of org.geotools.data.shapefile.ShapefileDataStore.forceSchemaCRS()


      Map<String, Serializable> params = new HashMap<String, Serializable>();
      params.put("url", outputShapefile.toURI().toURL());
      params.put("create spatial index", Boolean.TRUE);
     
      ShapefileDataStore dataStore = (ShapefileDataStore)dataStoreFactory.createNewDataStore(params);
      dataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);

          SimpleFeatureType STOP_TYPE = DataUtilities.createType(
                    "Stop",                
                    "location:Point:srid=4326," +
                    "name:String," +
View Full Code Here


        Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put("url", outputShapeFile.toURI().toURL());
        params.put("create spatial index", Boolean.TRUE);
        ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
        dStore.createSchema(featureType);
        dStore.forceSchemaCRS(mapCrs);

        JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

        JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputShapeFile.getAbsolutePath(), true, true,
                new NullProgressMonitor());
View Full Code Here

            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputLinesShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputLinesShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());
View Full Code Here

            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputPointsShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputPointsShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());
View Full Code Here

            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputPointsShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputPointsShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());
View Full Code Here

        (ShapefileDataStore) factory.createNewDataStore( params );   
    dataStore.createSchema( featureType );
   
    FeatureStore store = (FeatureStore) dataStore.getFeatureSource();
    store.addFeatures( source.getFeatures() );
    dataStore.forceSchemaCRS( crs );
}
   
private void promptOverwrite(final Display display, final File file){
    if (!file.exists()) return;
   
View Full Code Here

                "Error in shapefile schema. It is possible you don't have a geometry set in the output.");
        }
       
        try {
            if(schema.getCoordinateReferenceSystem() != null)
                sfds.forceSchemaCRS(schema.getCoordinateReferenceSystem());
        } catch(Exception e) {
            LOGGER.log(Level.WARNING, "Could not properly create the .prj file", e);
        }

        return sfds;
View Full Code Here

       * DataUtilities.createType
       */
      CoordinateReferenceSystem crs = features.get(0).getFeatureType()
          .getCoordinateReferenceSystem();
      if (crs == null)
        newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
     
      for (int i=1;i<features.size();i++) {
       
        SimpleFeature feature = features.get(i);
       
View Full Code Here

        SimpleFeatureSource fs = shapeDS.getFeatureSource(shapeDS
                .getTypeNames()[0]);

        ds.createSchema(fs.getSchema());
        ds.forceSchemaCRS(fs.getSchema().getCoordinateReferenceSystem());
        FeatureWriter<SimpleFeatureType, SimpleFeature> writer = ds.getFeatureWriter(ds
                .getTypeNames()[0], Transaction.AUTO_COMMIT);

        SimpleFeatureIterator it = fs.getFeatures().features();
        try {
View Full Code Here

                "Error in shapefile schema. It is possible you don't have a geometry set in the output.");
        }
       
        try {
            if(schema.getCoordinateReferenceSystem() != null)
                sfds.forceSchemaCRS(schema.getCoordinateReferenceSystem());
        } catch(Exception e) {
            LOGGER.log(Level.WARNING, "Could not properly create the .prj file", e);
        }

        return sfds;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.