[Gdal-dev] Changes between 1.1.9 and 1.20

Clay, Bruce bclay at ball.com
Mon May 10 16:19:09 EDT 2004


Frank:
  Thanks for your reply.  I did get that part working from your input
though I had to modify it slightly to get it to work.  The inner loop
OGR_G_GetGeometryCount returned 1 for all but one ring and that it
returned 2.  I had to use OGR_G_GetPointCount instead.

With that working I believe that all of the polygons are showing but it
uncovered a problem with the labels.  I am using the EP2000 shapefile
data set for North America (namer.shp).  With gdal version 1.1.9 the
labels all displayed in the correct place.  When I diff a data dump from
my program using version 1.1.9 and gdal-cvs-20040506 most of the label
points are within a few tenths of a degree away and some even match
exactly.  The problem is the "United States" label.  It is in the
correct spot using version 1.1.9 but over in France when I use the
gdal-cvs-20040506 version.   I suspect the problem is the few Aleutian
Islands that are west of the International Dateline.  The reason I
suspect those is that when I open the file in fGis or MapView some
number of Islands are way over on the right of the screen and the rest
of North America is on the left side.  I tried getting the labels at
different nesting levels to see if I got different results but the
program crashed in OGRPolygonLabelPoint.

I could post the final code sequence I ended up with to display
multi-polygons if anyone is interested.

Bruce
bclay at ball.com

-----Original Message-----
From: gdal-dev-admin at remotesensing.org
[mailto:gdal-dev-admin at remotesensing.org] On Behalf Of Frank Warmerdam
Sent: Monday, May 10, 2004 10:52 AM
To: gdal-dev at remotesensing.org
Subject: Re: [Gdal-dev] Changes between 1.1.9 and 1.20


Clay, Bruce wrote:
> Frank:
> When I used version 1.1.9 in my app I could read ArcView shape files 
> from the EP200 data set at http://www.cdc.gov/epiinfo/shape.htm.
> 
> When multiple polygons were used for a given country they were still 
> reported as type Polygon and everything was happy.  With the update to

> version 1.2.0 the same data set reports them as multi-polygons and for

> some reason they down parse out the same.  The code I used to use is:
...
> I notice that OGR_G_GetPointCount returns 0 with the multipolygon so I

> tried changing GetPointCount to (OGRMultiPolygon 
> *)ring_handl)->getNumGeometries().  That only returns a count of 1. 
> That is the only get count type of call I saw when I searched for 
> MultiPolygon.

Bruce,

If a geometry is a multipolygon, you should use OGR_G_GetGeometryCount()
to get the number of polygons, and and OGR_G_GetGeometryRef() to get
each polygon.  Then use OGR_G_GetGeometryCount() and
OGR_G_GetGeometryRef() on each polygon to extract the rings which you
can then process normally.

Use OGR_G_GetGeometryType() to determine if the geometry is a wkbPolygon
or a wkbMultiPolygon (or wkbPolygon25D/wkbMultiPolygon25D).

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

_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org
http://remotesensing.org/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list