[mapserver-users] Goto state for a projected shape file

Hankley, Chip Chip.Hankley at gasai.com
Tue Oct 22 16:03:31 EDT 2002


Tom... haven't done that yet, but my hunch is that you are setting a
projection, but not recalculating the extents you have to the new
projection. You should be able to do this using PROJ.

Chip

-----Original Message-----
From: Tom Price [mailto:tom_price at yahoo.com]
Sent: Tuesday, October 22, 2002 10:27 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Goto state for a projected shape file


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