force aspect ratio in basemap

Hi all,

I want to implement a web map server (WMS) using matplotlib/basemap.
The client of WMS does specify the bounding box in lon/lat and width
and height of the image. The spec requires that the server produces
such images without blank spaces around the image. The image might
thus have a wrong aspect ratio and it is up to the client of the WMS
to display the image correctly.

I ran in exactly the same problem as described here:

http://www.nabble.com/fill-entire-figure-area---DONT-maintain-aspect-ratio-td22365115.html

But I found as work around to this problem. If the aspect ratio of the
axis is set to auto (ax.set_aspect("auto")) before the figure is
saved, then one obtains a stretched figure (as required). Is this a
proper solution, are just a trick that will probably no longer work in
future version of basemap? I'm asking because the previous emails on
this issue indicate that basemap is intended to produce always images
in the correct aspect ratio.

Thanks and regards

Alexander Barth wrote:

Hi all,

I want to implement a web map server (WMS) using matplotlib/basemap.
The client of WMS does specify the bounding box in lon/lat and width
and height of the image. The spec requires that the server produces
such images without blank spaces around the image. The image might
thus have a wrong aspect ratio and it is up to the client of the WMS
to display the image correctly.

I ran in exactly the same problem as described here:

http://www.nabble.com/fill-entire-figure-area---DONT-maintain-aspect-ratio-td22365115.html

But I found as work around to this problem. If the aspect ratio of the
axis is set to auto (ax.set_aspect("auto")) before the figure is
saved, then one obtains a stretched figure (as required). Is this a
proper solution, are just a trick that will probably no longer work in
future version of basemap? I'm asking because the previous emails on
this issue indicate that basemap is intended to produce always images
in the correct aspect ratio.

Thanks and regards

Alexander. Basemap now has a 'fix_aspect' kwarg. If you set it to False, I think you can get what you want (the default is True). Let me know if it doesn't.

-Jeff