Thank you very much for taking part in the solution to my problem! I take the data on the coordinates of the XML-file. In SAX parser, I create the geometry and the objects themselves:
parcelBuilder.add ("Polygon"); parcelBuilder.add (mp); / / MultiPolygon parcelBuilder.add (cadastreNumber); SimpleFeature feature = parcelBuilder.buildFeature (null); if (feature! = null) { parcelCollection.add (feature); } ====================================== case Parcel : builder.length(150).add("Name", String.class); builder.setName("Polygon"); builder.add("Geometry", MultiPolygon.class); builder.length(25).add("CNumber", String.class); PARCEL_TYPE = CadastreFeatureBuilder.createFeatureType (crs, CadastreFeatureBuilder.CadastreFeatureTypes.Parcel); SimpleFeatureBuilder parcelBuilder = new SimpleFeatureBuilder (PARCEL_TYPE); ================================================== ========== if (parcelCollection.size ()> 0) { File PolygonFile = chooser.getSelectedFile (); File RenameParcelFile = new File (PolygonFile.getPath (). ReplaceAll (". Shp", "") + "_Parcel" + ". Shp"); PolygonFile.renameTo (RenameParcelFile); ShapefileDataStoreFactory polygonDataStoreFactory = new ShapefileDataStoreFactory (); Map <String, Serializable> paramsPolygon = new HashMap <String, Serializable> (); paramsPolygon.put ("url", RenameParcelFile.toURI (). toURL ()); paramsPolygon.put ("create spatial index", Boolean.TRUE); ShapefileDataStore polygonDataStore = (ShapefileDataStore) polygonDataStoreFactory.createNewDataStore (paramsPolygon); polygonDataStore.createSchema (PARCEL_TYPE); Transaction transactionParcel = new DefaultTransaction ("create"); String ParcelTypeName = polygonDataStore.getTypeNames () [0]; SimpleFeatureSource ParcelfeatureSource = polygonDataStore.getFeatureSource (ParcelTypeName); if (ParcelfeatureSource instanceof SimpleFeatureStore) { SimpleFeatureStore ParcelFeatureStore = (SimpleFeatureStore) ParcelfeatureSource; ParcelFeatureStore.setTransaction (transactionParcel); try { ParcelFeatureStore.addFeatures (parcelCollection); transactionParcel.commit (); } Catch (Exception ex) { App.Log.severe ("Failed to add a shapefile." + ex.toString () + "\ r \ nOtkat changes in the shapefile, but the file is created."); transactionParcel.rollback (); } Finally { transactionParcel.close (); App.Log.fine ("Saved" + ParcelTypeName); } } Else { App.Log.warning (ParcelTypeName + "does not support read / write"); / / System.exit (1); } } -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/writing-shapefile-problem-tp6846785p6853789.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users