Skip to content
Permalink
Browse files
Handle GEOS exception when parsing WKT
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14904 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Dec 13, 2010
1 parent 1c32d26 commit f1ba5febe854215ddc478cbaaf78ea71d21e6635
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/core/qgsgeometry.cpp
@@ -406,14 +406,22 @@ static QgsGeometry *fromGeosGeom( GEOSGeometry *geom )

QgsGeometry* QgsGeometry::fromWkt( QString wkt )
{
try
{
#if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR>=3)
GEOSWKTReader *reader = GEOSWKTReader_create();;
QgsGeometry *g = fromGeosGeom( GEOSWKTReader_read( reader, wkt.toLocal8Bit().data() ) );
GEOSWKTReader_destroy( reader );
return g;
GEOSWKTReader *reader = GEOSWKTReader_create();
QgsGeometry *g = fromGeosGeom( GEOSWKTReader_read( reader, wkt.toLocal8Bit().data() ) );
GEOSWKTReader_destroy( reader );
return g;
#else
return fromGeosGeom( GEOSGeomFromWKT( wkt.toLocal8Bit().data() ) );
return fromGeosGeom( GEOSGeomFromWKT( wkt.toLocal8Bit().data() ) );
#endif
}
catch ( GEOSException &e )
{
Q_UNUSED( e );
return 0;
}
}

QgsGeometry* QgsGeometry::fromPoint( const QgsPoint& point )

0 comments on commit f1ba5fe

Please sign in to comment.