[Mapserver-users] Query postgis layer

Christian Blumer christian.blumer at epfl.ch
Fri Jun 27 09:10:15 EDT 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0051_01C33CBE.365EEF70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all
I would like to make a query on a layer connected to postgis with PHP =
mapscript.
The layer definition is:
LAYER
  NAME ptmesure
  STATUS off
  TYPE POINT
  CONNECTIONTYPE postgis
  CONNECTION "user=3Dxxx password=3Dxxx dbname=3Dtest host=3Dxxx"
  DATA "the_geom from (select * from mesure) as foo using unique gid =
using SRID=3D-1"
  CLASS
    NAME "gps"
    COLOR 220 0 0
    SYMBOL 'circle'
    SIZE 7
    TEMPLATE "mesure.html"
  END=20
  HEADER "mesure_header.html"
  FOOTER "mesure_footer.html"
  TOLERANCE 10=20
END

I am using    =20
$my_layer =3D $map->getlayerbyname(ptmesure);
$numResults =3D $my_layer->getNumResults();
but the query result is always 0.

I tested is on the same layer but in shape format and it worked.
What should I do to make it work properly on a postgis layer?
Cheers,
Christian
------=_NextPart_000_0051_01C33CBE.365EEF70
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.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I would like to make a query on a layer =
connected=20
to postgis with PHP mapscript.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The layer definition is:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>&nbsp; NAME ptmesure<BR>&nbsp; =
STATUS=20
off<BR>&nbsp; TYPE POINT<BR>&nbsp; CONNECTIONTYPE postgis<BR>&nbsp; =
CONNECTION=20
"user=3Dxxx password=3Dxxx dbname=3Dtest host=3Dxxx"<BR>&nbsp; DATA =
"the_geom from=20
(select * from mesure) as foo using unique gid using =
SRID=3D-1"<BR>&nbsp;=20
CLASS<BR>&nbsp;&nbsp;&nbsp; NAME "gps"<BR>&nbsp;&nbsp;&nbsp; COLOR 220 0 =

0<BR>&nbsp;&nbsp;&nbsp; SYMBOL 'circle'<BR>&nbsp;&nbsp;&nbsp; SIZE=20
7<BR>&nbsp;&nbsp;&nbsp; TEMPLATE "mesure.html"<BR>&nbsp; END <BR>&nbsp; =
HEADER=20
"mesure_header.html"<BR>&nbsp; FOOTER "mesure_footer.html"<BR>&nbsp; =
TOLERANCE=20
10 <BR>END</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am=20
using&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$my_layer =3D=20
$map-&gt;getlayerbyname(ptmesure);<BR>$numResults =3D=20
$my_layer-&gt;getNumResults();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but the query result is always =
0.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I tested is on the same layer but in =
shape format=20
and it worked.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>What should I do to make it work =
properly on a=20
postgis layer?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Cheers,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Christian</FONT></DIV></BODY></HTML>

------=_NextPart_000_0051_01C33CBE.365EEF70--




More information about the mapserver-users mailing list