WMS GetMap queries take a BBOX parameter for the map and a WIDTH and HEIGHT parameter for the image.

If the aspect ratio of the image (WIDTH/HEIGHT) doesn't match the aspect ratio of the BBOX (dx/dy) does the spec say it will distort the image into that WIDTH/HEIGHT aspect or does it say it will increase the area of the map returned in the image.

The server I'm playing with is doing the latter, but I see mentions on the web of the former behaviour.

In the case of increasing the area of the map, does the spec say that either the vertical or horizontal extent of the image will match the requested BBOX (depending on if its too tall or too wide)?

I suppose the safest thing is to always call with matching aspect ratios...

Here's some test grabs with three different aspect ratio WIDTH/HEIGHT settings and the same BBOX for your comparison:

wget -O test.png "http://www.osmgb.org.uk/OSM-GB/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=OSM-GB:__all__&SRS=
wget -O test2.png "http://www.osmgb.org.uk/OSM-GB/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=OSM-GB:__all__&SRS
wget -O test3.png "http://www.osmgb.org.uk/OSM-GB/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=OSM-GB:__all__&SRS
  • What WMS are you using? GeoServer? We run on GeoServer and the image distorts for us, so we have to do some maths to make sure it doesn't! – Rob Quincey Jun 29 '12 at 13:41
  • osmgb.org.uk/OSM-GB/wms - I get images with no distortion! Could an OGC standard be vague? – Spacedman Jun 29 '12 at 13:56
  • 1
    WMS Specification: In the case where the aspect ratio of the BBOX and the ratio width/height are different, the WMS shall stretch the returned map so that the resulting pixels could themselves be rendered in the aspect ratio of the BBOX. - Source: portal.opengeospatial.org/files/?artifact_id=14416 – Chau Jun 29 '12 at 14:24
  • Chau, I think that's an answer, and it seems to mean the WMS I'm querying is non-compliant... Its GetCapabilities says its Geoserver. – Spacedman Jun 29 '12 at 14:28
  • What I'm saying is, put that in an answer and I'll tick it for you. – Spacedman Jun 29 '12 at 17:03

The WMS server in question passes these requests through to the "OGC Mapnik" WMS server, which is non-compliant to the standard. There is some discussion about this.

Solution is to only query with the aspect ratio the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.