problem with polar projection

Frank Warmerdam warmerdam at POBOX.COM
Tue Dec 11 08:54:49 EST 2007


JS Ubei wrote:
> dear all mapserver users,
> 
> I'm trying to display a map with the EPSG:3031
> projection system.
> 
> I use the GSHHS shape for shorelines and I want to see
> it centered on the antarctic continent.
> 
> Below my map file and a link to the resulted image.
> As you can shown the problem is a big hole of data
> around  the pole.
> 
> In advance, thanks for your help.

Jsubei,

The problem that occurs in cases like yours is that MapServer reprojects
your map rectangle into lat/long (EPSG:4326) in order to do a spatial query
on the vector features.  But it reprojects the rectangle by reprojecting
a bunch of points around the edge of the rectangle, and using the result
to get a bounding rectangle in the target projection.  But unfortunately
none of the locations around the edge of your pole centered projection
are very far north so the resulting bounding box query misses most of
the data.

My suggestion is to just reproject the shoreline vectors in advance into
your polar projection.

If you really want to do it the way you have it setup, then the code to
look at to improve the rectangle reprojection logic is msProjectRect()
in mapproject.c. You will see it first tries to reproject points around
the edge.  If any of those fail it will reproject a sampling of points
within the rectangle to compute bounds.  You could modify this to always
sample in the box for your build for instance by initializing 'failure'
to 1 instead of 0.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list