<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>&nbsp;</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&#8217;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&nbsp;:</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é&nbsp;:</span></b> lundi 27 octobre
2008 17:14<br>
<b><span style='font-weight:bold'>À&nbsp;:</span></b> Monier Clement<br>
<b><span style='font-weight:bold'>Cc&nbsp;:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Objet&nbsp;:</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>&nbsp;</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>
&nbsp;&nbsp;&nbsp; PROJECTION<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;init=epsg:4326&quot;<br>
&nbsp;&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp; METADATA<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;wms_srs&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;EPSG:4326 EPSG:3785&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;wms_name&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;counties&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;wms_server_version&quot;&nbsp; &quot;1.1.1&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;wms_format&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;image/png&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;wms_onlineresource&quot;&nbsp; &quot;<a
href="http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map&amp;"
target="_blank">http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map&amp;</a>&quot;<br>
&nbsp;&nbsp;&nbsp; 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.&nbsp; </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>
&amp;layers=counties<br>
&amp;srs=EPSG%3A3785<br>
&amp;version=1.1.1<br>
&amp;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>
&amp;service=WMS<br>
&amp;width=256<br>
&amp;styles=<br>
&amp;format=image%2Fpng<br>
&amp;request=GetMap<br>
&amp;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>&nbsp;</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.
&nbsp;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&gt;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&gt;ogr2ogr -f &quot;ESRI Shapefile&quot; -s_srs epsg:4326 -t_srs
epsg:900913 Finland_<br>
Spherical.shp Finland_WGS84.shp<br>
<br>
D:\TEMP&gt;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>
&gt; Hi,<br>
&gt;<br>
&gt; I got the map extent from shpinfo.<br>
&gt; Beside, I know that there should only be a tiny difference<br>
&gt; between coordinates in latlon-wgs84 (data proj) and &quot;web<br>
&gt; spherical mercator&quot; (map proj).<br>
&gt;<br>
&gt; You'll find the whole test-case files as attachement.<br>
&gt;<br>
&gt; Here's the command line to get the map :<br>
&gt; C:\ms4w\tools\mapserv\shp2img -m<br>
&gt; C:\ms4w\apps\gmap\htdocs\test.map -o test.png -l layer1 -i agga<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt; Clément<br>
&gt;<br>
&gt;<br>
&gt; -----Message d'origine-----<br>
&gt; De&nbsp;: Rahkonen Jukka [mailto:<a href="mailto:Jukka.Rahkonen@mmmtike.fi"
target="_blank">Jukka.Rahkonen@mmmtike.fi</a>]<br>
&gt; Envoyé&nbsp;: lundi 27 octobre 2008 12:46<br>
&gt; À&nbsp;: Monier Clement; <a href="mailto:mapserver-users@lists.osgeo.org"
target="_blank">mapserver-users@lists.osgeo.org</a> Objet&nbsp;:<br>
&gt; VS: [mapserver-users] projection = geographer's pain<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; Have you double-checked that your map extent correspods with<br>
&gt; the map projection?<br>
&gt; Or if you could send your whole mapfile I am pretty sure that<br>
&gt; you will get a final answer to your problem.<br>
&gt;<br>
&gt; -Jukka Rahkonen-<br>
&gt;<br>
&gt; &gt; -----Alkuperäinen viesti-----<br>
&gt; &gt; Lähettäjä: <a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a><br>
&gt; &gt; [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a>] Puolesta Monier<br>
&gt; &gt; Clement<br>
&gt; &gt; Lähetetty: 27. lokakuuta 2008 13:39<br>
&gt; &gt; Vastaanottaja: 'Pietro Giannini'; <a
href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
&gt; &gt; 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'>&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Thanks for your answers Roger &amp; Pietro.<br>
&gt; &gt;<br>
&gt; &gt; I've followed your advice by trying these 4 test-cases :<br>
&gt; &gt;<br>
&gt; &gt; 1)<br>
&gt; &gt; Map proj set to : &nbsp; &quot;init=epsg:3785&quot; (web spherical
Mercator,<br>
&gt; &gt; manually added<br>
&gt; &gt; into espg file)<br>
&gt; &gt; Layer proj set to : &quot;init=epsg:4326&quot; (latlon wgs84, proj<br>
&gt; system of my<br>
&gt; &gt; shapefiles)<br>
&gt; &gt;<br>
&gt; &gt; =&gt; got a blank map<br>
&gt; &gt;<br>
&gt; &gt; 2)<br>
&gt; &gt; Map projection set to : &quot;init=epsg:4326&quot;<br>
&gt; &gt; Layer projection set to : &quot;init=epsg:4326&quot;<br>
&gt; &gt;<br>
&gt; &gt; =&gt; got a map<br>
&gt; &gt;<br>
&gt; &gt; 3)<br>
&gt; &gt; Map projection set to : &quot;init=epsg:3785&quot;<br>
&gt; &gt; Layer projection set to : &quot;init=epsg:3785&quot;<br>
&gt; &gt;<br>
&gt; &gt; =&gt; got the same map as 2)<br>
&gt; &gt;<br>
&gt; &gt; 4)<br>
&gt; &gt; Map projection set to : &quot;init=epsg:4326&quot;<br>
&gt; &gt; Layer projection set to : &quot;init=epsg:3785&quot;<br>
&gt; &gt;<br>
&gt; &gt; =&gt; got a blank map<br>
&gt; &gt;<br>
&gt; &gt; I've also tried with another well-known existing epsg proj-system<br>
&gt; &gt; (instead of the manually-added 3785 code), but got the same results.<br>
&gt; &gt; I've made other attempts by replacing &quot;init=3785&quot; by full<br>
&gt; description<br>
&gt; &gt; proj-string like &quot;+proj=longlat +ellps=WGS84<br>
&gt; &gt; +datum=WGS84 +no_defs &nbsp;no_defs&quot;<br>
&gt; &gt; or &quot;+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0<br>
&gt; &gt; +x_0=0.0 +y_0=0<br>
&gt; &gt; +k=1.0 +units=m +nadgrids=@null &nbsp;no_defs&quot;<br>
&gt; &gt; But it didn't change anything...<br>
&gt; &gt;<br>
&gt; &gt; It seems that :<br>
&gt; &gt; - a map is drawn only if the map's and layer's proj-systems are the<br>
&gt; &gt; same.<br>
&gt; &gt; - the output projection is always overridden by the<br>
&gt; shapefile system,<br>
&gt; &gt; no re-projection is done anyway.<br>
&gt; &gt;<br>
&gt; &gt; Let me know if you have any further leads to solve this issue.<br>
&gt; &gt;<br>
&gt; &gt; Thanks for your help<br>
&gt; &gt;<br>
&gt; &gt; Clément<br>
&gt; &gt;<br>
&gt; &gt; -----Message d'origine-----<br>
&gt; &gt; De&nbsp;: <a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a><br>
&gt; &gt; [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a>] De la part<br>
&gt; de Pietro<br>
&gt; &gt; Giannini Envoyé&nbsp;: vendredi 24 octobre 2008 21:40 À<br>
&gt; &gt; : <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>
Objet&nbsp;: Re:<br>
&gt; &gt; [mapserver-users] projection = geographer's pain<br>
&gt; &gt;<br>
&gt; &gt; I can confirm that projection is often a pain!<br>
&gt; &gt;<br>
&gt; &gt; However, the problem may be in the projection of the layer.<br>
&gt; &gt;<br>
&gt; &gt; The PROJECTION section in a layer declare the projection of<br>
&gt; the data<br>
&gt; &gt; source of this layer, while the PROJECTION on the map level is the<br>
&gt; &gt; projection wich you want to show the whole map. So you can overlay<br>
&gt; &gt; more data sources in different projection in a single map.<br>
&gt; &gt;<br>
&gt; &gt; Try to set the layer PROJECTION as &quot;init=epsg:4326&quot;.<br>
&gt; &gt; Let us know...<br>
&gt; &gt; ciao<br>
&gt; &gt; ........................... pg<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Pietro Giannini<br>
&gt; &gt; Bytewise srl - Area GIS<br>
&gt; &gt; 41°50'38.58&quot;N 12°29'13.39&quot;E<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Ven, Ottobre 24, 2008 16:55, Monier Clement wrote:<br>
&gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I'm running MS4W v2.2.8 (including MapServer 5.2) on windows.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; My datasource is shapefiles with WGS84 projection (epsg:4326).<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I would like MapServer to render these data into a &quot;Web<br>
&gt; (spherical)<br>
&gt; &gt; &gt; Mercator&quot; projected map (epsg:3785) in order to perfectly<br>
&gt; &gt; overlay the<br>
&gt; &gt; &gt; GoogleMaps tile images (for the moment, my maps are<br>
&gt; slightly shifted<br>
&gt; &gt; &gt; north.)<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I've added this string at the end of the file &quot;epsg&quot;
in<br>
&gt; &gt; /ms4w/proj/nad :<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &lt;3785&gt; +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0<br>
&gt; &gt; +lon_0=0.0 +x_0=0.0<br>
&gt; &gt; &gt; +y_0=0 +k=1.0 +towgs84=0,0,0,0,0,0,0 +units=m<br>
&gt; &gt; +nadgrids=@null +no_defs &lt;&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; But I don't know how to modify my request and mapfile in<br>
&gt; &gt; order to get the<br>
&gt; &gt; &gt; correct map.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I've tried many combinations so far but with no success until
now.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Do I have to change the projection system of my shapefiles ?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Is MapServer able to change projection between input and output
?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Request : &quot;&amp;SRS=epsg:3785&quot;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; MapFile :<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; [Map section]<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; METADATA<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp; &quot;wms_srs&quot; &nbsp; &quot;EPSG:4326
EPSG:3785&quot; # is this correct ?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; END<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; PROJECTION<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp;&quot;init=epsg:3785&quot; # is this correct ?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; END<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; [Layer section]<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; METADATA<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp; &quot;wms_srs&quot; &nbsp; &quot;EPSG:3785&quot; #
is this correct ?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; END<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; PROJECTION<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; &nbsp;&quot;init=epsg:3785&quot; # is this correct ?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &nbsp; END<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; With these settings, the pictures I got from MapServer are<br>
&gt; &gt; still shifted.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thanks for your help<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Clement<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; mapserver-users mailing list<br>
&gt; &gt; &gt; <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
&gt; &gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; mapserver-users mailing list<br>
&gt; &gt; <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
&gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; mapserver-users mailing list<br>
&gt; &gt; <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
&gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
&gt; &gt;<br>
&gt;<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>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>