Skip to content
Permalink
Browse files
WMS 1.3.0 compliance: throw exception if feature info point is not wi…
…thin the WIDTH/HEIGHT parameters
  • Loading branch information
mhugent committed Nov 29, 2016
1 parent df411eb commit 63f496c681079e80b69ff254e90af19e83520bfb
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/server/qgswmsserver.cpp
@@ -2160,6 +2160,12 @@ bool QgsWmsServer::infoPointToMapCoordinates( int i, int j, QgsPoint* infoPoint,
return false;
}

//check if i, j are in the pixel range of the image
if ( i < 0 || i > mapRenderer->width() || j < 0 || j > mapRenderer->height() )
{
throw QgsMapServiceException( "InvalidPoint", "I/J parameters not within the pixel range" );
}

double xRes = mapRenderer->extent().width() / mapRenderer->width();
double yRes = mapRenderer->extent().height() / mapRenderer->height();
infoPoint->setX( mapRenderer->extent().xMinimum() + i * xRes + xRes / 2.0 );

0 comments on commit 63f496c

Please sign in to comment.