An openlayers map built using views (points displayed on a Google baselayer) is outputting this js error and not displaying the map:

TypeError: Object 900913 has no method 'getUnits'
[....]/sites/all/modules/contrib/openlayers/js/openlayers.js
(Chrome 6.0.472.53 on Mac)

There's a similar error output by Firefox, though it points to the hosted OpenLayers.js file instead:
"this.projection.getUnits is not a function"
"TypError"
"http://openlayers.org/api/OpenLayers.js"

I'm assuming that this relates to OpenLayers.org releasing a new version of openlayers.js (2.10) sometime in the last 24 hrs. @Ziggy1 reported the same error in IRC, which was fixed by downloading the previous version of openlayers.js and pointing to it locally instead of pointing to the hosted version on openlayers.com.

Marking as critical because anyone downloading the module and using it in the default configuration (i.e. pointing to the hosted version of openlayers.js) would not be able to have a map displayed. Feel free to change the status if you don't think it's critical though.

Comments

tom_o_t’s picture

Status: Active » Fixed

@strk has just fixed this in dev - http://drupal.org/cvs?commit=418666

If you don't want to update to dev, you can fix this by going to /admin/build/openlayers and setting the OpenLayers source to be http://openlayers.org/api/2.9/OpenLayers.js

A better fix is to download this file and add it to your Drupal installation, and use a relative path for the source (like sites/all/modules/contrib/openlayers/OpenLayers-2.9/OpenLayers.js)

levelos’s picture

Status: Fixed » Needs work

This doesn't unfortunately fix existing installs. Probably need a hook_update_N() hook to update the variable if it's still set to http://openlayers.org/api/OpenLayers.js.

zzolo’s picture

Status: Needs work » Fixed

Thanks @loubabe. Created update function:
http://drupal.org/cvs?commit=419920

Status: Fixed » Closed (fixed)

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

ahtih’s picture

Status: Closed (fixed) » Active

The commits above are not a complete workaround, since OL 2.9 also requires "Image Path" to be set to "http://openlayers.org/api/2.9/img/" for every preset (at least because FramedCloud image coordinates have changed in OL 2.10, producing garbage in popup decorations if image path version does not match JavaScript version).

Possibly "CSS Path" needs to similarly match the JavaScript version.

zzolo’s picture

Hi @ahtih. This is a vlid-ish point. But from what I understand, the JS library will use the Img and CS paths correctly if none are set. So, this would only be be a problem for people that have set their paths explicitly to the http://openlayers.org/api/2.10/img/ path. Am I understanding this right?

ahtih’s picture

Yes, it is a problem for those people, but more importantly it is a problem also for people who have the path set to http://openlayers.org/api/img/ , i.e. the latest version. For example, the people using WFS module - because WFS requires a patch to OpenLayers JS file, you have to host it yourself, which in turn means you have to set Image and CSS paths manually to http://openlayers.org/api/img/

But in any case, in the long term we should obviously change DOL so that it works with latest OL anyway, so perhaps it is not spend much time in perfecting this workaround.

zzolo’s picture

@ahtih, true. This still needs to be addressed. Anyone know the actual cause of the problem?

tmcw’s picture

Title: Javascript error from latest release of OpenLayers Javasript (2.10) » Specify Image Path and Theme Path paths more intuitively
Component: Code » OpenLayers UI
Category: bug » feature
Priority: Critical » Normal

Retagging... this is no longer a bug report.

zzolo’s picture

Status: Active » Closed (won't fix)

I am not entirely sure what is mean by the title change in the last comment. But, overall, I don't think this is a major issue and am closing for now. Please re-open if needed.

  • strk committed 4b55554 on 7.x-3.1.x
    #906938: Bind to version 2.9 of OL api. Avoid breaking every now and...
  • zzolo committed 9aa052b on 7.x-3.1.x
    #906938 by zzolo: Update function to set to 2.9 hosted version.