<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
/* List Definitions */
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Mark,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This could be either a mapserver question,
or a postgis question depending on the solution you chose. I would say
the following (untested code):</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Mapserver:</span></font></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>-<font size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>
</span></font></span></font><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>define 3 layers, 1 for
each concentric circle using your 1 dd circle as the template, with duplicates
of 2 and 3</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>PostGIS:</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>construct a query which
will return 3 results for each point in your set, using a </span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>UNION</span></font><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>, and altering your gid
to be a decimal with .1,.2, and .3 appended on the end to insure a unique gid, something
like:<br>
</span></font><font size=2><span style='font-size:10.0pt'>DATA</span></font><font
size=2><span style='font-size:10.0pt'> "the_geom from ( (SELECT
buffer(geometryfromtext('POINT(' || (%mapx%) || ' ' || (%mapy%) || ')',4326),
1) AS the_geom, (gid::float8 + 0.1) as gid FROM kbapoly) UNION (SELECT buffer(geometryfromtext('POINT('
|| (%mapx%) || ' ' || (%mapy%) || ')',4326), 2) AS the_geom, (gid::float8 + 0.2)
as gid FROM kbapoly) UNION (SELECT buffer(geometryfromtext('POINT(' || (%mapx%)
|| ' ' || (%mapy%) || ')',4326), 3) AS the_geom, (gid::float8 + 0.3) as gid FROM
kbapoly) ) as myquery using srid=4326 using unique gid" </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This PostGIS query assumes that mapserver
will accept a floating point as the unique identifier, rather than an integer,
and I do not know if that is acceptable or not. Once again, probably more
of a mapserver question, when you get right down to it.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>HTH,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>r.b.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Robert W. Burgholzer</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Surface Water Modeler</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Office of Water Supply and Planning</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Virginia Department of Environmental
Quality</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><a
href="mailto:rwburgholzer@deq.virginia.gov">rwburgholzer@deq.virginia.gov</a></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>804-698-4405</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Open Source Modeling Tools:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><a
href="http://sourceforge.net/projects/npsource/">http://sourceforge.net/projects/npsource/</a></span></font></p>
</div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <b><span
style='font-weight:bold'>On Behalf Of </span></b>mark balman<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, December 09, 2008
11:53 AM<br>
<b><span style='font-weight:bold'>To:</span></b>
postgis-users@postgis.refractions.net<br>
<b><span style='font-weight:bold'>Subject:</span></b> [postgis-users] Help with
query</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>Hi All</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>I am trying to create a query that uses a mouse click
to get coordinates (from mapserver) and then features within a specified
distance are selected and displayed in different colours. The query I have at
the moment works well, however, the problem I am trying to solve is how to
indicate these distances with concentric circles around the coordinates from
the mouse click. Is this do-able? My query is as follows;</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>DATA "the_geom FROM (SELECT intname,the_geom,
gid, distance(the_geom, geometryfromtext('POINT(' || (%mapx%) || ' ' ||
(%mapy%) || ')',4326)) AS dist from kbapoly) as myquery using SRID=4326 using
unique gid"</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>At the moment I define the distance from the CLASS EXPRESSION
so I have 3 classes</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>1) EXPRESSION ([dist] <= 1)</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>2) EXPRESSION ([dist] >= 1 AND [dist] <=
2)</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>3) EXPRESSION ([dist] >= 2 AND [dist] <=
3)</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>(distance is decimal degrees)</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>I can create a buffer around a mouse click on the map
using the following query</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>DATA "the_geom from (SELECT
buffer(geometryfromtext('POINT(' || (%mapx%) || ' ' || (%mapy%) || ')',4326),
1) AS the_geom, gid as gid FROM kbapoly) as myquery using srid=4326 using
unique gid" </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>What I am struggling with is how to combine these two
queries if this is possible. So I can display three concentric buffers at 1, 2
and 3 decimal degrees around the selected features.</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Any help or advice would be really appreciated.</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Thanks in advance</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Mark</span></font></p>
</div>
</div>
</body>
</html>