Skip to content
Permalink
Browse files

[BUGFIX][QGIS Server] Transform feature collections bbox to ESPG:4326

  • Loading branch information
rldhont committed Nov 14, 2016
1 parent 2eec236 commit fa88e6a1907237e4e05969183860fe4d30b34908
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/server/qgswfsserver.cpp
@@ -1220,6 +1220,22 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
if ( format == "GeoJSON" )
{
fcString = "{\"type\": \"FeatureCollection\",\n";
if ( crs.isValid() )
{
QgsGeometry* exportGeom = QgsGeometry::fromRect( *rect );
QgsCoordinateTransform transform;
transform.setSourceCrs( crs );
transform.setDestCRS( QgsCoordinateReferenceSystem( 4326, QgsCoordinateReferenceSystem::EpsgCrsId ) );
try
{
if ( exportGeom->transform( transform ) == 0 )
rect = new QgsRectangle( exportGeom->boundingBox() );
}
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
}
}
fcString += " \"bbox\": [ " + qgsDoubleToString( rect->xMinimum(), prec ) + ", " + qgsDoubleToString( rect->yMinimum(), prec ) + ", " + qgsDoubleToString( rect->xMaximum(), prec ) + ", " + qgsDoubleToString( rect->yMaximum(), prec ) + "],\n";
fcString += " \"features\": [\n";
result = fcString.toUtf8();

0 comments on commit fa88e6a

Please sign in to comment.
You can’t perform that action at this time.