[gdal-dev] Getting the points from multipoints datatype

Mateusz Loskot mateusz at loskot.net
Wed Mar 1 12:22:08 PST 2017


On 1 March 2017 at 17:26, Ahmed Tolba <Ahmed.Tolba at schiebel.net> wrote:
> Hi All,
>
> I’m trying to get the multi points out of a geometry, how would I retrieve
> the points ?
>
> // Variable initialised to contain Geometry point data for the field at the
> current index of i
>
>                         OGRGeometry *Geometry = Feature->GetGeometryRef();
>                         if(Geometry != NULL && wkbFlatten(Geometry->getGeometryType()) == wkbMultiPoint)
>                         {
>                               OGRMultiPoint *poMultipoint = ( OGRMultiPoint * )Geometry;
>                               int NumberOfGeometries = poMultipoint->getNumGeometries();
>
>                              // get points
>                          }


"Look at the code, Luke!"

Namely, check implementation of the OGRMultiPoint::exportToWkt() method in
http://svn.osgeo.org/gdal/trunk/gdal/ogr/ogrmultipoint.cpp

There, you will find this loop:

 for( int i = 0; i < getNumGeometries(); i++ )
{
        OGRPoint *poPoint = (OGRPoint *) getGeometryRef( i );
        ....
}


Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list