[postgis-users] Help with query

mark balman mark.balman at gmail.com
Tue Dec 9 08:53:24 PST 2008


Hi All

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;

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"

At the moment I define the distance from the CLASS EXPRESSION so I have 3
classes

1)  EXPRESSION ([dist] <= 1)
2)  EXPRESSION ([dist] >= 1 AND [dist] <= 2)
3)  EXPRESSION ([dist] >= 2 AND [dist] <= 3)

(distance is decimal degrees)

I can create a buffer around a mouse click on the map using the following
query

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"

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.

Any help or advice would be really appreciated.

Thanks in advance

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081209/89258d2a/attachment.html>


More information about the postgis-users mailing list