Mapserver and Lat/Lon09 Apr 2008
One of the problems with open source is how much interesting stuff hides beneath the surface, only visible to those willing to read the source code… interesting features you do not even know are there!
On the bright side, you can find these Easter Eggs, if you look.
For example, today I found a case where Mapserver renders projected maps even when the extents you send in are in lon/lat!
My map file looks like this (note the output projection is defined as Mercator):
MAP SHAPEPATH "/Users/pramsey/Code/mapserver/msworldtest/" IMAGETYPE GIF PROJECTION "proj=merc" END LAYER NAME continent PROJECTION "init=epsg:4326" END TYPE POLYGON DATA continent STATUS DEFAULT CLASS OUTLINECOLOR 10 10 10 COLOR 200 200 200 END END END
My request URL looks like this (note the mapext coordinates are lon/lat):
And the output looks like this:
So my request was in geographic coordinates, but my output was still in Mercator.
This is, of course, a brutal bug-in-waiting for someone with a projected coordinate system that happens to include valid requests in the range of (-180,-90 180,90). Mercator does, but a 180x180 meter patch of the Atlantic ocean will probable never be zoomed in on – if it is, the user will suddenly see the whole world, to their great surprise.