Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Changing coordinate programmatically

Tankut KORAY wrote:
Thanks for your help,

I had tried setting coordinates of the features in a layer with the following code with no luck:

FeatureCollection collection = source.getFeatures();
   Iterator iterator = collection.iterator();
   try {
    while (iterator.hasNext()) {
     Feature feature = (Feature) iterator.next();
     Coordinate coordinate = feature.getDefaultGeometry().getCoordinate();
     coordinate.x = 26.00;
}
   } finally {
    collection.close(iterator);
   }
The iterator is used for read-only access; try using the "update data in place" instructions here:
- http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore

Note the api you are using (FeatureSource) is limited to read-only access to the features.
Jody


Back to the top