[Mapserver-users] Projection on the Fly Problems
Ed McNierney
ed at topozone.com
Thu May 1 10:27:04 PDT 2003
Debbie -
The MapScript documentation says that if setProjection is called with two arguments and the second is MS_TRUE, that the map's extents and units are automatically recalculated to the new projection. Since I don't use MapScript I can't tell whether that feature actually is working as documented.
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA 01863
ed at topozone.com
(978) 251-4242
-----Original Message-----
From: Debbie Pagurek [mailto:pagurekd at agr.gc.ca]
Sent: Thursday, May 01, 2003 1:14 PM
To: jnorton at fs.fed.us; mapserver-users at lists.gis.umn.edu
Subject: Re: [Mapserver-users] Projection on the Fly Problems
I am not entirely certain that setting the map projection automatically changes the extent so that it is also in the new projection. (I think it doesn't).
I have an application that starts with the user picking an country from a pick list, and this passes the country extent in decimal degrees. If the user had also selected another projection, such as Robinson, I have to project the extent rectangle from latlong to Robinson, and I've done it as follows. Maybe this bit of code will help you.
$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]); //the extent in latlong
$newextproj = ms_newRectObj();
$newextproj = $oldext->project($latlon,$newproj); //the extent in Robinson
$map->setextent($newextproj->minx,$newextproj->miny,$newextproj->maxx,$newextproj->maxy);
Debbie Pagurek
>>> "John Norton" <jnorton at fs.fed.us> 04/30/03 04:48pm >>>
I Have a map file with two layers...
LAYER
NAME "Fires"
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION "c:/msapps/maplab/large_fires/data/l48/tburn111,3"
STATUS ON
PROJECTION
"proj=utm"
"ellps=clrk66"
"datum=NAD27"
END
CLASSITEM "Status"
CLASS
NAME Burning
Expression "502"
COLOR 255 0 0
END
CLASS
NAME Burnt
Expression "501"
COLOR 255 255 0
END
END
LAYER
NAME "States"
STATUS ON
DATA "states"
TYPE LINE
PROJECTION
"proj=utm"
"ellps=clrk66"
"datum=NAD27"
END
CLASS
NAME "Boundary"
SYMBOL 14
COLOR 120 120 120
SIZE 1
END
END
I am trying to project these using mapscript with code that looks like
this...
$map = ms_newMapObj($map_path."l48c.map");
$result=$map->setProjection
("proj=aea,ellps=clrk66,datum=NAD27,lat_1=29.5,lat_2=45.5,lat_0=23,lon_0
=-96,x_0=0,y_0=0,units=m",MS_TRUE);
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
$projection = $map->getProjection();
No errors, setProjection returns 0 which I guess means the projection
didn't take but, when I echo $projection it reports the projection string
with commas replace by plus signs. The problem is I get no image. I am
using Mapscript...
MapServer version 3.6.6-dev OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
SUPPORTS=PROJ SUPPORTS=TTF SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
Same thing happens when I run mapscript as a CGI....
MapServer version 3.7 (development) OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=PD
F OUTPUT=SWF SUPPORTS=PROJ SUPPORTS=TTF SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=GD2_RGB INPUT=EPPL7 INPUT=OGR INPUT=GDAL
INPUT=SHAP
EFILE
Is this a units problem my data is in decimal degrees? I think I have PROJ
installed correctly it is in c:\proj with a path to the bin directory. I
also tried (meaning I added it to the PHP.ini file as an extension) the PHP
extension php_proj.dll. Are these conflicting?
Cheers
------------------------------------------------------
John Norton
USDA-RSAC
2222 W 2300 S
Salt Lake City, UT 84119
Phone: 801-975-3766
Fax: 801-975-3478
Intranet: fsweb.rsac.fs.fed.us
Internet: www.fs.fed.us/eng/rsac/
------------------------------------------------------
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list