Skip to content

Commit

Permalink
WMS 1.3.0 compliance: throw exception if feature info point is not wi…
Browse files Browse the repository at this point in the history
…thin the WIDTH/HEIGHT parameters
  • Loading branch information
mhugent authored and rldhont committed Dec 13, 2016
1 parent 34969b5 commit 6eba1ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/qgswmsserver.cpp
Expand Up @@ -2154,6 +2154,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 );
Expand Down

0 comments on commit 6eba1ce

Please sign in to comment.