[Gdal-dev] OGR: C API for Polygon/Multipolygon?

gdal-dev-admin at remotesensing.org gdal-dev-admin at remotesensing.org
Tue Dec 9 15:33:17 EST 2003


On Tue, 9 Dec 2003 gdal-dev-admin at remotesensing.org wrote:

> 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.

Thank you!  I have polygons getting drawn now.  Was pulling my hair
out trying to decide whether I needed to implement some C wrappers
for some C++ functions myself.

Here are the types that I have in my code:

  case 1:             // Point
  case 4:             // MultiPoint
  case 0x80000001:    // Point25D
  case 0x80000004:    // MultiPoint25D
  case 2:             // LineString (polyline)
  case 5:             // MultiLineString
  case 0x80000002:    // LineString25D
  case 0x80000005:    // MultiLineString25D
  case 3:             // Polygon
  case 6:             // MultiPolygon
  case 0x80000003:    // Polygon25D
  case 0x80000006:    // MultiPolygon25D
  case 7:             // GeometryCollection
  case 0x80000007:    // GeometryCollection25D

Should I assume that for ALL of the more complicated types I just
need to check how many Geometries there are via
OGR_G_GetGeometryCount() and then iterate through each of these
subgeometries, treating them as the simpler types?

If so, that will be fairly easy to implement.  The two I'm most
interested in now are MultiPoint and MultiPolygon.

-- 
Curt Mills, WE7U                    hacker_NO_SPAM_ at tc.fluke.com
Senior Methods Engineer/SysAdmin
"Lotto:    A tax on people who are bad at math!"
"Windows:  Microsoft's tax on computer illiterates!" -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Gdal-dev mailing list