Skip to content

Commit

Permalink
Simplify Curved Types for QgsPostgresFeatureIterator
Browse files Browse the repository at this point in the history
Currently curved types are never simplified PostgreSQL server side.

However in many datasets just a small fraction of the dataset features
has curves.

The existing code already has a "st_simplifypreservetopology"
branch which will simplify Linestrings and Polygons and leaves
other geometries unchanged. Use this code for curved geometry layers.
  • Loading branch information
tomtor authored and nyalldawson committed Jan 13, 2021
1 parent 579d55f commit 2bf46cd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/providers/postgres/qgspostgresfeatureiterator.cpp
Expand Up @@ -514,8 +514,7 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString &whereClause, long

if ( !mRequest.simplifyMethod().forceLocalOptimization() &&
mRequest.simplifyMethod().methodType() != QgsSimplifyMethod::NoSimplification &&
QgsWkbTypes::flatType( QgsWkbTypes::singleType( usedGeomType ) ) != QgsWkbTypes::Point &&
!QgsWkbTypes::isCurvedType( usedGeomType ) )
QgsWkbTypes::flatType( QgsWkbTypes::singleType( usedGeomType ) ) != QgsWkbTypes::Point )
{
// PostGIS simplification method to use
QString simplifyPostgisMethod;
Expand All @@ -524,7 +523,7 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString &whereClause, long
bool postSimplification;
postSimplification = false; // default to false. Set to true only for PostGIS >= 2.2 when using st_removerepeatedpoints

if ( mRequest.simplifyMethod().methodType() == QgsSimplifyMethod::OptimizeForRendering )
if ( !QgsWkbTypes::isCurvedType( usedGeomType ) && mRequest.simplifyMethod().methodType() == QgsSimplifyMethod::OptimizeForRendering )
{
// Optimize simplification for rendering
if ( mConn->majorVersion() < 2 )
Expand Down

0 comments on commit 2bf46cd

Please sign in to comment.