iceDice ha scritto:
> Hello,
> 
> I need to get coordinates of all features but i find out that
> getDefaultGeometry() method don't exist for org.opengis.feature.Feature. Can
> someone help me how to do something like this with
> org.opengis.feature.Feature:
> 
> Feature feature = null;
> Geometry geom = null;
> Coordinate [] coords;
> 
> while( featureIterator.hasNext() ) {
>     feature = (Feature) featureIterator.next();
>     geom = feature.getDefaultGeometry();
>     coords = geom.getCoordinates();
>     ...

You can use
geom = (Geometry) feature.getDefaultGeomeryProperty().getValue();

but I suggest you just use SimpleFeature, which is closer to the
old gt2 feature api wise, and does have a getDefaultGeometry()
method.

See also the "upgrade to 2.5" guide here:
http://docs.codehaus.org/display/GEOTOOLS/Upgrade+to+2.5

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to