[Mapserver-users] problem with tileindex and querybyPoint
fx gamoy
fx.gamoy at mapxplore.com
Sun Nov 9 17:39:52 PST 2003
C'est un message de format MIME en plusieurs parties.
------=_NextPart_000_0009_01C3A72B.890A45D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello everybody
I use php/mapscript with mapserver 3.6.3
i am tryng to query a tileindex street layer
LAYER
NAME "streets"
TYPE LINE
STATUS on
MINSCALE 0
MAXSCALE 12000
TEMPLATE "consultable"
TILEINDEX "d:/mapserver_data/data/street.shp"
TILEITEM "Location"
CLASS
TEMPLATE "consultable"
symbol "circle"
COLOR 255 255 255
size 2
END
END # LAYER
i use the querybyPoint method.
Everything seems to be ok
i can read $oShape->numvalues (75 fields in my dbf file)
But $oShape->values['name"] return nothing
Any suggestion?
Thanks
fx
$oLayer =3D $oMapSession->oMap->getLayerByName( "streets" );
$xgeo=3DGMapPix2Geo($pixmin,0,$oMapSession->oMap->width,$oMapSession->oMa=
p->extent->minx,$oMapSession->oMap->extent->maxx,0);
$ygeo=3DGMapPix2Geo($piymin,0,$oMapSession->oMap->height,$oMapSession->oM=
ap->extent->miny,$oMapSession->oMap->extent->maxy,1);
$oPoint =3D ms_newpointObj();
$oPoint->setXY($xgeo,$ygeo);
if (@$oLayer->queryByPoint($oPoint,MS_MULTIPLE,0) =3D=3D MS_SUCCESS)
{
$oLayer->open($oMapSession->oMap->shapepath);
$nbrep=3D$oLayer->getNumResults();
$_SESSION["message"]=3D$nbrep;
for ($i=3D0;$i<$nbrep;$i++)
{
$oResults=3D$oLayer->getResult($i);
=
$oShape=3D$oLayer->getShape($oResults->tileindex,$oResults->shapeindex);
$_SESSION["message"]=3D$oShape->values["Name"];
}
$oLayer->close();=20
}
$oPoint->free();
------=_NextPart_000_0009_01C3A72B.890A45D0
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 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello everybody</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I use php/mapscript with mapserver=20
3.6.3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>i am tryng to query a tileindex street=20
layer</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR> NAME =
"streets"<BR> TYPE=20
LINE<BR> STATUS on<BR> MINSCALE 0<BR> MAXSCALE =
12000<BR> =20
TEMPLATE "consultable"<BR> TILEINDEX=20
"d:/mapserver_data/data/street.shp"<BR> TILEITEM =
"Location"<BR> =20
CLASS<BR> TEMPLATE "consultable"<BR> =
symbol=20
"circle"<BR> COLOR 255 255 255<BR> =
size=20
2<BR> END<BR>END # LAYER</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>i use the querybyPoint =
method.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Everything seems to be ok</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>i can read $oShape->numvalues =
(75 fields=20
in my dbf file)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But $oShape->values['name"] return=20
nothing</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Any suggestion?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>fx</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>$oLayer =3D =
$oMapSession->oMap->getLayerByName(=20
"streets"=20
);<BR>$xgeo=3DGMapPix2Geo($pixmin,0,$oMapSession->oMap->width,$oMap=
Session->oMap->extent->minx,$oMapSession->oMap->extent->=
;maxx,0);<BR>$ygeo=3DGMapPix2Geo($piymin,0,$oMapSession->oMap->heig=
ht,$oMapSession->oMap->extent->miny,$oMapSession->oMap->ex=
tent->maxy,1);<BR>$oPoint=20
=3D ms_newpointObj();<BR>$oPoint->setXY($xgeo,$ygeo);<BR> if=20
(@$oLayer->queryByPoint($oPoint,MS_MULTIPLE,0) =3D=3D=20
MS_SUCCESS)<BR> {<BR>$oLayer->open($oMapSession->oMap->shap=
epath);<BR>$nbrep=3D$oLayer->getNumResults();<BR>$_SESSION["message"]=3D=
$nbrep;<BR>for=20
($i=3D0;$i<$nbrep;$i++)<BR> {<BR> $oResult=
s=3D$oLayer->getResult($i);<BR> $oShape=3D$oLayer->=
;getShape($oResults->tileindex,$oResults->shapeindex);<BR> &nb=
sp; $_SESSION["message"]=3D$oShape->values["Name"];<BR> &nbs=
p;}<BR>$oLayer->close();=20
<BR> }<BR>$oPoint->free();</FONT></DIV></BODY></HTML>
------=_NextPart_000_0009_01C3A72B.890A45D0--
More information about the MapServer-users
mailing list