[Mapserver-users] displaying certain shape with php-mapscript
Jim Burnett
r000t at adelphia.net
Tue Jan 28 10:14:17 PST 2003
This is a multi-part message in MIME format.
------=_NextPart_000_0084_01C2C6CF.2994E930
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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.=20
$mapObj->set("width",$img_width);
$mapObj->set("height",$img_height);
$layObj=3D$mapObj->getLayer($parcelLayer);
$layObj->set( "filteritem", "BLOCK" );
$layObj->setFilter ("/28/");
$layObj->queryByAttributes($mapObj, 0);
$numx =3D $layObj->getNumResults();
for($i=3D0; $i < $layObj->getNumResults(); $i++) {
$result =3D $layObj->getResult($i) ;
$layObj->open($mapObj->shapepath);
$shapeObj =3D $layObj->getShape( $result->tileindex, =
$result->shapeindex );
}
$layerObj->set("status",1);
$shapeExtObj =3D $shapeObj->bounds;
$minx =3D $shapeExtObj->minx;
$miny =3D $shapeExtObj->miny;
$maxx =3D $shapeExtObj->maxx;
$maxy =3D $shapeExtObj->maxy;
$mapObj->setExtent( $minx, $miny, $maxx, $maxy);
$img =3D $mapObj->draw();
------=_NextPart_000_0084_01C2C6CF.2994E930
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Currently I have code that will display =
a shape by=20
a given field in the shape file. What I would like to do now is display =
multiple=20
polygons together.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Here is the code I have =
now....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Basically I am getting a polygon/shape =
where the=20
block fielddata equals 28. The thing is, is there are lile 174 shapes =
with that=20
block number, but it only display 1. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>$mapObj->set("width",$img_width);<BR>$mapObj->set("height"=
,$img_height);</DIV>
<DIV> </DIV>
<DIV>$layObj=3D$mapObj->getLayer($parcelLayer);<BR>$layObj->set(=20
"filteritem", "BLOCK" );<BR>$layObj->setFilter=20
("/28/");<BR>$layObj->queryByAttributes($mapObj, 0);<BR>$numx =3D=20
$layObj->getNumResults();<BR>for($i=3D0; $i < =
$layObj->getNumResults();=20
$i++) {<BR> $result =3D $layObj->getResult($i) ;<BR> =20
$layObj->open($mapObj->shapepath);<BR> $shapeObj =3D=20
$layObj->getShape( $result->tileindex, $result->shapeindex=20
);<BR>}<BR> $layerObj->set("status",1);</DIV>
<DIV> </DIV>
<DIV>$shapeExtObj =3D $shapeObj->bounds;<BR>$minx =3D=20
$shapeExtObj->minx;<BR>$miny =3D $shapeExtObj->miny;<BR>$maxx =3D=20
$shapeExtObj->maxx;<BR>$maxy =3D=20
$shapeExtObj->maxy;<BR>$mapObj->setExtent( $minx, $miny, $maxx,=20
$maxy);<BR>$img =3D $mapObj->draw();<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_0084_01C2C6CF.2994E930--
More information about the MapServer-users
mailing list