Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Obtain geometries

To get geometries from a layer you need to ask for a FeatureSource object from the layer:

FeatureSource source=layer.getResource( FeatureSource.class, progressMonitor);

(You need the org.geotools.feature.FeatureSource class). Once you have a feature source you can get all the features from the source by:

FeatureCollection collection=source.getFeatures();

It is a feature collect and has all the normal collection methods.
*WARNING:* don't forget to close your iterator after using one:

collections.close(iterator);

Cheers,

Jesse

Iñigo Telleria Elola wrote:

Hi,
I have a layer which contains geometries. I want to obtain all these geometries (the geometries are in the layer opened in uDig) and after the plugin gets the coordinates of these elements. How can I achieve to obtain the elements? I have been reading but I haven't found the solution. Maybe with StructuredSelection, but I'm not sure.
Thanks in advance.

------------------------------------------------------------------------

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top