[gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

Luke Peterson luke.peterson at gmail.com
Wed Jul 6 19:05:44 EDT 2011


On Wed, Jul 6, 2011 at 5:51 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:

> It is just that CreateLayer() will declare the geometry as being Polygon,
> but
> insert MultiPolygon sometimes. That's one of the caveats with the shapefile
> format/driver that will report a layer as being of type wkbPolygon but can
> return geometries that might actually be POLYGON or MULTIPOLYGON.
>
> Clearly, CreateLayer() is a simplistic implementation that doesn't have all
> the subtelties and options of ogr2ogr... With ogr2ogr, you would typically
> workaround this by using the -nlt MULTIPOLYGON option that would convert
> polygons to multipolygons before passing them to the PG driver.
>

Well isn't that embarrassing ... this caveat is the third paragraph of the
ESRI shapefile driver page. Thanks for your time, Even.

I'm looking at the shapefile driver now; out of curiosity, is there a
benefit to having SHPT_POLYGON shapefiles return wkbPolygon instead of
wkbMultiPolygon as their GeomType or SHPT_ARC shapefiles return
wkbLineString instead of wkbMultiLineString? Would having the driver return
the "Multi" geometry flavor instead cause a catastrophic failure somewhere?
Or is it a performance issue?

Is there a discussion thread I could read to catch up on this?

-----
Luke Peterson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110706/6c996ec3/attachment.html


More information about the gdal-dev mailing list