[gdal-dev] Getting the points from multipoints datatype

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[gdal-dev] Getting the points from multipoints datatype

andreahmed

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

                         }

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting the points from multipoints datatype

Mateusz Loskot
On 1 March 2017 at 17:26, Ahmed Tolba <[hidden email]> 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
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Loading...