<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=FR link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>You’re right.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>I finally got a correct map
by following your advices.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Thanks a lot.<o:p></o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='margin-left:35.4pt;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal style='margin-left:35.4pt'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>De :</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Roger
André [mailto:randre@gmail.com] <br>
<b><span style='font-weight:bold'>Envoyé :</span></b> lundi 27 octobre
2008 17:14<br>
<b><span style='font-weight:bold'>À :</span></b> Monier Clement<br>
<b><span style='font-weight:bold'>Cc :</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Objet :</span></b> Re: [mapserver-users]
projection = geographer's pain</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Hi Monier,<br>
<br>
My understanding of how this works is as follows.<br>
<br>
Assuming your data is in epsg:4326, and you wish to display it in epsg:3785:<br>
<br>
1) Your LAYER needs to reflect epsg:4326.<br>
PROJECTION<br>
"init=epsg:4326"<br>
END<br>
<br>
2) Your layer also needs to have a wms_srs parameter in the METADATA section to
allow for the layer to be requested in epsg:3785, ie<br>
METADATA<br>
"wms_srs"
"EPSG:4326 EPSG:3785"<br>
"wms_name"
"counties"<br>
"wms_server_version" "1.1.1"<br>
"wms_format"
"image/png"<br>
"wms_onlineresource" "<a
href="http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map&"
target="_blank">http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map&</a>"<br>
END<br>
<br>
3) Your request to Mapserver needs to define the extents of the image you want
, <i><span style='font-style:italic'>in the units of the projection. </span></i>So
a valid request for the layer above would be:<br>
<br>
<a href="http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/test/test.map"
target="_blank">http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/state.map</a><br>
&layers=counties<br>
&srs=EPSG%3A3785<br>
&version=1.1.1<br>
&bbox=-20037508.34%2C-<o:p></o:p></span></font></p>
<div id=":yh">
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>20037508.34%2C-10018754.1704%2C-10018754.1704<br>
&service=WMS<br>
&width=256<br>
&styles=<br>
&format=image%2Fpng<br>
&request=GetMap<br>
&height=25<o:p></o:p></span></font></p>
</div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
Hope that helps,<br>
<br>
Roger<br>
--<o:p></o:p></span></font></p>
<div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Monier Clement wrote:<br>
<br>
Hi,<br>
<br>
There is bigger than tiny difference in extents in epsg:4326 and in epsg:3785.
The latter is using meters as an unit.<br>
I had a try with Finland polygon and here are the results:<br>
<br>
D:\TEMP>ogrinfo -summary Finland_WGS84.shp Finland_WGS84<br>
Feature Count: 1<br>
Extent: (19.648331, 59.804989) - (31.587299, 70.079422)<br>
<br>
D:\TEMP>ogr2ogr -f "ESRI Shapefile" -s_srs epsg:4326 -t_srs
epsg:900913 Finland_<br>
Spherical.shp Finland_WGS84.shp<br>
<br>
D:\TEMP>ogrinfo -summary Finland_Spherical.shp Finland_Spherical<br>
Feature Count: 1<br>
Extent: (2187242.167179, 8356448.200347) - (3516282.078834, 11094615.004724)<br>
<br>
-Jukka-<br>
<br>
<br>
> Hi,<br>
><br>
> I got the map extent from shpinfo.<br>
> Beside, I know that there should only be a tiny difference<br>
> between coordinates in latlon-wgs84 (data proj) and "web<br>
> spherical mercator" (map proj).<br>
><br>
> You'll find the whole test-case files as attachement.<br>
><br>
> Here's the command line to get the map :<br>
> C:\ms4w\tools\mapserv\shp2img -m<br>
> C:\ms4w\apps\gmap\htdocs\test.map -o test.png -l layer1 -i agga<br>
><br>
> Thanks<br>
><br>
> Clément<br>
><br>
><br>
> -----Message d'origine-----<br>
> De : Rahkonen Jukka [mailto:<a href="mailto:Jukka.Rahkonen@mmmtike.fi"
target="_blank">Jukka.Rahkonen@mmmtike.fi</a>]<br>
> Envoyé : lundi 27 octobre 2008 12:46<br>
> À : Monier Clement; <a href="mailto:mapserver-users@lists.osgeo.org"
target="_blank">mapserver-users@lists.osgeo.org</a> Objet :<br>
> VS: [mapserver-users] projection = geographer's pain<br>
><br>
> Hi,<br>
><br>
> Have you double-checked that your map extent correspods with<br>
> the map projection?<br>
> Or if you could send your whole mapfile I am pretty sure that<br>
> you will get a final answer to your problem.<br>
><br>
> -Jukka Rahkonen-<br>
><br>
> > -----Alkuperäinen viesti-----<br>
> > Lähettäjä: <a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a><br>
> > [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a>] Puolesta Monier<br>
> > Clement<br>
> > Lähetetty: 27. lokakuuta 2008 13:39<br>
> > Vastaanottaja: 'Pietro Giannini'; <a
href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
> > Aihe: RE: [mapserver-users] projection = geographer's pain<o:p></o:p></span></font></p>
<div>
<div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>> ><br>
> ><br>
> > Thanks for your answers Roger & Pietro.<br>
> ><br>
> > I've followed your advice by trying these 4 test-cases :<br>
> ><br>
> > 1)<br>
> > Map proj set to : "init=epsg:3785" (web spherical
Mercator,<br>
> > manually added<br>
> > into espg file)<br>
> > Layer proj set to : "init=epsg:4326" (latlon wgs84, proj<br>
> system of my<br>
> > shapefiles)<br>
> ><br>
> > => got a blank map<br>
> ><br>
> > 2)<br>
> > Map projection set to : "init=epsg:4326"<br>
> > Layer projection set to : "init=epsg:4326"<br>
> ><br>
> > => got a map<br>
> ><br>
> > 3)<br>
> > Map projection set to : "init=epsg:3785"<br>
> > Layer projection set to : "init=epsg:3785"<br>
> ><br>
> > => got the same map as 2)<br>
> ><br>
> > 4)<br>
> > Map projection set to : "init=epsg:4326"<br>
> > Layer projection set to : "init=epsg:3785"<br>
> ><br>
> > => got a blank map<br>
> ><br>
> > I've also tried with another well-known existing epsg proj-system<br>
> > (instead of the manually-added 3785 code), but got the same results.<br>
> > I've made other attempts by replacing "init=3785" by full<br>
> description<br>
> > proj-string like "+proj=longlat +ellps=WGS84<br>
> > +datum=WGS84 +no_defs no_defs"<br>
> > or "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0<br>
> > +x_0=0.0 +y_0=0<br>
> > +k=1.0 +units=m +nadgrids=@null no_defs"<br>
> > But it didn't change anything...<br>
> ><br>
> > It seems that :<br>
> > - a map is drawn only if the map's and layer's proj-systems are the<br>
> > same.<br>
> > - the output projection is always overridden by the<br>
> shapefile system,<br>
> > no re-projection is done anyway.<br>
> ><br>
> > Let me know if you have any further leads to solve this issue.<br>
> ><br>
> > Thanks for your help<br>
> ><br>
> > Clément<br>
> ><br>
> > -----Message d'origine-----<br>
> > De : <a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a><br>
> > [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a>] De la part<br>
> de Pietro<br>
> > Giannini Envoyé : vendredi 24 octobre 2008 21:40 À<br>
> > : <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>
Objet : Re:<br>
> > [mapserver-users] projection = geographer's pain<br>
> ><br>
> > I can confirm that projection is often a pain!<br>
> ><br>
> > However, the problem may be in the projection of the layer.<br>
> ><br>
> > The PROJECTION section in a layer declare the projection of<br>
> the data<br>
> > source of this layer, while the PROJECTION on the map level is the<br>
> > projection wich you want to show the whole map. So you can overlay<br>
> > more data sources in different projection in a single map.<br>
> ><br>
> > Try to set the layer PROJECTION as "init=epsg:4326".<br>
> > Let us know...<br>
> > ciao<br>
> > ........................... pg<br>
> ><br>
> ><br>
> > --<br>
> > Pietro Giannini<br>
> > Bytewise srl - Area GIS<br>
> > 41°50'38.58"N 12°29'13.39"E<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > On Ven, Ottobre 24, 2008 16:55, Monier Clement wrote:<br>
> > > Hi,<br>
> > ><br>
> > ><br>
> > ><br>
> > > I'm running MS4W v2.2.8 (including MapServer 5.2) on windows.<br>
> > ><br>
> > > My datasource is shapefiles with WGS84 projection (epsg:4326).<br>
> > ><br>
> > > I would like MapServer to render these data into a "Web<br>
> (spherical)<br>
> > > Mercator" projected map (epsg:3785) in order to perfectly<br>
> > overlay the<br>
> > > GoogleMaps tile images (for the moment, my maps are<br>
> slightly shifted<br>
> > > north.)<br>
> > ><br>
> > ><br>
> > ><br>
> > > I've added this string at the end of the file "epsg"
in<br>
> > /ms4w/proj/nad :<br>
> > ><br>
> > > <3785> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0<br>
> > +lon_0=0.0 +x_0=0.0<br>
> > > +y_0=0 +k=1.0 +towgs84=0,0,0,0,0,0,0 +units=m<br>
> > +nadgrids=@null +no_defs <><br>
> > ><br>
> > ><br>
> > ><br>
> > > But I don't know how to modify my request and mapfile in<br>
> > order to get the<br>
> > > correct map.<br>
> > ><br>
> > > I've tried many combinations so far but with no success until
now.<br>
> > ><br>
> > ><br>
> > ><br>
> > > Do I have to change the projection system of my shapefiles ?<br>
> > ><br>
> > > Is MapServer able to change projection between input and output
?<br>
> > ><br>
> > ><br>
> > ><br>
> > > Request : "&SRS=epsg:3785"<br>
> > ><br>
> > ><br>
> > ><br>
> > > MapFile :<br>
> > ><br>
> > ><br>
> > ><br>
> > > [Map section]<br>
> > ><br>
> > > METADATA<br>
> > ><br>
> > > "wms_srs" "EPSG:4326
EPSG:3785" # is this correct ?<br>
> > ><br>
> > > END<br>
> > ><br>
> > ><br>
> > ><br>
> > > PROJECTION<br>
> > ><br>
> > > "init=epsg:3785" # is this correct ?<br>
> > ><br>
> > > END<br>
> > ><br>
> > ><br>
> > ><br>
> > > [Layer section]<br>
> > ><br>
> > > METADATA<br>
> > ><br>
> > > "wms_srs" "EPSG:3785" #
is this correct ?<br>
> > ><br>
> > > END<br>
> > ><br>
> > > PROJECTION<br>
> > ><br>
> > > "init=epsg:3785" # is this correct ?<br>
> > ><br>
> > > END<br>
> > ><br>
> > ><br>
> > ><br>
> > > With these settings, the pictures I got from MapServer are<br>
> > still shifted.<br>
> > ><br>
> > ><br>
> > ><br>
> > > Thanks for your help<br>
> > ><br>
> > ><br>
> > ><br>
> > > Clement<br>
> > ><br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > mapserver-users mailing list<br>
> > > <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
> > > <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
> > ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > mapserver-users mailing list<br>
> > <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
> > <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
> ><br>
> > _______________________________________________<br>
> > mapserver-users mailing list<br>
> > <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
> > <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
> ><br>
><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></span></font></p>
</div>
</div>
</blockquote>
</div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>