2.0-Beta5 seems to break the ZOOM TO LAYER behavior. It seems not to work properly. It instead displays the Restricted Extent map area set in the Center&Bounds section.

Comments

pol’s picture

Hello,

Could you post an export of your map please ?

Thanks

cesareaugusto’s picture

Sure. Here's the export code:

$openlayers_maps = new stdClass();
$openlayers_maps->disabled = FALSE; /* Edit this to true to make a default openlayers_maps disabled initially */
$openlayers_maps->api_version = 1;
$openlayers_maps->name = 'tag_geografico';
$openlayers_maps->title = 'Nodi nel termine della tassonomia corrente';
$openlayers_maps->description = 'Mappa dei nodi etichettati con il tag corrente';
$openlayers_maps->data = array(
  'width' => 'auto',
  'height' => '400px',
  'image_path' => 'sites/all/modules/openlayers/themes/default_dark/img/',
  'css_path' => 'sites/all/modules/openlayers/themes/default_dark/style.css',
  'proxy_host' => '',
  'hide_empty_map' => 0,
  'center' => array(
    'initial' => array(
      'centerpoint' => '13.886724858556, 42.31792138734',
      'zoom' => '8',
    ),
    'restrict' => array(
      'restrictextent' => 0,
      'restrictedExtent' => '',
    ),
  ),
  'behaviors' => array(
    'openlayers_behavior_navigation' => array(
      'zoomWheelEnabled' => 0,
      'zoomBoxEnabled' => 0,
      'documentDrag' => 1,
    ),
    'openlayers_behavior_panzoom' => array(),
    'openlayers_behavior_popup' => array(
      'layers' => array(
        'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
        'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
        'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
        'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
        'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
        'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
        'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
        'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
      ),
      'panMapIfOutOfView' => 1,
      'keepInMap' => 1,
    ),
    'openlayers_behavior_zoomtolayer' => array(
      'zoomtolayer' => array(
        'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
        'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
        'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
        'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
        'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
        'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
        'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
        'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
        'bing_hybrid' => 0,
      ),
      'point_zoom_level' => '10',
      'zoomtolayer_scale' => '1',
    ),
    'openlayers_behavior_zoomtomaxextent' => array(),
  ),
  'default_layer' => 'google_normal',
  'layers' => array(
    'google_normal' => 'google_normal',
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
  ),
  'layer_weight' => array(
    'mappa_della_citta_alloggi_overlay' => '-10',
    'mappa_della_citta_associazioni_overlay' => '0',
    'mappa_della_citta_discoteche_overlay' => '0',
    'mappa_della_citta_spiagge_overlay' => '0',
    'mappa_della_citta_templi_overlay' => '0',
    'mappa_della_citta_bar_overlay' => '0',
    'mappa_della_citta_cruising_overlay' => '0',
    'mappa_della_citta_ristoranti_overlay' => '0',
    'geofield_formatter' => '0',
    'tag_geografici_openlayers_1' => '0',
    'openlayers_kml_example' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'openlayers_geojson_picture_this' => '0',
  ),
  'layer_styles' => array(
    'geofield_formatter' => '0',
    'openlayers_geojson_picture_this' => '0',
    'openlayers_kml_example' => '0',
    'tag_geografici_openlayers_1' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'mappa_della_citta_alloggi_overlay' => 'hotel_mapiconscollection',
    'mappa_della_citta_ristoranti_overlay' => 'restaurant_mapiconscollection',
    'mappa_della_citta_discoteche_overlay' => 'disco_mapiconscollection',
    'mappa_della_citta_associazioni_overlay' => 'associazione_mapiconscollection',
    'mappa_della_citta_spiagge_overlay' => 'spiaggia_mapiconscollection',
    'mappa_della_citta_templi_overlay' => 'tempio_mapiconscollection',
    'mappa_della_citta_cruising_overlay' => 'circoliuomini_mapiconscollection',
    'mappa_della_citta_bar_overlay' => 'bar_mapiconscollection',
  ),
  'layer_styles_select' => array(
    'geofield_formatter' => '0',
    'openlayers_geojson_picture_this' => '0',
    'openlayers_kml_example' => '0',
    'tag_geografici_openlayers_1' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'mappa_della_citta_alloggi_overlay' => 'hotel_mapiconscollection',
    'mappa_della_citta_ristoranti_overlay' => 'restaurant_mapiconscollection',
    'mappa_della_citta_discoteche_overlay' => 'disco_mapiconscollection',
    'mappa_della_citta_associazioni_overlay' => 'associazione_mapiconscollection',
    'mappa_della_citta_spiagge_overlay' => 'spiaggia_mapiconscollection',
    'mappa_della_citta_templi_overlay' => 'tempio_mapiconscollection',
    'mappa_della_citta_cruising_overlay' => 'circoliuomini_mapiconscollection',
    'mappa_della_citta_bar_overlay' => 'bar_mapiconscollection',
  ),
  'layer_activated' => array(
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'geofield_formatter' => 0,
    'openlayers_geojson_picture_this' => 0,
    'openlayers_kml_example' => 0,
    'tag_geografici_openlayers_1' => 0,
    'test_geojson_direct_data' => 0,
    'test_geojson_url' => 0,
    'test_kml_url' => 0,
  ),
  'layer_switcher' => array(
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'geofield_formatter' => 0,
    'openlayers_geojson_picture_this' => 0,
    'openlayers_kml_example' => 0,
    'tag_geografici_openlayers_1' => 0,
    'test_geojson_direct_data' => 0,
    'test_geojson_url' => 0,
    'test_kml_url' => 0,
  ),
  'projection' => 'EPSG:3857',
  'displayProjection' => 'EPSG:4326',
  'styles' => array(
    'default' => 'default_marker_black_small',
    'select' => 'default_marker_black',
    'temporary' => 'default_marker_blue',
  ),
);
augustus.kling’s picture

It seems Zoom to Layer and Zoom To Max Extent is enabled at the same time. Please try disabling the latter.

cesareaugusto’s picture

@augustus.kling: Zoom To Max Extent is and was off...

pol’s picture

Status: Active » Fixed

Dude,

You should look at it again. I tried on simplytest.me and when you disable the Zoom To Map Extent behavior, and then export the map, the behavior is also gone from the export, so what you are saying is pretty much impossible.

I'll close this for now, feel free to reopen if you still cannot find a solution.

cesareaugusto’s picture

I tried to enable that behavior a couple of days ago. I then turned it off again. Perhaps it was still on when exporting code. I confirm the Zoom To Map Extent behavior was off when I first noticed this bug. It is still off. Zoom to layer still doesn't work correctly.

My map is made of Views layers which display nodes tagged with the current taxonomy term of a vocabulary. What happens is that Zoom To Map Extent works only when the map displays contents computed from one taxonomy term (let's all it "term A") of the vocabulary. The bug get out only when it comes to contents of "term B", "term C", etc etc.

Here's the correct map export (Zoom To Map Extent behavior off).

$openlayers_maps = new stdClass();
$openlayers_maps->disabled = FALSE; /* Edit this to true to make a default openlayers_maps disabled initially */
$openlayers_maps->api_version = 1;
$openlayers_maps->name = 'tag_geografico';
$openlayers_maps->title = 'Nodi nel termine della tassonomia corrente';
$openlayers_maps->description = 'Mappa dei nodi etichettati con il tag corrente';
$openlayers_maps->data = array(
  'width' => 'auto',
  'height' => '400px',
  'image_path' => 'sites/all/modules/openlayers/themes/default_dark/img/',
  'css_path' => 'sites/all/modules/openlayers/themes/default_dark/style.css',
  'proxy_host' => '',
  'hide_empty_map' => 0,
  'center' => array(
    'initial' => array(
      'centerpoint' => '13.886724858556, 42.31792138734',
      'zoom' => '8',
    ),
    'restrict' => array(
      'restrictextent' => 0,
      'restrictedExtent' => '',
    ),
  ),
  'behaviors' => array(
    'openlayers_behavior_navigation' => array(
      'zoomWheelEnabled' => 0,
      'zoomBoxEnabled' => 0,
      'documentDrag' => 1,
    ),
    'openlayers_behavior_panzoom' => array(),
    'openlayers_behavior_popup' => array(
      'layers' => array(
        'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
        'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
        'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
        'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
        'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
        'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
        'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
        'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
      ),
      'panMapIfOutOfView' => 1,
      'keepInMap' => 1,
    ),
    'openlayers_behavior_zoomtolayer' => array(
      'zoomtolayer' => array(
        'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
        'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
        'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
        'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
        'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
        'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
        'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
        'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
        'bing_road' => 0,
      ),
      'point_zoom_level' => '10',
      'zoomtolayer_scale' => '1',
    ),
  ),
  'default_layer' => 'bing_road',
  'layers' => array(
    'bing_road' => 'bing_road',
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
  ),
  'layer_weight' => array(
    'mappa_della_citta_alloggi_overlay' => '-10',
    'mappa_della_citta_templi_overlay' => '0',
    'mappa_della_citta_discoteche_overlay' => '0',
    'mappa_della_citta_bar_overlay' => '0',
    'mappa_della_citta_ristoranti_overlay' => '0',
    'mappa_della_citta_associazioni_overlay' => '0',
    'mappa_della_citta_cruising_overlay' => '0',
    'mappa_della_citta_spiagge_overlay' => '0',
    'geofield_formatter' => '0',
    'tag_geografici_openlayers_1' => '0',
    'openlayers_kml_example' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'openlayers_geojson_picture_this' => '0',
  ),
  'layer_styles' => array(
    'geofield_formatter' => '0',
    'openlayers_geojson_picture_this' => '0',
    'openlayers_kml_example' => '0',
    'tag_geografici_openlayers_1' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'mappa_della_citta_alloggi_overlay' => 'hotel_mapiconscollection',
    'mappa_della_citta_spiagge_overlay' => 'spiaggia_mapiconscollection',
    'mappa_della_citta_discoteche_overlay' => 'disco_mapiconscollection',
    'mappa_della_citta_templi_overlay' => 'tempio_mapiconscollection',
    'mappa_della_citta_bar_overlay' => 'bar_mapiconscollection',
    'mappa_della_citta_ristoranti_overlay' => 'restaurant_mapiconscollection',
    'mappa_della_citta_cruising_overlay' => 'circoliuomini_mapiconscollection',
    'mappa_della_citta_associazioni_overlay' => 'associazione_mapiconscollection',
  ),
  'layer_styles_select' => array(
    'geofield_formatter' => '0',
    'openlayers_geojson_picture_this' => '0',
    'openlayers_kml_example' => '0',
    'tag_geografici_openlayers_1' => '0',
    'test_geojson_direct_data' => '0',
    'test_geojson_url' => '0',
    'test_kml_url' => '0',
    'mappa_della_citta_alloggi_overlay' => 'hotel_mapiconscollection',
    'mappa_della_citta_spiagge_overlay' => 'spiaggia_mapiconscollection',
    'mappa_della_citta_discoteche_overlay' => 'disco_mapiconscollection',
    'mappa_della_citta_templi_overlay' => 'tempio_mapiconscollection',
    'mappa_della_citta_bar_overlay' => 'bar_mapiconscollection',
    'mappa_della_citta_ristoranti_overlay' => 'restaurant_mapiconscollection',
    'mappa_della_citta_cruising_overlay' => 'circoliuomini_mapiconscollection',
    'mappa_della_citta_associazioni_overlay' => 'associazione_mapiconscollection',
  ),
  'layer_activated' => array(
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'geofield_formatter' => 0,
    'openlayers_geojson_picture_this' => 0,
    'openlayers_kml_example' => 0,
    'tag_geografici_openlayers_1' => 0,
    'test_geojson_direct_data' => 0,
    'test_geojson_url' => 0,
    'test_kml_url' => 0,
  ),
  'layer_switcher' => array(
    'mappa_della_citta_alloggi_overlay' => 'mappa_della_citta_alloggi_overlay',
    'mappa_della_citta_spiagge_overlay' => 'mappa_della_citta_spiagge_overlay',
    'mappa_della_citta_discoteche_overlay' => 'mappa_della_citta_discoteche_overlay',
    'mappa_della_citta_templi_overlay' => 'mappa_della_citta_templi_overlay',
    'mappa_della_citta_bar_overlay' => 'mappa_della_citta_bar_overlay',
    'mappa_della_citta_ristoranti_overlay' => 'mappa_della_citta_ristoranti_overlay',
    'mappa_della_citta_cruising_overlay' => 'mappa_della_citta_cruising_overlay',
    'mappa_della_citta_associazioni_overlay' => 'mappa_della_citta_associazioni_overlay',
    'geofield_formatter' => 0,
    'openlayers_geojson_picture_this' => 0,
    'openlayers_kml_example' => 0,
    'tag_geografici_openlayers_1' => 0,
    'test_geojson_direct_data' => 0,
    'test_geojson_url' => 0,
    'test_kml_url' => 0,
  ),
  'projection' => 'EPSG:3857',
  'displayProjection' => 'EPSG:4326',
  'styles' => array(
    'default' => 'default_marker_black_small',
    'select' => 'default_marker_black',
    'temporary' => 'default_marker_blue',
  ),
);
cesareaugusto’s picture

I think I found the "bug". The behavior stops working on maps which have an empty layer among the ones chosen to compute the zoom from. It may happen when layers are autocomputed Views data overlays.

augustus.kling’s picture

Assigned: Unassigned » augustus.kling
Status: Fixed » Needs work

That's really a bug. In case a layer has no data the behaviour waits until data gets available nevertheless. Essentially, this results in the behaviour being inactive as soon as one layer finished loading without data before the behaviour is initialized.
The behaviour needs to learn to distinguish between a layer still loading and a layer that finished loading without features being returned.

cesareaugusto’s picture

I don't know whether it may... the bug first appeared in the latest couple of betas (4 and 5). It used to work with the daily devs prior to those betas.

tjhellmann’s picture

I ran into this as well with the latest betas. I have two views computed data overlays and when one is empty it no longer zooms. Rolling back openlayers_behavior_zoomtolayer.js to http://drupalcode.org/project/openlayers.git/commit/f169e4a5f87e092ce4eb... allows it to work for me again.

augustus.kling’s picture

Status: Needs work » Needs review

It seems the old version did zoom as soon as a data extent was available whereas the new version awaited the availability of the combined extent. This yielded the desired behavior even though the old version was unable to know when layers finished loading without data, too.
Commit 39369a9d26620efba375c8f1364788d0e5463931 restores this behavior. It keeps the other changes to continue supporting other layers types than KML and GeoJSON.
Please test if it's working properly for your cases, now.

cesareaugusto’s picture

@augustus.kling: I've been testing your commit on my two Drupal installs and it doesn't work. Only the version suggested by tjhellmann works.

augustus.kling’s picture

Status: Needs review » Active

The version of commit f169e4a5f87e092ce4eb5b5957021b2c3c4e8786 had its problems, too. We mainly changed it to support more layer types and to correct behaviour of asynchronous loading.

I'm not able to reproduce trouble with the current version of the behaviour.
Cesare, is it possible to make the non-working site available online somewhere so that I can directly debug it? In order to do so I need an URL where the non-working zoom is shown. The page needs to be served with uncompressed JavaScript (including the OpenLayers library) to allow for breakpoints.

tjhellmann’s picture

The commit referenced in #11 works for the case I was referring to in #10. When two data overlays and available and one is empty it now zooms correctly to the one that is not empty. Thanks for your work on this @augustus.kling.

augustus.kling’s picture

Thanks for your feedback.

By the way it zooms to the area that encloses all features of the selected layers. Let's assume you have 3 layers: 1 with data of Europe, 1 with data of Canada and 1 with data of Australia. In case features are only available for Europe and Canada it would zoom so that Europe and Canada are visible at the same time.

pol’s picture

@cesareaugusto,

We are awaiting for your feedback before releasing a new beta. Can you double check please ?

Thanks.

cesareaugusto’s picture

@Pol: Hi Pol, at present I'm outside Italy for work and got not access to my FTP account from here. Shall get back in the office next week. I'll be able to try it out as I get back home.

cesareaugusto’s picture

I managed to try it out from where I am. Commit f169e4a5f87e092ce4eb5b5957021b2c3c4e8786 still doesn't work. It doesn't even zoom on maps with no empty layers. Only the version suggested by tjhellmann seems to work.

pol’s picture

Status: Active » Fixed

I'll close this for now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cesareaugusto’s picture

I tested it on all my running websites. It seems to work now!

pol’s picture

Oh that's good news ;-)