Hi Robert,

Sorry, I missed that bit of your question.

If you know that your features contain MultiLineStrings you just do this...

FeatureIterator<SimpleFeature> iterator = featureCollection.features();

while( iterator.hasNext() ) {
    SimpleFeature feature = iterator.next();
    MultiLineString mls = (MultiLineString) feature.getDefaultGeometry();
    ...
}

If you're not sure about the geometry type you can check like this...

Geometry geom = (Geometry) feature.getDefaultGeometry;
if (MultiLineString.class.isAssignableFrom( geom.getClass() )) {
    MultiLineString mls = (MultiLineString) geom;
}

In GeoTools 2.6.1 there will be a shortcut for the above using the
Geometries enum...

Geometry geom = (Geometry) feature.getDefaultGeometry;
Geometries geomType = Geometries.get( geom );
if (geomType == Geometries.MULTILINESTRING) ...

If you want to use that straight away you can use GeoTools
2.6-SNAPSHOT or just grab the Geometries enum code:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/java/org/geotools/geometry/jts/Geometries.java

Michael

------------------------------------------------------------------------------
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