[Mapserver-users] Change Projection (e.g. Geographic to Robinson)

Stefan Schwarzer stefan.schwarzer at grid.unep.ch
Tue Jul 13 10:20:43 EDT 2004


--=====================_33479015==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Thanks Debbie.

Yes, that's actually the code I've found as well in a thread which dates 
back a year or so. But it doesn't work with me. I assume that I have to 
change as well the projection definition in the map file, which is now

         PROJECTION
           'init=epsg:4326'
         END

Am I right? But what is the code? I din't find on the Internet...

Stefan


>This works for me:
>
>   $newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");
> 
>$latlon=ms_newprojectionObj("proj=longlat,ellps=GRS80,datum=NAD83,no_defs");
>
>   $oldext= ms_newRectObj();
>   $oldext->setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]); 
> //this is the extent of my map in geographic
>   $oldext->project($latlon,$newproj);  //reproject to Robinson
>
> 
>$map->setextent($oldext->minx,$oldext->miny,$oldext->maxx,$oldext->maxy); 
>//set the new map extent
>
>
>Hope that helps,
>D. Pagurek
>
>-----Original Message-----
>From: mapserver-users-admin at lists.gis.umn.edu 
>[mailto:mapserver-users-admin at lists.gis.umn.edu] On Behalf Of Stefan Schwarzer
>Sent: Monday, July 12, 2004 10:56 AM
>To: mapserver-users at lists.gis.umn.edu
>Subject: [Mapserver-users] Change Projection (e.g. Geographic to Robinson)
>
>Hi there,
>
>it seems that either the "change projection on-the-fly" feature isn't 
>widely used or nobody has problems with it. At least, the number of 
>threats using the ms_newprojectionObj command is relatively small. And the 
>WIKI is empty on the subject of "Projections".
>
>Could somebody provide me with a working example? I tried to change the 
>projection of my data from "geographic" to "robinson" using the 
>ms_newprojectionObj object, but it didn't work,  and honestly, I am a bit 
>confused by the different parameters...
>
>Thanks for any help,
>
>Stefan
>
>
>                 _______________________________________
>
>                 Stefan Schwarzer
>         GIS & Data Management
>
>         UNEP/DEWA/GRID-Geneva
>         Chemin des Anemones 11
>         CH - 1219 Chatelaine
>         Switzerland
>
>         Tel: (+41) 22.917.83.49
>         Fax: (+41) 22.917.80.29
>
>         Email: stefan.schwarzer at grid.unep.ch
>         Internet: http://geodata.grid.unep.ch/
>         _______________________________________

         _______________________________________

         Stefan Schwarzer
         GIS & Data Management

         UNEP/DEWA/GRID-Geneva
         Chemin des Anemones 11
         CH - 1219 Chatelaine
         Switzerland

         Tel: (+41) 22.917.83.49
         Fax: (+41) 22.917.80.29

         Email: stefan.schwarzer at grid.unep.ch
         Internet: http://geodata.grid.unep.ch/
         _______________________________________  
--=====================_33479015==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
<font size=3>Thanks Debbie.<br><br>
Yes, that's actually the code I've found as well in a thread which dates
back a year or so. But it doesn't work with me. I assume that I have to
change as well the projection definition in the map file, which is
now<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>PROJECTION<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
'init=epsg:4326'<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>END<br><br>
Am I right? But what is the code? I din't find on the
Internet...<br><br>
Stefan<br><br>
<br>
</font><blockquote type=cite class=cite cite><font face="arial" size=2 color="#000080">This
works for me:<br>
&nbsp;<br>
&nbsp;
$newproj=ms_newprojectionObj(&quot;proj=robin,lon_0=0,x_0=0,y_0=0&quot;);<br>
&nbsp;
$latlon=ms_newprojectionObj(&quot;proj=longlat,ellps=GRS80,datum=NAD83,no_defs&quot;);<br>
&nbsp;<br>
&nbsp; $oldext= ms_newRectObj();<br>
&nbsp;
$oldext-&gt;setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]);&nbsp;
//this is the extent of my map in geographic<br>
&nbsp; $oldext-&gt;project($latlon,$newproj);&nbsp; //reproject to
Robinson<br>
&nbsp;<br>
&nbsp;
$map-&gt;setextent($oldext-&gt;minx,$oldext-&gt;miny,$oldext-&gt;maxx,$oldext-&gt;maxy);&nbsp;
//set the new map extent<br>
&nbsp;<br>
&nbsp;<br>
Hope that helps,<br>
D. Pagurek<br>
&nbsp;<br>
</font><font face="tahoma" size=2>-----Original Message-----<br>
<b>From:</b> mapserver-users-admin at lists.gis.umn.edu
[<a href="mailto:mapserver-users-admin at lists.gis.umn.edu" eudora="autourl">mailto:mapserver-users-admin at lists.gis.umn.edu</a>]
<b>On Behalf Of </b>Stefan Schwarzer<br>
<b>Sent:</b> Monday, July 12, 2004 10:56 AM<br>
<b>To:</b> mapserver-users at lists.gis.umn.edu<br>
<b>Subject:</b> [Mapserver-users] Change Projection (e.g. Geographic to
Robinson)<br>
</font><font face="Times New Roman, Times" size=3>&nbsp;<br>
Hi there,<br><br>
it seems that either the &quot;change projection on-the-fly&quot; feature
isn't widely used or nobody has problems with it. At least, the number of
threats using the <b>ms_newprojectionObj</b> command is relatively small.
And the WIKI is empty on the subject of 
&quot;Projections&quot;.<br><br>
Could somebody provide me with a working example? I tried to change the
projection of my data from &quot;geographic&quot; to &quot;robinson&quot;
using the ms_newprojectionObj object, but it didn't work,&nbsp; and
honestly, I am a bit confused by the different parameters...<br><br>
Thanks for any help,<br><br>
Stefan<br><br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_______________________________________<br><br>
</font><font face="courier" size=2><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Stefan Schwarzer<br>
</b><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>GIS
&amp; Data Management<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Chemin des
Anemones 11<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CH - 1219
Chatelaine<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Switzerland<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Internet:
<a href="http://geodata.grid.unep.ch/" eudora="autourl">http://geodata.grid.unep.ch/</a><br>
</font><font size=3><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________
</blockquote>
<x-sigsep><p></x-sigsep>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________<br><br>
</font><font face="Courier, Courier" size=2><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><b>Stefan
Schwarzer<br>
</b><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>GIS
&amp; Data Management<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Chemin des
Anemones 11<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CH - 1219
Chatelaine<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Switzerland<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Internet:
<a href="http://geodata.grid.unep.ch/" eudora="autourl">http://geodata.grid.unep.ch/<br>
</a></font><font size=3><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________
</font></body>
</html>

--=====================_33479015==.ALT--




More information about the mapserver-users mailing list