[Mapserver-users] about php function "querybypoint()"

Mikeyahoo mike_5102 at yahoo.com.tw
Tue Jan 7 09:43:36 EST 2003


This is a multi-part message in MIME format.

------=_NextPart_000_004A_01C2B69E.3728BD60
Content-Type: text/plain;
	charset="big5"
Content-Transfer-Encoding: quoted-printable

Hello all,
I have PHP ver4.0.6 and MapServer version 3.5.I want to search the point =
on the map and I use the function "int queryByPoint(pointObj point, int =
mode, double buffer)",but there are some problems:
the error messages:
Warning: MapServer Error in msQueryByPoint(): No matching record(s) =
found.

this is my file:pon.phtml

   $cx=3D($rectangle->maxx - $rectangle->minx)/$map->width;
   $cy=3D($rectangle->maxy- $rectangle->miny)/$map->height;
   $x1=3D$rectangle->minx + $cx*$x;
   $y1=3D$rectangle->maxy - $cy*$y;
   $pon_point =3D ms_newpointObj();
   $pon_point->setXY($x1,$y1);
   $layer->querybypoint($pon_point,MS_SINGLE,-1);
   echo $pon_point->x;
   echo "\n";
   echo $pon_point->y;

The function defined:
int queryByPoint(pointObj point, int mode, double buffer)
Query all selected layers in map at point location specified in =
georeferenced map coordinates (i.e. not pixels).The query is performed =
on all the shapes that are part of a CLASS that contains a TEMPLATE =
value or that match any class in a layer that contains a LAYER TEMPLATE =
value.
Mode is MS_SINGLE or MS_MULTIPLE depending on number of results you =
want.Passing buffer <=3D0 defaults to tolerances set in the map file(in =
pixels) but you can use a constant buffer (specified in ground units) =
instead.
Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was =
found or if some other error happened (note that the error message in =
case nothing was found can be avoided in PHP using the '@' control =
operator).

question:
What's problems with my program?
Can you explan how the function should be used correctly?I don't know =
the definition "in pixel"?what does it mean?

I'll really apreciate your response!





------=_NextPart_000_004A_01C2B69E.3728BD60
Content-Type: text/html;
	charset="big5"
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=3Dbig5">
<META content=3D"MSHTML 5.50.4134.100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DMingLiu>Hello all,<BR>I have PHP ver4.0.6&nbsp;and =
MapServer=20
version 3.5.I want to search the point on the map and I use the function =
<FONT=20
color=3D#ff0000>"int queryByPoint(pointObj point, int mode, double=20
buffer)"</FONT></FONT><FONT face=3D=B2=D3=A9=FA=C5=E9>,but&nbsp;there =
are some=20
problems:</FONT></DIV>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9>the error messages:</FONT></DIV>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9 color=3D#ff0000><FONT =
color=3D#000000><STRONG>Warning</STRONG>:=20
MapServer Error in msQueryByPoint(): No matching record(s)=20
found.</FONT></FONT></DIV>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9>this is my =
file:pon.phtml</FONT></DIV>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9></FONT>&nbsp;</DIV>
<DIV><FONT face=3DMingLiu>&nbsp;&nbsp; $cx=3D($rectangle-&gt;maxx -=20
$rectangle-&gt;minx)/$map-&gt;width;<BR>&nbsp;&nbsp; =
$cy=3D($rectangle-&gt;maxy-=20
$rectangle-&gt;miny)/$map-&gt;height;<BR>&nbsp;&nbsp; =
$x1=3D$rectangle-&gt;minx +=20
$cx*$x;<BR>&nbsp;&nbsp; $y1=3D$rectangle-&gt;maxy - =
$cy*$y;<BR>&nbsp;&nbsp;=20
$pon_point =3D ms_newpointObj();<BR>&nbsp;&nbsp;=20
$pon_point-&gt;setXY($x1,$y1);</FONT></DIV>
<DIV><FONT face=3DMingLiu><FONT face=3DMingLiu>&nbsp;&nbsp;=20
$layer-&gt;querybypoint($pon_point,MS_SINGLE,-1);<BR>&nbsp;&nbsp; echo=20
$pon_point-&gt;x;<BR>&nbsp;&nbsp; echo "\n";<BR>&nbsp;&nbsp; echo=20
$pon_point-&gt;y;</FONT></FONT></DIV>
<DIV><FONT face=3DMingLiu><FONT =
face=3DMingLiu></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DMingLiu><FONT face=3DMingLiu>
<DIV><FONT face=3D=B2=D3=A9=FA=C5=E9>The function defined:</FONT></DIV>
<DIV><FONT face=3DMingLiu>int queryByPoint(pointObj point, int mode, =
double=20
buffer)</FONT></DIV>
<DIV><FONT face=3DMingLiu>Query all selected layers in map at point =
location=20
specified in georeferenced map coordinates (i.e. not pixels).The query =
is=20
performed on all the shapes that are part of a CLASS that contains a =
TEMPLATE=20
value or that match any class in a layer that contains a LAYER TEMPLATE=20
value<FONT color=3D#ff0000><FONT color=3D#000000>.</FONT><BR></FONT>Mode =
is=20
MS_SINGLE or MS_MULTIPLE depending on number of results you want.Passing =
buffer=20
&lt;=3D0 defaults to tolerances set in the map file<FONT =
color=3D#ff0000><FONT=20
color=3D#000000>(in pixels)</FONT> </FONT>but you can use a constant =
buffer=20
(specified in ground units) instead.<BR>Returns MS_SUCCESS if shapes =
were found=20
or MS_FAILURE if nothing was found or if some other error happened (note =
that=20
the error message in case nothing was found can be avoided in PHP using =
the <A=20
href=3D"mailto:'@'">'@'</A> control operator).</FONT></DIV>
<DIV><FONT face=3DMingLiu size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DMingLiu>question:</FONT></DIV>
<DIV><FONT face=3DMingLiu>What's problems with my program?</FONT></DIV>
<DIV>Can you explan how the function should be used =
correctly?I&nbsp;don't know=20
the definition "in pixel"?what does it mean?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DMingLiu>I'll&nbsp;really apreciate your =
response!</FONT></DIV>
<DIV><FONT face=3DMingLiu></FONT>&nbsp;</DIV></DIV>
<DIV><FONT =
face=3DMingLiu></FONT><BR></FONT><BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_004A_01C2B69E.3728BD60--

-----------------------------------------------------------------
< ¨C¤Ñ³£ Yahoo!©_¼¯ >  www.yahoo.com.tw




More information about the mapserver-users mailing list