[gdal-dev] How to iterate over each point of an OGRMultiPoint

Even Rouault even.rouault at mines-paris.org
Fri Sep 13 13:06:43 PDT 2013


Le vendredi 13 septembre 2013 21:58:30, sepideh a écrit :
> I have this code and I don't know how to iterate over each part ( point )
> of the feature of type wkbMultiPoint:
> 
>    //Multipoint Shapefile
>    if ( wkbFlatten ( LayerGeometryType ) == wkbMultiPoint )
>    {
> 	   OGRFeature *poFeature;
> 	   MultipointFeature MultiPoint;
> 	   for ( int i = 0; i < NumberOfFeatures; i++ )
> 	   {
> 		   poFeature = poLayer ->GetNextFeature();
> 		   OGRGeometry *poGeometry;
> 		   poGeometry = poFeature ->GetGeometryRef();
> 		   if ( poGeometry != NULL && wkbFlatten ( poGeometry -
>getGeometryType()
> ) == wkbMultiPoint )
> 		   {
> 			   OGRMultiPoint *poMultipoint = ( OGRMultiPoint * )poGeometry;
> 			   int NumberOfGeometries = poMultipoint ->getNumGeometries();
> 			   MultiPoint.PointsOfFeature.resize( NumberOfGeometries );
> 			   for ( int j = 0; j < NumberOfGeometries; j++ )
> 			   {
> 				   poMultipoint ->

See 
http://gdal.org/ogr/classOGRGeometryCollection.html#ad609f2c7886918a766dd3d3a4fa52ec3

> 			   }
> 		   }
> 	   }
>    }
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/How-to-iterate-over-each-point-of-an-O
> GRMultiPoint-tp5077787.html Sent from the GDAL - Dev mailing list archive
> at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list