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 6e9631e commit 7ae6269932f924eb786e351d119860794387ba89
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/server/qgswfsserver.cpp
@@ -1216,6 +1216,22 @@ void QgsWfsServer::startGetFeature( QgsRequestHandler& request, const QString& f
QString fcString;
if ( format == QLatin1String( "GeoJSON" ) )
{
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 = 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" );

3 comments on commit 7ae6269

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Nov 14, 2016

@rldhont Build is broken since that commit

@rldhont

This comment has been minimized.

Copy link
Contributor Author

@rldhont rldhont replied Nov 14, 2016

@3nids the earlier commit 6e9631e has also a build broken

@rldhont

This comment has been minimized.

Copy link
Contributor Author

@rldhont rldhont replied Nov 14, 2016

I'll take a look at the compilation error http://tinyurl.com/jf4wobz

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