[Mapserver-users] How can queryByPoint and getShape mapscript functions work with PostGIS

Naroot Wanalertlak wanalena at engr.orst.edu
Sun Mar 2 19:18:31 PST 2003


This is a multi-part message in MIME format.

------=_NextPart_000_007A_01C2E0F0.83210F70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
  I am now implementing a Map application that
has a Point layer from PostGIS. The problem is
whenever I try to use queryByPoint on this layer
it will return MS_SUCCESS.


$nClickGeoX =3D GMapPix2Geo($nClickPixX, 0, $dfWidthPix,
                                             $dfMinX, $dfMaxX, 0);
$nClickGeoY =3D GMapPix2Geo($nClickPixY, 0, $dfHeightPix,
                                             $dfMinY, $dfMaxY, 1);
$oClickGeo =3D ms_newPointObj();
$oClickGeo->setXY($nClickGeoX, $nClickGeoY);

$layer =3D $gpoMap->getLayer(7);
$err =3D @$layer->queryByPoint($oClickGeo, MS_SINGLE, -20);    //  <-- I =
have tried both MapUnit (positive) and Pixel (negative)

if($err =3D=3D MS_FAILURE)
{
       echo "<font size=3D4 color=3Dred>There were no results found, try =
zooming in closer.</font>";
}

^^^^^^^^ $err will always return MS_FAILURE ^^^^^^^^^^^

else if( $err =3D=3D MS_SUCCESS)
{ ....

Does anybody has experience with that?

--Naroot Wanalertlak

------=_NextPart_000_007A_01C2E0F0.83210F70
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.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>  I am now implementing a Map =
application=20
that</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>has a Point layer from PostGIS. The =
problem=20
is</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>whenever I try to use queryByPoint on =
this=20
layer</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it will return MS_SUCCESS.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>$nClickGeoX =3D =
GMapPix2Geo($nClickPixX, 0,=20
$dfWidthPix,<BR>         &nb=
sp;           &nbs=
p;           &nbsp=
;         =20
 $dfMinX, $dfMaxX, 0);<BR>$nClickGeoY =3D GMapPix2Geo($nClickPixY, =
0,=20
$dfHeightPix,<BR>         &n=
bsp;           &nb=
sp;   =20
            &=
nbsp;     =20
$dfMinY, $dfMaxY, 1);<BR>$oClickGeo =3D=20
ms_newPointObj();<BR>$oClickGeo->setXY($nClickGeoX,=20
$nClickGeoY);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>$layer =3D =
$gpoMap->getLayer(7);<BR>$err =3D=20
@$layer->queryByPoint($oClickGeo, MS_SINGLE, -20);    =
// =20
<-- I have tried both MapUnit (positive) and Pixel =
(negative)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>if($err =3D=3D=20
MS_FAILURE)<BR>{<BR>       echo "<font =
size=3D4=20
color=3Dred>There were no results found, try zooming in=20
closer.</font>";<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>^^^^^^^^ $err will always =
return MS_FAILURE=20
^^^^^^^^^^^</DIV></FONT>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT>
<DIV><FONT face=3DArial size=3D2>else if( $err =3D=3D MS_SUCCESS)<BR>{=20
....<BR></FONT></DIV>
<DIV>Does anybody has experience with that?</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>--Naroot Wanalertlak</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT></BODY></HTML>

------=_NextPart_000_007A_01C2E0F0.83210F70--




More information about the MapServer-users mailing list