1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| DefaultTransaction t=new DefaultTransaction();
URL shapeURL = Main.class.getResource("/exemple.shp");
ShapefileDataStore store = new ShapefileDataStore(shapeURL);
String name = store.getTypeNames()[0];
FeatureStore store1=(FeatureStore)DataStore.getFeatureSource(name);//ici est marqué que la méthode n'est pas statique
store1.setTransaction(t);//l'erreur est variabledeclaratorid expected
FeatureType featureType=store1.getFeatureType();//erreur:getfeatureType n'est pas définie pour featureStore
DefaultFeatureCollection collection=new DefaultFeatureCollection("col",featuretype);
collection.add(featureType.create(new Object[] {geom1,"hello"}));//erreur: misplaced construct(s)
try
{
store1.addFeatures(collection);
t.commit();
}
catch (Exception cek){ t.rollback();
} |
Partager