hi,

I've a problem:

I've written same procedures for edit (add, remove, modify) a feature using the metods

"FeatureStore:removeFeatures", "FeatureStore.modifyFeatures" and "FeatureStore.addFeatures".

If the data source is PostGis, the procedures work, but if the Data source is a GeoServer wfs

the procedure for add a feature generates an exception at line "featureStore.addFeatures(ftrCol)":

  "java.io.IOException: An error occured while committing"          

 

This is the code:

 

 

            public static final void AddFeature(FeatureSource featureSource) throws IllegalAttributeException, IOException{

                        FeatureType featureType = featureSource.getSchema();

                        Object values[] = new Object[featureType.getAttributeCount()];

                        Feature feature = featureType.create(values);

                        FeatureCollection ftrCol = FeatureCollections.newCollection();

                        ftrCol.add(feature);

                        FeatureStore  featureStore = (FeatureStore)featureSource;

                        featureStore.addFeatures(ftrCol);  // <-- Generate an IOException if the Data source is a GeoServer wfs

            }

 

 

Then I try the next code:

 

 

            public static final Feature AddFeature(FeatureSource featureSource) throws IllegalAttributeException, IOException{

                        FeatureType featureType = featureSource.getSchema();

                        FeatureStore  featureStore = (FeatureStore)featureSource;

                        FeatureWriter featureWriter = featureStore.getDataStore().getFeatureWriterAppend(featureType.getTypeName(), featureStore.getTransaction());

                        Feature feature = featureWriter.next();

                        featureWriter.write();

                        featureWriter.close();

                        return feature;

            }

 

It work if the Data Source is PostGis but don't work if the data source is a GeoServer wfs and generate

the next Exception at vhe call "getFeatureWriterAppend":

“java.lang.UnsupportedOperationException: Schema creation not supported"       

 

 

 

someone has a suggestion?

 

Thanks

 

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to