[mapserver-users] setting projection based on zoom
Timothy.Mackey at agso.gov.au
Timothy.Mackey at agso.gov.au
Mon Oct 1 15:30:26 PDT 2001
Hi Hannah,
Here's the perl proj module, sent to me by Steve a few months ago...
To compile it, just do:
make clean
perl Makefile.PL
make static
And here's an example of using it in perl to convert a geodetic point to
Lambert conformal conic:
@pargs = ("proj=lcc",
"ellps=WGS84",
"lon_0=134e",
"lat_1=18s",
"lat_2=36s",
);
$pj = proj::pj_init(5, \@pargs) or die('Unable to initialize the
projection.');
$in = new projUV();
$in->{u} = $proj::DEG_TO_RAD*$longitude;
$in->{v} = $proj::DEG_TO_RAD*$latitude;
$out = proj::pj_fwd($in, $pj);
$x=$out->{u};
$y=$out->{v};
proj::pj_free($pj);
Tim Mackey
Internet Applications Manager
AGSO - Geoscience Australia
e-mail: timothy.mackey at agso.gov.au
phone: (02) 6249 9813
fax: (02) 6249 9984
http://www.agso.gov.au/
ABN: 80 091 799 039
-----Original Message-----
From: Jensen, Hannah ERDC-CRREL-NH
[mailto:Hannah.Jensen at erdc.usace.army.mil]
Sent: Saturday, 29 September 2001 1:48 AM
To: 'Stephen Lime'
Cc: mapserver-users at lists.gis.umn.edu
Subject: RE: [mapserver-users] setting projection based on zoom
Hi, Steve. I am still wrestling with this problem and wondered if you had
any further suggestions. Once I figured out that lat/long could be used to
specify mapext, I thought I could find the lat/long coordinates of the zoom
box based on the geographic extent of the image (minlat, minlon, etc). Not
so! I couldn't seem to convert with much accuracy, which I guess shouldn't
have been surprising. I guess there's no way around interfacing with PROJ
somehow. I saw an old posting on the web about a PROJ perl module, which I
was hoping would be able to spit out the lat/long points for the zoom box.
Is there a better way? If the PROJ perl module is the way to go, can you
send it to me?
Any suggestions are much appreciated!! Thanks!
Cheers,
Hannah
-----Original Message-----
From: Stephen Lime [mailto:steve.lime at dnr.state.mn.us]
Sent: Tuesday, September 25, 2001 4:26 PM
To: Hannah.Jensen at erdc.usace.army.mil; mapserver-users at lists.gis.umn.edu
Subject: RE: [mapserver-users] setting projection based on zoom
Here's why. The extent is projected when it is read from the CGI data, so it
is
converted using the existing projection information it has at that time.
Setting
the projection afterwords has no effect but to screw things up. This is
fixable.
Hannah, would you be so kind as to add this to bugzilla?
Thanks- Steve
Stephen Lime
Data & Applications Manager
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> "Jensen, Hannah ERDC-CRREL-NH" <Hannah.Jensen at erdc.usace.army.mil>
09/25/01 03:09PM >>>
Proof that you should leave your desk once in awhile -- someone down the
hall saw my post and walked over to give me the answer. Thanks, Joel!
Anyway, if mapext is specified in lat/long, it works properly. Only caveat
is that the projection must be specified FIRST in the URL. So this works:
http://myserver/cgi-bin/mapserv34g?mode=browse&map=..%2Fhtml%2Fusamap%2Ftige
r.map&map_projection=proj=utm,zone=19&mapext=-78.12+40.14+-63.19+49.23
but this doesn't:
http://myserver/cgi-bin/mapserv34g?mode=browse&map=..%2Fhtml%2Fusamap%2Ftige
r.map&mapext=-78.12+40.14+63.19+49.23&map_projection=proj=utm,zone=19
Strange but true...
-----Original Message-----
From: Jensen, Hannah ERDC-CRREL-NH
To: 'mapserver-users at lists.gis.umn.edu'
Sent: 9/25/01 3:17 PM
Subject: [mapserver-users] setting projection based on zoom
Hi, all. I would like to be able to change projections based on how far
the
user is zoomed in. For example, if they start out looking at the US in
Lambert Azimuthal Equal Area but zoom in on Alaska, the map should
display
the zoomed in area in UTM zone 6. I'm hoping to be able to do this with
CGI
variables, but maybe that's not possible. If I pass in the projection
parameters and the map extent (in the new projection units) like so:
http://myserver/cgi-bin/mapserv34g?map=../html/usamap/tiger.map&mode=bro
wse&
map_projection=proj=utm,zone=6&mapext=415087+7115646+546659+7214763
it works fine. But since I don't know the map extent in the new
projection
before conversion, what variables should I pass to properly define the
map
extent? Can I somehow tell it to calculate the new extent based on the
old
one? Is there a better way to do this? Thanks in advance for any
info/advice...
Cheers,
Hannah
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proj.pm.tar.gz
Type: application/octet-stream
Size: 7352 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20011002/adadbf3f/attachment.obj>
More information about the MapServer-users
mailing list