[mapserver-users] Goto state for a projected shape file
Tom Price
tom_price at yahoo.com
Tue Oct 22 08:27:03 PDT 2002
I'm a newbie to PHP Mapscript and I'm trying to implement a "goto
state" feature which would maximize any US state to the dimensions of
the image. In in earlier post, it was suggested that I spin through the
shape file to determine the min/max extents. I did that including
saving the dimensions on a database. That works fine but some of the
states are distorted enough to require projection and, once projected,
I find that these extents are no longer valid.
What am I missing?
TIA
Tom Price
$shapef = ms_newShapefileObj($mapdata.$baseshape,-1);
$minx=$miny=+1E30;
$maxx=$maxy=-1E30;
for ($i=0;$i<$shapef->numshapes;$i++) {
$extent = $shapef->getExtent($i);
$minx=min($minx,$extent->minx);
$miny=min($miny,$extent->miny);
$maxx=max($maxx,$extent->maxx);
$maxy=max($maxy,$extent->maxy);
}
$map->setextent($minx,$miny,$maxx,$maxy);
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
More information about the MapServer-users
mailing list