[mapserver-users] Spherical Mercator Projection Problem
Fawcett, David (MPCA)
David.Fawcett at state.mn.us
Thu Feb 24 11:14:39 PST 2011
Sergey,
If your data is in epsg:4326 and you want to publish the data as epsg:3785, you will need to projection blocks to your layers.
Something like:
PROJECTION
"init=epsg:4326"
END
The Projection block in the MAP section defines your output projection. Because your data is not in the same projection, you will need to define a projection block in each layer section. Those projection blocks define the 'input' projection. They tell MapServer what projection the data exists in. This allows MapServer (with proj4 support) to re-project your data to the output projection.
David.
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Sergey Kraev
Sent: Wednesday, February 23, 2011 5:01 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Spherical Mercator Projection Problem
Hi,
I'm running MS4W v3.0 (including MapServer 5.6.5) on Windows.
My data source are PostGIS multipolygon countries' borders.
I have successfully got MapServer to render the world map in WGS84 projection using these settings:
Request:
http://127.0.0.1:8080/cgi-bin/mapserv.exe?map=world.map&mode=map&mapsize=256+256&mapext=-180+-90+180+90
world.map:
MAP
EXTENT -180 -90 180 90
#EXTENT -20037508 -20037508 20037508 20037508
SIZE 256 256
IMAGECOLOR 153 179 204
FONTSET "c:\MS4W\fonts\fonts.list"
RESOLUTION 96
MAXSIZE 5000
PROJECTION
"init=epsg:4326"
#"init=epsg:3785"
END
...
<layers don't have PROJECTION sections>
I would like MapServer to render the same data into a "Web (spherical) Mercator" projected map (epsg:3785), but I don't know how to modify my request and mapfile in order to get the correct map.
With the following settings I just receive a picture without any polygons.
\ms4w\proj\nad\epsg:
...
<3785> +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 +nadgrids=@null +wktext +no_defs <>
...
Request (only mapext is different):
http://127.0.0.1:8080/cgi-bin/mapserv.exe?map=world.map&mode=map&mapsize=256+256&mapext=-20037508+-20037508+20037508+20037508<http://127.0.0.1:8080/cgi-bin/mapserv.exe?map=world.map&mode=map&mapsize=256+256&mapext=-180+-90+180+90>
world.map (only EXTENT and PROJECTION are different):
MAP
#EXTENT -180 -90 180 90
EXTENT -20037508 -20037508 20037508 20037508
SIZE 256 256
IMAGECOLOR 153 179 204
FONTSET "c:\MS4W\fonts\fonts.list"
RESOLUTION 96
MAXSIZE 5000
PROJECTION
#"init=epsg:4326"
"init=epsg:3785"
END
...
<layers don't have PROJECTION sections>
I'm assuming that -20037508 -20037508 20037508 20037508 is correct extent for the whole world map, since Google uses that and they also have Mercator projection.
Thanks for your help.
Sergey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110224/d66babf1/attachment.htm>
More information about the MapServer-users
mailing list