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

Mikeyahoo mike_5102 at yahoo.com.tw
Tue Jan 7 06:43:36 PST 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 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 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> </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> </DIV>
<DIV><FONT face=3DMingLiu>   $cx=3D($rectangle->maxx -=20
$rectangle->minx)/$map->width;<BR>   =
$cy=3D($rectangle->maxy-=20
$rectangle->miny)/$map->height;<BR>   =
$x1=3D$rectangle->minx +=20
$cx*$x;<BR>   $y1=3D$rectangle->maxy - =
$cy*$y;<BR>  =20
$pon_point =3D ms_newpointObj();<BR>  =20
$pon_point->setXY($x1,$y1);</FONT></DIV>
<DIV><FONT face=3DMingLiu><FONT face=3DMingLiu>  =20
$layer->querybypoint($pon_point,MS_SINGLE,-1);<BR>   echo=20
$pon_point->x;<BR>   echo "\n";<BR>   echo=20
$pon_point->y;</FONT></FONT></DIV>
<DIV><FONT face=3DMingLiu><FONT =
face=3DMingLiu></FONT></FONT> </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
<=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> </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 don't know=20
the definition "in pixel"?what does it mean?</DIV>
<DIV> </DIV>
<DIV><FONT face=3DMingLiu>I'll really apreciate your =
response!</FONT></DIV>
<DIV><FONT face=3DMingLiu></FONT> </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