[Mapserver-users] Complex querying PostGIS Layer

Benjamin Wragg bwragg at tpg.com.au
Thu Jan 16 13:06:50 PST 2003


This is a multi-part message in MIME format.

------=_NextPart_000_000F_01C2BDFB.332503E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi guys,

=20

I need to perform a complex query on a PostGIS layer in PHP MapScript
and I=92m a little unsure which part should handle the query PostGIS or
MapScript. The query logical is shown below:

=20

Select all the polygons in layerX that are intersected by featureA in
layerZ=20

where layerX=92s type field equals =93ROAD=94

=20

LayerX at the moment is always a polygon but in the future may become a
line or point. layerZ could be either point, line polygon but featureA
will only every be one feature.

=20

In PostGIS I believe you can send both the spatial query and the
attribute query in one SQL statement using a WHERE clause. Correct?=20

=20

With MapScript how would the query work? Would I basically need to run
two queries, the spatial part and then the attribute part (or vise vera)

=20

Thanks,

=20

Benjamin Wragg

=20

=20

=20

=20


------=_NextPart_000_000F_01C2BDFB.332503E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:Arial;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>Hi
guys,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>I
need to perform a complex query on a PostGIS layer in PHP MapScript and =
I’m
a little unsure which part should handle the query PostGIS or MapScript. =
The
query logical is shown below:</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>Select
all the polygons in layerX that are intersected by featureA in layerZ =
</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>where
layerX’s type field equals “ROAD”</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>LayerX
at the moment is always a polygon but in the future may become a line or =
point.
layerZ could be either point, line polygon but featureA will only every =
be one feature.</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>In
PostGIS I believe you can send both the spatial query and the attribute =
query in
one SQL statement using a WHERE clause. Correct? </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>With MapScript
how would the query work? Would I basically need to run two queries, the
spatial part and then the attribute part (or vise =
vera)</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>Thanks,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'>Benjamin
Wragg</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt'> </span></font></p>

</div>

</body>

</html>

------=_NextPart_000_000F_01C2BDFB.332503E0--




More information about the MapServer-users mailing list