[Mapserver-users] displaying certain shape with php-mapscript
Lowell Filak
lfilak at medinaco.org
Tue Jan 28 11:29:30 PST 2003
Unless I'm mistaken the shapeObj only holds a single shape at a time.
In order to hold several shapes you need to either stick each shape into a shapefile or addFeature to an existing layer as the routine loops through all the shapes.
HTH
Lowell F.
The following message was sent by "Jim Burnett" <r000t at adelphia.net> on Tue, 28 Jan 2003 13:14:17 -0500.
> Currently I have code that will display a shape by a given field in the > shape file. What I would like to do now is display multiple polygons > together.
> Here is the code I have now....
> Basically I am getting a polygon/shape where the block fielddata equals > 28. The thing is, is there are lile 174 shapes with that block number, > but it only display 1.
>
>
> $mapObj->set("width",$img_width);
> $mapObj->set("height",$img_height);
>
> $layObj=$mapObj->getLayer($parcelLayer);
> $layObj->set( "filteritem", "BLOCK" );
> $layObj->setFilter ("/28/");
> $layObj->queryByAttributes($mapObj, 0);
> $numx = $layObj->getNumResults();
> for($i=0; $i < $layObj->getNumResults(); $i++) {
> $result = $layObj->getResult($i) ;
> $layObj->open($mapObj->shapepath);
> $shapeObj = $layObj->getShape( $result->tileindex, > $result->shapeindex );
> }
> $layerObj->set("status",1);
>
> $shapeExtObj = $shapeObj->bounds;
> $minx = $shapeExtObj->minx;
> $miny = $shapeExtObj->miny;
> $maxx = $shapeExtObj->maxx;
> $maxy = $shapeExtObj->maxy;
> $mapObj->setExtent( $minx, $miny, $maxx, $maxy);
> $img = $mapObj->draw();
>
More information about the MapServer-users
mailing list