[OpenLayers-Users] Best strategy to add many clickable rectangle areas?

Arnd Wippermann arnd.wippermann at web.de
Tue Oct 14 15:18:15 EDT 2008


If you work with features coming from wfs, gml, kml, etc., then you can
register 'featureselected' for the vector layer. 

If the source of the features have an attribute with the specific url, you
can retrieve the url from the feature and execute your function.

var aktLayer = 1; //index of a vectorlayer
map.layers[aktLayer].events.register('featureselected',
map.layers[aktLayer], regFeatureSelected);

function regFeatureSelected()
{
    var objF = this.selectedFeatures[0];

    theUrl = objF.attributes['name'] ? objF.attributes['name'] :
"http://www.google.de";

    window.open(theUrl);
}

Arnd Wippermann
 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von darrepac
Gesendet: Dienstag, 14. Oktober 2008 17:45
An: users at openlayers.org
Betreff: [OpenLayers-Users] Best strategy to add many clickable rectangle
areas?


Hello,

New to openlayers, I am starting to put my hands on it. I have seen how
powerful openlayers is, which also make feel a little bit lost in front of
so much and deep functionalities. I require your experience to oriente me in
the things I am trying to do.

I would like to have many rectangles area (about 100) which will delimit
some geographical area and which will be clickable by the user to activate
dedicate and specific URL (the rectangle could only be a box or a
semi-transparent filled color).

I don't know what is the best system for doing so. So far I have seen the
boxes example (but also a non answered question related to my needs here:
http://www.nabble.com/Box-Click-Event-to13782689.html), I have seen that we
can overlayed GML where you can define rectangle (but not sure if we can
assign unique URL for each one?)... may-be other solution?

Thanks for your thoughts.
--
View this message in context:
http://www.nabble.com/Best-strategy-to-add-many-clickable-rectangle-areas--t
p19975759p19975759.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list