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>in the units of the projection. </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-<div id=":yh" class="ArwC7c ckChnd">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</div><br>Hope that helps,<br><br>Roger<br>--<br><div class="gmail_quote">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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<br>
<div><div></div><div>> ><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><br>
</div></div></blockquote></div><br>