Mapscript Re-Projection : Calculating zooms
Stefan Schwarzer
stefan.schwarzer at GRID.UNEP.CH
Thu Sep 7 01:27:40 PDT 2006
I asked this question a couple of weeks back. But nobody answered. I
can't imagine that I am the only one dealing with user-chosen
projections and zooms. Can someone give me a hint to deal with it?
I am not too sure how to handle the following request(s) (by the same
user):
1) the first map in the browser shows up in the original projection,
i.e. geographic
2) now the user changes to say Mollweide, and request a redraw of
the map
3) the reprojection is being done in the background via the two
lines mentioned below,
the map displayed in the browser now in global view and
Mollweide projection
4) the user now makes a second request - either adding a layer or by
zooming in
So, now the incoming extent coordinates (imgext) are like this:
-18040095.70 -9020047.85 18040095.70 9020047.85
instead of
-180 -90 180 90
I have now the possibility to
- calculate the values (in meter) back into DD
- do the zoom in
- and project the map again into Mollweide
I probably would use something like this
$mollweide=ms_newprojectionObj("proj=moll,lon_0=0,x_0=0,y_0=0" );
$newproj = ms_newprojectionObj
("proj=longlat,ellps=WGS84,datum=WGS84,no_defs" );
$oRect= ms_newRectObj();
$oRect->setextent(-18040095.70, -9020047.85, 18040095.70, 9020047.85);
$oRect->project($mollweide,$newproj);
$map->setextent( $oRect->minx, $oRect->miny, $oRect->maxx, $oRect-
>maxy );
and then reproject it again into Mollweide?
Seems rather "cumbersome"....
Stefan
More information about the MapServer-users
mailing list