Skip to content

Commit c8a5992

Browse files
committed
[Server][WFS] GeoJSON FeatureCollection BBOX is restricted to -180,-90,180,90
1 parent 4bb7f82 commit c8a5992

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/services/wfs/qgswfsgetfeature.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ namespace QgsWfs
10431043
{
10441044
response.setHeader( "Content-Type", "application/vnd.geo+json; charset=utf-8" );
10451045

1046-
if ( crs.isValid() )
1046+
if ( crs.isValid() && !rect->isEmpty() )
10471047
{
10481048
QgsGeometry exportGeom = QgsGeometry::fromRect( *rect );
10491049
QgsCoordinateTransform transform;
@@ -1062,6 +1062,9 @@ namespace QgsWfs
10621062
Q_UNUSED( cse );
10631063
}
10641064
}
1065+
// EPSG:4326 max extent is -180, -90, 180, 90
1066+
rect = new QgsRectangle( rect->intersect( new QgsRectangle( -180.0, -90.0, 180.0, 90.0 ) ) );
1067+
10651068
fcString = QStringLiteral( "{\"type\": \"FeatureCollection\",\n" );
10661069
fcString += " \"bbox\": [ " + qgsDoubleToString( rect->xMinimum(), prec ) + ", " + qgsDoubleToString( rect->yMinimum(), prec ) + ", " + qgsDoubleToString( rect->xMaximum(), prec ) + ", " + qgsDoubleToString( rect->yMaximum(), prec ) + "],\n";
10671070
fcString += QLatin1String( " \"features\": [\n" );

0 commit comments

Comments
 (0)