Adding and removing markers in openlayers on Drupal after page-load -


i have change data set displayed on map according selections on page , creating several marker layers switching between them based on user input. reason cannot add layer after map has been rendered on page, seems shouldn't hard think may have syntax wrong since way drupal sets map different straight forward openlayers. can not map object

var map = drupal.settings.openlayers.maps["openlayers-map-auto-id-0"];

then add , remove marker layers it? maybe there's way of getting it?

any appreciated, - chris

the drupal openlayers module stores settings in drupal.settings.openlayers.maps.

what need this:

var ol = $('#openlayers-map-auto-id-0').data('openlayers'); var max_extent = ol.openlayers.getmaxextent(); // or other openlayers method... ... 

the actual openlayers instance (as copy of map-specific settings) stored jquery's .data() method. when call $('#map-id').data('openlayers') you'll object map , openlayers members correspond map settings , actual ol object instance, respectively.

you might want consider writing ol behavior handle use case -- check out default behaviors provided drupal openlayers module sense of how works.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -