[Gdal-dev] OGR: C API for Polygon/Multipolygon?
gdal-dev-admin at remotesensing.org
gdal-dev-admin at remotesensing.org
Tue Dec 9 14:56:30 EST 2003
gdal-dev-admin at remotesensing.org wrote:
> I'm attempting to use a 'C' interface to OGR. I have points and
> polylines getting drawn on my map, but don't see how to easily do a
> 'C' interface to the polygon functions.
>
> I have a parallel working implementation using Shapelib alone, so
> I've done this before, including the CW/CCW ring stuff (fill/hole
> polygons). I need to do the same thing now in OGR so I can switch
> to it and gain the advantages of the OGR library.
>
> Anyone have a reference implementation in 'C' that shows how to
> access the elements in polygons/multipolygons for reading?
>
> I see "OGRLinearRing", "getExteriorRing", and "getInteriorRing", but
> those appear to be C++ objects/methods. I see no 'C' interface for
> them. Accurate? Do I need to get into the wkt/wkb calls in order
> to do it?
Curt,
For reasons that seemed good at the time, I did not make some of the C
geometry functions mirror the C++ that closely. To access the rings of
polygons you use OGR_G_GetGeometryRef(). To find out how many rings there
are use OGR_G_GetGeometryCount(). This essentially treats polygons as a
contain of rings. You then fetch the points from the rings the same way
you would with a linestring.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list