[Gdal-dev] Problems with PostGIS and Shapefile interface
rompenb at unbc.ca
rompenb at unbc.ca
Wed Mar 22 23:16:56 EST 2006
Hi, I've been having major difficulties in programming with the OGR API.
Currently I'm attempting to write a program that reads features from a
PostGIS database and writes them to an ESRI Shapefile. The following
strange problems are occurring:
1) When I read a feature from the PostGIS database, both of the following
statements
currentfeat->GetGeometryRef()->getGeometryType()
loadlayer->GetLayerDefn()->GetGeomType()
return 0, or 'wkbUnknown', when according to currentfeat->DumpReadable()
all the features in the database table are multipolygons.
2)OGRGeometryFactory::forceToPolygon() isn't working. According to the
following code,
currentfeat->DumpReadable(dumpfile);
destfeat->SetGeometryDirectly(
OGRGeometryFactory::forceToPolygon(destfeat->StealGeometry()));
destfeat->DumpReadable(dumpfile);
the geometry remains in multipolygon format. destfeat previously had its
geometry created via OGRFeature::SetFrom().
3)When I re-read the shapefile following translation, using
OGRFeature::DumpReadable() again, the features appear as a mixture of
polygons and multipolygons.
If anyone has any suggestions, they would be greatly appreciated.
Thank you for your time.
Ben
More information about the Gdal-dev
mailing list