[OpenLayers-Users] Get features within x distance

Coup Coup tencoupons55 at yahoo.com
Thu Jun 16 14:02:54 EDT 2011


Hi,
I am using OpenLayers client side with a postGIS backend and have a map of county and zip layers that are hidden (each layer has one feature).
I want to show them when the user requests them in a form GUI.

To do this I need to :
A) Obtain the centroid of the zip inputted from the features' geometry of the corresponding layer.
B) Loop through the layers and perform a distance query on the centroid as compared to each layer's geometry to determine if it resides within x miles.
C) Show the layer when the distance query returns true.

I know how to toggle layer visibility (C). And I know how to access individual layers. I could use Ajax to perform the distance queries in POSTGIS, but would like to know how to do it client side so I can gauge performance (and gain more knowledge working with OpenLayers).

Can anyone provide any insight or examples specifically in referencing geometries from layers and performing distance queries on them?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110616/13da89d5/attachment-0001.html


More information about the Users mailing list