[GRASS-user] reading holes in a geometry

Malm Paul paul.malm at saabgroup.com
Tue Jan 27 04:42:01 EST 2009


 Hi list,
I would like to read out all holes and the boundering area (shell) separately from a MultiPolygon , but I can't se how this is done.
I have created a test polygon with two holes.

SimpleFeature feature = (SimpleFeature) iterator.next();
Geometry g = (Geometry)feature.getDefaultGeometry();

int noGeo = g.getNumGeometries();			// 1 geometry  
for(int i = 0; i < noGeo; i++)
{
	Geometry n = g.getGeometryN(i); 
	int noP = n.getNumPoints(); 			// 58 points 44 for the shell, 4 and 4 for the holes
	Coordinate[] co = g.getCoordinates(); 	// a cordinate list of 58 point
}


Do I have to iterate through the coordinate array and look for equal coordinates to read out the bounding polygon and the holes, 
or is there a more simple (faster) way? 

Kind regards,
Paul


More information about the grass-user mailing list