[OpenLayers-Users] Markers vs Features?

Christopher Schmidt crschmidt at metacarta.com
Fri Apr 4 13:59:00 EDT 2008


On Fri, Apr 04, 2008 at 12:38:47PM -0400, Matt J Cwanek wrote:
> On 04/04/08 11:41 -0400, Christopher Schmidt wrote:
> > In general, you can even have, for example, all your lines on one layer,
> > all your points on another.
> > 
> > At the current time, only one layer can be 'selectable' (and therefore
> > draggable) at a time -- therefore there are technical limitations
> > blocking this, but that's at least the idea.
> 
> Well, then let me ask this. All our markers (draggable or not) currently
> can be clicked to open a GMap2 infowindow for details about that marker.
> 
> If I split the markers into draggable and non-draggable, and create a
> separate layer for each, does that mean only the selected layer will
> receive click events? 

Yeah, that is the current state.

You can have two different SelectFeature controls attached to the map;
the problem them is switching between them becomes a deliberate user
action.

You can also collect click events explicitly with a Click Handler, and
on a click, loop through your non-active select layer, and test for
Geometry intersection. This would essentially mimic the way that I would
advise building a more advanced SelectFeature that supported selecting
features from multiple layers. 

> Ok, so it sounds like what I should do is use a Vector feature w/a Point
> geometry and appropriate styling, instead of using a Marker or a base 
> Feature w/a Marker.

Yep, that's what I would recommend.

> > Hope this helps,
> 
> Yes, this is a huge help, thanks.

Cool.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list