Hello¡ this is a example, in the multipolygon contain several geometry.
In this case, is the transform the geometry Polygon to contain the
Multipolygon
to LineString.
Geometry geomMulti = multiPolygon.getGeometryN(j);
CoordinateList coordinateList = new CoordinateList();
Vector<Geometry> vectorGeometry = new Vector<Geometry>();
for (int i = 0; i < geomMulti.getCoordinates().length; i++) {
if (coordinateList.size() > 0
&& coordinateList
.contains(geomMulti.getCoordinates()[i])) {
coordinateList.add(geomMulti.getCoordinates()[i], true);
vectorGeometry.add(gf
.createLineString(coordinateList.toCoordinateArray()));
coordinateList = new CoordinateList();
} else {
coordinateList.add(geomMulti.getCoordinates()[i], true);
}
}
goodbye.
Ian Dees wrote:
>
>
> I'd like to iterate through all of the features of a Shapefile (and
> convert
> them to OpenStreetMap format, but I can do that part once I read them).
>
> I've succesfully followed the tutorial on the webpage to read the
> shapefile,
> but the problem is that once I read it in, I can't break apart any of the
> multi* geometry types.
>
> If I have a MultiPolygon or MultiLineString (for example), how do I fetch
> the pieces of the geometry using the JTS API?
>
> It looks like I could continuously break it down with getGeometryN() and
> getNumGeometries(), but then I would lose the ability to group the points
> into the lines and polygons.
>
> Thanks,
> Ian
> --
> View this message in context:
> http://www.nabble.com/How-to-iterate-through-Shapefile--tp19640992p19640992.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
--
View this message in context:
http://n2.nabble.com/How-to-iterate-through-Shapefile--tp1129041p1301008.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users