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 12, 2016
1 parent 3a76dc5 commit c749d98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,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 c749d98

Please sign in to comment.