[geos-devel] Re: (not) Empty geometry (Jo)
Mateusz Loskot
mateusz at loskot.net
Sun Aug 2 18:12:56 EDT 2009
Jo wrote:
> Hi,
> The attach was only the wkt definition of the polygon...
> Things are gettin a bit clearer now: the polygon is also valid and
> empty on OGR (so I guess no prob in importing it to geos).
> I think is outside the scope of this mailing list to tell how Im
> importing it into OGR, but I ll do it anyway :-)
>
>
> while( (poFeature = poLayer->GetNextFeature()) != NULL )
> {
> OGRGeometry *poGeometry;
> poGeometry = poFeature->GetGeometryRef();
>
> if( poGeometry != NULL && wkbFlatten(poGeometry->getGeometryType())
> == wkbPolygon )
> {
> OGRPolygon *poPolygon = (OGRPolygon*) poGeometry;
> DoStuffWithGEOS()
What does this return?
poPolygon->getExteriorRing()->getNumPoints()
> }
> }
> Inside DoStuffWithGEOS(), I export it to text and import it (from
> text) to Geos.
You don't need to go through text export/import.
Just dump OGR geometry as GEOS geometry using
OGRGeometry::exportToGEOS() method:
http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogr_geometry.h#L118
And check if GEOS geomtetry is OK now.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
More information about the geos-devel
mailing list