[Mapserver-users] problem with tileindex and querybyPoint

fx gamoy fx.gamoy at mapxplore.com
Sun Nov 9 20:39:52 EST 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>&nbsp; NAME =
"streets"<BR>&nbsp; TYPE=20
LINE<BR>&nbsp; STATUS on<BR>&nbsp; MINSCALE 0<BR>&nbsp; MAXSCALE =
12000<BR>&nbsp;=20
TEMPLATE "consultable"<BR>&nbsp; TILEINDEX=20
"d:/mapserver_data/data/street.shp"<BR>&nbsp; TILEITEM =
"Location"<BR>&nbsp;=20
CLASS<BR>&nbsp;&nbsp; TEMPLATE "consultable"<BR>&nbsp;&nbsp;&nbsp; =
symbol=20
"circle"<BR>&nbsp;&nbsp;&nbsp; COLOR 255 255 255<BR>&nbsp;&nbsp;&nbsp; =
size=20
2<BR>&nbsp; END<BR>END&nbsp; # LAYER</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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-&gt;numvalues&nbsp; =
(75 fields=20
in my dbf file)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But $oShape-&gt;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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>$oLayer =3D =
$oMapSession-&gt;oMap-&gt;getLayerByName(=20
"streets"=20
);<BR>$xgeo=3DGMapPix2Geo($pixmin,0,$oMapSession-&gt;oMap-&gt;width,$oMap=
Session-&gt;oMap-&gt;extent-&gt;minx,$oMapSession-&gt;oMap-&gt;extent-&gt=
;maxx,0);<BR>$ygeo=3DGMapPix2Geo($piymin,0,$oMapSession-&gt;oMap-&gt;heig=
ht,$oMapSession-&gt;oMap-&gt;extent-&gt;miny,$oMapSession-&gt;oMap-&gt;ex=
tent-&gt;maxy,1);<BR>$oPoint=20
=3D ms_newpointObj();<BR>$oPoint-&gt;setXY($xgeo,$ygeo);<BR>&nbsp;if=20
(@$oLayer-&gt;queryByPoint($oPoint,MS_MULTIPLE,0) =3D=3D=20
MS_SUCCESS)<BR>&nbsp;{<BR>$oLayer-&gt;open($oMapSession-&gt;oMap-&gt;shap=
epath);<BR>$nbrep=3D$oLayer-&gt;getNumResults();<BR>$_SESSION["message"]=3D=
$nbrep;<BR>for=20
($i=3D0;$i&lt;$nbrep;$i++)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;$oResult=
s=3D$oLayer-&gt;getResult($i);<BR>&nbsp;&nbsp;&nbsp;$oShape=3D$oLayer-&gt=
;getShape($oResults-&gt;tileindex,$oResults-&gt;shapeindex);<BR>&nbsp;&nb=
sp;&nbsp;$_SESSION["message"]=3D$oShape-&gt;values["Name"];<BR>&nbsp;&nbs=
p;}<BR>$oLayer-&gt;close();=20
<BR>&nbsp;}<BR>$oPoint-&gt;free();</FONT></DIV></BODY></HTML>

------=_NextPart_000_0009_01C3A72B.890A45D0--




More information about the mapserver-users mailing list