Skip to content

Commit

Permalink
[Server][WFS] GeoJSON FeatureCollection BBOX is restricted to -180,-9…
Browse files Browse the repository at this point in the history
…0,180,90
  • Loading branch information
rldhont committed May 26, 2018
1 parent 4bb7f82 commit c8a5992
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/services/wfs/qgswfsgetfeature.cpp
Expand Up @@ -1043,7 +1043,7 @@ namespace QgsWfs
{
response.setHeader( "Content-Type", "application/vnd.geo+json; charset=utf-8" );

if ( crs.isValid() )
if ( crs.isValid() && !rect->isEmpty() )
{
QgsGeometry exportGeom = QgsGeometry::fromRect( *rect );
QgsCoordinateTransform transform;
Expand All @@ -1062,6 +1062,9 @@ namespace QgsWfs
Q_UNUSED( cse );
}
}
// EPSG:4326 max extent is -180, -90, 180, 90
rect = new QgsRectangle( rect->intersect( new QgsRectangle( -180.0, -90.0, 180.0, 90.0 ) ) );

fcString = QStringLiteral( "{\"type\": \"FeatureCollection\",\n" );
fcString += " \"bbox\": [ " + qgsDoubleToString( rect->xMinimum(), prec ) + ", " + qgsDoubleToString( rect->yMinimum(), prec ) + ", " + qgsDoubleToString( rect->xMaximum(), prec ) + ", " + qgsDoubleToString( rect->yMaximum(), prec ) + "],\n";
fcString += QLatin1String( " \"features\": [\n" );
Expand Down

0 comments on commit c8a5992

Please sign in to comment.