Skip to content

Commit

Permalink
More robust GEOS pointOnSurface calculation (fix #13787)
Browse files Browse the repository at this point in the history
(cherry-picked from 5c9873c)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 3201700 commit 32cdd85
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/core/geometry/qgsgeos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,20 +1333,20 @@ bool QgsGeos::pointOnSurface( QgsPointV2& pt, QString* errorMsg ) const
try
{
geos.reset( GEOSPointOnSurface_r( geosinit.ctxt, mGeos ) );
}
CATCH_GEOS_WITH_ERRMSG( false );

if ( !geos )
{
return false;
}
if ( !geos || GEOSisEmpty_r( geosinit.ctxt, geos.get() ) != 0 )
{
return false;
}

double x, y;
GEOSGeomGetX_r( geosinit.ctxt, geos.get(), &x );
GEOSGeomGetY_r( geosinit.ctxt, geos.get(), &y );
double x, y;
GEOSGeomGetX_r( geosinit.ctxt, geos.get(), &x );
GEOSGeomGetY_r( geosinit.ctxt, geos.get(), &y );

pt.setX( x );
pt.setY( y );
pt.setX( x );
pt.setY( y );
}
CATCH_GEOS_WITH_ERRMSG( false );

return true;
}
Expand Down

0 comments on commit 32cdd85

Please sign in to comment.