[mapserver-users] Re: Question about projection

Stephen Woodbridge woodbri at swoodbridge.com
Wed Aug 24 00:04:49 EDT 2011


On 8/23/2011 8:56 PM, jjwang wrote:
> OK, a simple question.
> The data I have is in WGS84. What I need is a map in Mercator projeciton.
> So what should I do?
> Define the projection under the 'MAP' or under the 'Layer'?
> Someone answer me please.

JJ,

You need both.

the projection block under the MAP is what you want the output 
projection to be, like:

PROJECTION
   "init=epsg:900913"
END
UNITS meters
EXTENTS -20037508.3427892480 -20037508.3427892480 20037508.3427892480 
20037508.3427892480


And then in your LAYER block you need to define the projection of the 
data that is in the source for that layer. In your case WGS84, so:

LAYER
   ...
   PROJECTION
     "init=epsg:4326"
   END
   ...
END

And if your do not already have 900913 added to your proj4 epsg file 
then you need to add the following to that file with a command like:

echo "<900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 
+x_0=0.0 +y_0=0 +k=1.0 +units=m +over +nadgrids=@null +no_defs  <>" >> 
/usr/share/proj/epsg

This would set you up for the Google Spherical Mercator project. If you 
want another projection the look through the epsg file and you might 
find it already defined there.

-Steve W


More information about the mapserver-users mailing list