[OpenLayers-Users] Select markers at the same location

Christopher Schmidt crschmidt at metacarta.com
Thu Jul 12 10:17:30 EDT 2007


On Thu, Jul 12, 2007 at 06:23:57AM -0700, David_Als wrote:
> 
> Hello users,
> 
> I am using OpenLayers.Layer.Markers to add layers of markers to a map.
> Then I want to be able to select a specific marker clicking on it, so I've
> registered the click event for OpenLayers.Marker; then, when the event is
> raised I can react on the selection of that specific marker and present for
> instance information about the selected marker to the user.
> 
> The problem comes when I have markers at the exact same location; then, no
> matter how much I zoom in, they all appear as one single icon and so I can
> only select the one on top.
> 
> I have been thinking in offering for instance the possibility of
> right-clicking on a marker and getting a list of markers at the same
> location, if any, but that seems to me a bit tedious thing to do,
> since I would have to search the location of all the markers on all the
> layers and compare them to find which ones are at that (or very close to
> that) location.
> 
> So my question is, is there an easy way of selecting any of the markers
> located at a same location? Do you have any suggestion of making markers at
> the same location easily "selectable"?

http://ondemand.metacarta.com/client_samples/geosearch.js.html

If you click a marker, a popup window contains all relavnt documents --
fetched by a server-side query with a small bounding box around the
center of the marker. IF your data is coming from a server, you might be
able to do something similar.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list