Plotting shape using php mapscript
Arunoday Chatterjee
arunoday_chatterjee at REDIFFMAIL.COM
Mon May 23 22:26:33 PDT 2005
I'm using esri shape files. Read the cities dbf file using php dbf
functions and provied select box with the
cities to choose from and used the index of the selected city to get the
shape. Then i have drawn the shape.
But it doesn't draw. so i use zoompoint php mapscript function to pan, but
then very few of them show up.
I used the bounds of the shape to calculate the mid point and passed it
into the zoompoint function.
but probably the mapserver is not calculating the extents right.
I'm using phpmapscript 4.2 and following are my code, can anyone help
please.
The map i'm trying to use is for the state of California.
Initial extent of the map is: -118.0 33.0 -117.0 34.0
/***************************/
$record=dbase_get_record_with_names($dbCities,$i);
$dbPlaceName=trim($record["AREANAME"]);
$dbClass=trim($record["CLASS"]);
$dbStFips=trim($record["STFIPS"]);
if(strcmp(trim($dbPlaceName),$selCity)==0 && strcmp(trim($dbClass),"city")
==0 && strcmp($dbStFips,$stFips)==0)
{
echo "CITY RECORD FOUND<br>";
$placeLayer=$map->getLayerByName("Cities");
$placeLayer->open();
$shape=$placeLayer->getShape(-1,$i-1);
echo "<br>DB CITY = ".$shape->values["AREANAME"];
$shape->draw($map,$placeLayer,$map->draw());
$bounds=$shape->bounds;
$ptX=$bounds->maxx;
$ptY=$bounds->maxy;
$extent_to_set = explode(" ",$_POST["extent"]);
$my_extent = ms_newrectObj();
$my_extent->setextent($extent_to_set[0],$extent_to_set[1],$extent_to_set
[2],$extent_to_set[3]);
$map->zoompoint(1,$my_point,$map->width,$map->height,$my_extent);
/***************************/
Also i'm trying to use the streets shape file which contains around 5 lac
data and mapserver fails or php fails,
execution timeout exception is thrown, any help to get around this problem.
Thanks!
More information about the MapServer-users
mailing list