[Mapserver-users] Projection on the Fly Problems
Ed McNierney
ed at topozone.com
Thu May 1 08:03:42 PDT 2003
John -
I'm not a MapScript user, so I'll have to let someone else handle this one. The docs say that that setProjection method is supposed to be adjusting your maps' output extents for you (with the MS_TRUE parameter), so your code seems reasonable at first glance.
- 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: John Norton [mailto:jnorton at fs.fed.us]
Sent: Thursday, May 01, 2003 10:53 AM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu;
mapserver-users-admin at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Projection on the Fly Problems
Ed,
Thanks! I am a bit confused about the extent issue when reprojecting. I do
not have a (re)projection object for the map. The extent is set to...
EXTENT -125.32 22.62 -66.98 51.48
Which is appropriate for the projection of the layers which are good with
init=epsg:4267. I thought that using this mapscript map method...
$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);
would change the projection for the map object and set the extent with the
appropriate values for the new projection. Anyway here is my entire map
file...
MAP
NAME "Lower 48"
STATUS ON
EXTENT -125.32 22.62 -66.98 51.48
SIZE 800 600
SHAPEPATH "data/l48/"
SYMBOLSET "/msapps/maplab/large_fires/etc/symbols.sym"
FONTSET "/msapps/maplab/large_fires/etc/fonts.txt"
WEB
HEADER lf_header.html
TEMPLATE lf.html
FOOTER lf_footer.html
IMAGEPATH "/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
END
LAYER
NAME "Burn"
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION "c:/msapps/maplab/large_fires/data/l48/tburn111,3"
STATUS ON
PROJECTION
"init=epsg:4267"
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
"init=epsg:4267"
END
CLASS
NAME "Boundary"
SYMBOL 14
COLOR 120 120 120
SIZE 1
END
END
END
and this the script that I am using to display the map.
<?php
$map_path="C:/msapps/maplab/large_fires/";
$map = ms_newMapObj($map_path."l48c.map");
$projection1 = $map->getProjection();
$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);
$projection2 = $map->getProjection();
?>
<HTML>
<HEAD>
<TITLE>Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC=<?php echo $image_url; ?> >
<?php /*Debug */ echo
"1:".$projection1."<br>"."2:".$projection2."<br>".$result; ?>
</BODY>
</HTML>
$projection1 comes up null and $projection2 comes up as :
+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
and result comes up as 0.
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/
------------------------------------------------------
"Ed McNierney"
<ed at topozone.com> To: "John Norton" <jnorton at fs.fed.us>
Sent by: cc: <mapserver-users at lists.gis.umn.edu>,
mapserver-users-admin at lists. <mapserver-users-admin at lists.gis.umn.edu>
gis.umn.edu Subject: RE: [Mapserver-users] Projection on the Fly Problems
04/30/2003 06:22 PM
John -
I would recommend "init=epsg:4267", but those should be fine. Can you
send the PROJECTION object for the main MAP file, too, along with the
EXTENT (either in the mapfile or as a parameter) that you're trying to
view? The most common cause of invisible reprojections is data that's
reprojected right out of the view frame.
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA 01863
Phone: (978) 251-4242 Fax: (978) 251-1396
ed at topozone.com
-----Original Message-----
From: John Norton [mailto:jnorton at fs.fed.us]
Sent: Wednesday, April 30, 2003 7:02 PM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu;
mapserver-users-admin at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Projection on the Fly Problems
Thanks Ed, I agree the UTM zone is required for the example I provided.
But, actually I grabbed the example from the wrong map file )-: The
projection that is causing problems is the latlong which I am trying to
convert to aea. So my layers look like...
LAYER
NAME "Fires"
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION "c:/msapps/maplab/large_fires/data/l48/tburn111,3"
STATUS ON
PROJECTION
"proj=latlong"
"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=latlong"
"ellps=clrk66"
"datum=NAD27"
END
CLASS
NAME "Boundary"
SYMBOL 14
COLOR 120 120 120
SIZE 1
END
END
------------------------------------------------------
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/
------------------------------------------------------
"Ed McNierney"
<ed at topozone.com> To:
"John Norton" <jnorton at fs.fed.us>, <mapserver-users at lists.gis.umn.edu>
Sent by: cc:
mapserver-users-admin at lists. Subject: RE:
[Mapserver-users] Projection on the Fly Problems
gis.umn.edu
04/30/2003 03:06 PM
John -
You aren't providing enough information to specify your UTM projections.
You need to specify the central meridian (i.e. the UTM zone) each is in.
You might find it easier to look up the EPSG codes for each projection
and
just use the codes. They're more cryptic but less error-prone. You can
find them at http://mapserver.gis.umn.edu/doc/proj.html
The NAD27 UTM zones are five-digit numbers of the form "267zz" where zz
is
the two-digit (pad with a leading zero) zone number. So to define a UTM
Zone 9, NAD27 projection you can say:
PROJECTION
"init=epsg:26709"
END
- 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: John Norton [mailto:jnorton at fs.fed.us]
Sent: Wednesday, April 30, 2003 4:49 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Projection on the Fly Problems
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
_______________________________________________
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