When trying to render any map with the current 3.x branch in chrome (maybe others), I get the following error.

TypeError: Cannot read property 'wrapDateLine' of null.

It's happening in the module's openlayers.js file, but error reporting is only pointing me to the console logger lines, not the actual source.

Comments

Pol’s picture

Hello,

Mmh weird, on which map ?

Thanks

Brandonian’s picture

All of the example maps, along with a custom one built from the UI don't render. I did a clean install, and I'm still seeing the same issue.

My stack is pretty basic at this point. Drupal 7.21, latest Openlayers 7.x-3.x branch, current versions of ctools (7.x-1.2), Libraries API (7.x-2.1) and proj4js (7.x-1.2). PHP 5.3.22.

Update: Firefox/Firebug has better debug info. TypeError: this.baseLayer is null. In every case, I do have at least one layer selected, and one layer is set as default. Running the unit tests bundled with Openlayers currently has 91 fails, mostly in the "Openlayers Layers" section. I suspect the error can be traced there.

Pol’s picture

Hello,

I just tried to reproduce the bug, I cannot reproduce it.
Here's an export of a simple map I just did:

$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 = 'test';
$openlayers_maps->title = 'test';
$openlayers_maps->description = '';
$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' => '-7.186510064978123e-9, 7.186501469422994e-9',
      'zoom' => '3',
    ),
    'restrict' => array(
      'restrictextent' => 0,
      'restrictedExtent' => '',
    ),
  ),
  'behaviors' => array(
    'openlayers_behavior_keyboarddefaults' => array(),
    'openlayers_behavior_layerswitcher' => array(
      'ascending' => 1,
      'sortBaseLayer' => '0',
      'roundedCorner' => 1,
      'roundedCornerColor' => '#222222',
      'maximizeDefault' => 0,
    ),
    'openlayers_behavior_navigation' => array(
      'zoomWheelEnabled' => 1,
      'zoomBoxEnabled' => 1,
      'documentDrag' => 0,
    ),
    'openlayers_behavior_panzoombar' => array(
      'zoomWorldIcon' => 0,
      'panIcons' => 1,
    ),
  ),
  'default_layer' => 'mapquest_osm',
  'layers' => array(
    'mapquest_osm' => 'mapquest_osm',
    'mapquest_openaerial' => 'mapquest_openaerial',
  ),
  'layer_weight' => array(
    'weather_stations' => '0',
    'weather_forecast' => '0',
    'world_cities' => '0',
    'world_town_spots' => '0',
    'openlayers_vector_example' => '0',
    'geofield_formatter' => '0',
    'sundials' => '0',
    'places_page_1' => '0',
    'drupalcamp_rooms_openlayers_1' => '0',
    'countries' => '0',
    'gpx_layer' => '0',
    'openlayers_geojson_picture_this' => '0',
    'places_openlayers_1' => '0',
    'california_spots' => '0',
  ),
  'layer_styles' => array(
    'california_spots' => '0',
    'countries' => '0',
    'drupalcamp_rooms_openlayers_1' => '0',
    'gpx_layer' => '0',
    'openlayers_geojson_picture_this' => '0',
    'places_openlayers_1' => '0',
    'places_page_1' => '0',
    'sundials' => '0',
    'weather_forecast' => '0',
    'weather_stations' => '0',
    'world_cities' => '0',
    'world_town_spots' => '0',
    'geofield_formatter' => '0',
    'openlayers_vector_example' => '0',
  ),
  'layer_styles_select' => array(
    'california_spots' => '0',
    'countries' => '0',
    'drupalcamp_rooms_openlayers_1' => '0',
    'gpx_layer' => '0',
    'openlayers_geojson_picture_this' => '0',
    'places_openlayers_1' => '0',
    'places_page_1' => '0',
    'sundials' => '0',
    'weather_forecast' => '0',
    'weather_stations' => '0',
    'world_cities' => '0',
    'world_town_spots' => '0',
    'geofield_formatter' => '0',
    'openlayers_vector_example' => '0',
  ),
  'layer_activated' => array(
    'california_spots' => 0,
    'countries' => 0,
    'drupalcamp_rooms_openlayers_1' => 0,
    'gpx_layer' => 0,
    'openlayers_geojson_picture_this' => 0,
    'places_openlayers_1' => 0,
    'places_page_1' => 0,
    'sundials' => 0,
    'weather_forecast' => 0,
    'weather_stations' => 0,
    'world_cities' => 0,
    'world_town_spots' => 0,
    'geofield_formatter' => 0,
    'openlayers_vector_example' => 0,
  ),
  'layer_switcher' => array(
    'california_spots' => 0,
    'countries' => 0,
    'drupalcamp_rooms_openlayers_1' => 0,
    'gpx_layer' => 0,
    'openlayers_geojson_picture_this' => 0,
    'places_openlayers_1' => 0,
    'places_page_1' => 0,
    'sundials' => 0,
    'weather_forecast' => 0,
    'weather_stations' => 0,
    'world_cities' => 0,
    'world_town_spots' => 0,
    'geofield_formatter' => 0,
    'openlayers_vector_example' => 0,
  ),
  'projection' => 'EPSG:3857',
  'displayProjection' => 'EPSG:4326',
  'styles' => array(
    'default' => 'default',
    'select' => 'default_select',
    'temporary' => 'default',
  ),
);

Could you post the export of yours ?

Thanks !

Brandonian’s picture

Sure! Also, your test map still fails on my local.

One place where our environments might be different, are you using a local version of the OL library, or a hosted version? I'm currently using the hosted version, since I did a clean reinstall.

$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 = 'test';
$openlayers_maps->title = 'test';
$openlayers_maps->description = '';
$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' => array(),
  'center' => array(
    'initial' => array(
      'centerpoint' => '0,0',
      'zoom' => '3',
    ),
    'restrict' => array(
      'restrictextent' => 0,
      'restrictedExtent' => '',
    ),
  ),
  'behaviors' => array(
    'openlayers_behavior_keyboarddefaults' => array(),
    'openlayers_behavior_attribution' => array(
      'separator' => '',
    ),
    'openlayers_behavior_layerswitcher' => array(
      'ascending' => 1,
      'sortBaseLayer' => '0',
      'roundedCorner' => 1,
      'roundedCornerColor' => '#222222',
      'maximizeDefault' => 0,
    ),
    'openlayers_behavior_navigation' => array(
      'zoomWheelEnabled' => 1,
      'zoomBoxEnabled' => 1,
      'documentDrag' => 0,
    ),
    'openlayers_behavior_panzoombar' => array(
      'zoomWorldIcon' => 0,
      'panIcons' => 1,
    ),
  ),
  'default_layer' => 'mapquest_osm',
  'layers' => array(
    'mapquest_osm' => 'mapquest_osm',
  ),
  'layer_weight' => array(
    'openlayers_geojson_picture_this' => '0',
    'openlayers_vector_example' => '0',
  ),
  'layer_styles' => array(
    'openlayers_vector_example' => '0',
    'openlayers_geojson_picture_this' => '0',
  ),
  'layer_styles_select' => array(
    'openlayers_vector_example' => '0',
    'openlayers_geojson_picture_this' => '0',
  ),
  'layer_activated' => array(
    'openlayers_vector_example' => 0,
    'openlayers_geojson_picture_this' => 0,
  ),
  'layer_switcher' => array(
    'openlayers_vector_example' => 0,
    'openlayers_geojson_picture_this' => 0,
  ),
  'projection' => 'EPSG:3857',
  'displayProjection' => 'EPSG:4326',
  'styles' => array(
    'default' => 'default',
    'select' => 'default_select',
    'temporary' => 'default',
  ),
);

Pol’s picture

Local version also...strange.

I'm not home right now so i can't help you more... Sorry.

I'll be home in 3 hours, i'll look further.

Pol’s picture

Hello Brandonian,

I just tested on Simplytest.me and it works pretty good.

Can you test also ?

Brandonian’s picture

Status: Active » Fixed

I completely reset my local install, and I can't reproduce. If I had to guess, the problem was probably introduced with the code I added for #1957630: Transfer Geofield integration code into Openlayers submodule.

Kids, don't rage-quit and submit tickets. :-/ Marking as fixed.

Status: Fixed » Closed (fixed)

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