Ticket #2779 (closed defect: fixed)
Shapes and rasters incorrectly displayed on a map with stereographic polar (EPSG:32661) projection
|Reported by:||gosselinandre||Owned by:||sdlime|
|Severity:||major||Keywords:||stereographic polar projection|
My mapfile defines a map with a stereographic polar projection (very close to EPSG:32661). The map extent is defined so as to circumscribe lat>=55, with north pole(lat=90) at map center. The map uses 3 layers: 2 shapefiles covering canadian arctic (one for a land mask, one for 2-deg spaced grid), and a raster showing ocean temperature. All three input layers are based on EPSG:4326.
The result can be seen here : http://ctto-otpc.qc.dfo-mpo.gc.ca/cgi-bin/mapserv?mode=map&map=/var/www/html/wms/bug/bug55.map
The output is incorrect : all features and raster points lying totally inside circle with lat>= 55 are masked out.
When trying to understand the problem, I tried to simply reduce the map extent "ymax" value by the equivalent of some degrees to see if this would make any difference, adjusting the map widht/height size to preserve a correct aspect ratio. Everything else in the original mapfile was preserved. In other words, I chopped a strip off the top of the map belonging to the eastern hemisphere. Here are the results :
chopping off lat < 60 deg : http://ctto-otpc.qc.dfo-mpo.gc.ca/cgi-bin/mapserv?mode=map&map=/var/www/html/wms/bug/bug60.map
chopping off lat < 75 deg : http://ctto-otpc.qc.dfo-mpo.gc.ca/cgi-bin/mapserv?mode=map&map=/var/www/html/wms/bug/bug75.map
chopping off lat < 80 deg : http://ctto-otpc.qc.dfo-mpo.gc.ca/cgi-bin/mapserv?mode=map&map=/var/www/html/wms/bug/bug80.map
The results clearly show that "chopping off" the top of a latitude circle makes visible the features totally lying inside the chopped circle. Otherwise the features disappear. The extreme is case is a map where the extent covers lat >= 0. This map will come up empty.
This appears to me to be a clear bug. This makes it very difficult to generate a classical "polar stereographic" map centered on the north pole and covering bot h hemispheres (the most common case of a stereographic projection). "Stripping off" a band at the top of the map (as I did in the above examples) is a partial work-around, since you evidently loose the data lying in this band in the eastern hemisphere. This is very unfortunate since most of the maps we would like to produce require this projection.
As another fix, I was able to bring back incorrecty masked out shapes using mapscript and the following brute force approach :
-open shape file;
-for each shape in the shapefile object :
- draw shape using its layer
The fact that the above works seems to indicate that the Mapserver library somewhere tries to speed up the drawing process by "clipping out" what the library thinks are "outliers", but makes a bad choice in the process, thus masking out relevant shapes and raster points. Could it be that the library thinks those lie in the southern hemisphere ? Unfortunately, I am unable to write a similar fix to bring mask to life incorrectly masked out raster pixels.
I am able to reproduce this bug at will, using either Mapserver v 4.10.3 or 5.2.0. My environment is : Linux RedHat? Enterprise 5.2, 64-bit machine. Mapserver was compiled using the tarball and the supplied Makefile. No problem reported during the configure/make/make install stanza.
Andre Gosselin Maurice-Lamontagne Institute Mont-Joli Qc Canada Andre.Gosselin@…