[Mapserver-users] Change Projection (e.g. Geographic to Robinson)
Stefan Schwarzer
stefan.schwarzer at grid.unep.ch
Tue Jul 13 07:20:43 PDT 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> </x-tab>PROJECTION<br>
<x-tab> </x-tab>
'init=epsg:4326'<br>
<x-tab> </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>
<br>
$newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");<br>
$latlon=ms_newprojectionObj("proj=longlat,ellps=GRS80,datum=NAD83,no_defs");<br>
<br>
$oldext= ms_newRectObj();<br>
$oldext->setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]);
//this is the extent of my map in geographic<br>
$oldext->project($latlon,$newproj); //reproject to
Robinson<br>
<br>
$map->setextent($oldext->minx,$oldext->miny,$oldext->maxx,$oldext->maxy);
//set the new map extent<br>
<br>
<br>
Hope that helps,<br>
D. Pagurek<br>
<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> <br>
Hi there,<br><br>
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 <b>ms_newprojectionObj</b> command is relatively small.
And the WIKI is empty on the subject of
"Projections".<br><br>
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...<br><br>
Thanks for any help,<br><br>
Stefan<br><br>
<br>
<x-tab> </x-tab>
_______________________________________<br><br>
</font><font face="courier" size=2><x-tab> </x-tab>
<b>Stefan Schwarzer<br>
</b><x-tab> </x-tab>GIS
& Data Management<br><br>
<x-tab> </x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab> </x-tab>Chemin des
Anemones 11<br>
<x-tab> </x-tab>CH - 1219
Chatelaine<br>
<x-tab> </x-tab>Switzerland<br><br>
<x-tab> </x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab> </x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab> </x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab> </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> </x-tab>_______________________________________
</blockquote>
<x-sigsep><p></x-sigsep>
<x-tab> </x-tab>_______________________________________<br><br>
</font><font face="Courier, Courier" size=2><x-tab> </x-tab><b>Stefan
Schwarzer<br>
</b><x-tab> </x-tab>GIS
& Data Management<br><br>
<x-tab> </x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab> </x-tab>Chemin des
Anemones 11<br>
<x-tab> </x-tab>CH - 1219
Chatelaine<br>
<x-tab> </x-tab>Switzerland<br><br>
<x-tab> </x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab> </x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab> </x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab> </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> </x-tab>_______________________________________
</font></body>
</html>
--=====================_33479015==.ALT--
More information about the MapServer-users
mailing list