If I choose one of the Google layers, no map is displayed, and I see the error: Error during map rendering: TypeError: this.projection.getUnits is not a function

I followed the tutorial, and with the 'OSM Mapnik:' layer it worked fine. But changing to any Google layer I get the error message above. (I've been using the GMAP module for several years, and so wanted the end result from OpenLayers to look as similar as possible to the current maps on our site)

Clearing site cache didn't help.

The error happens during the call to Drupal.openlayers.addLayers(map, openlayers); in openlayers.js

I started with the Alpha7 release and had this problem. I've just upgraded to the latest dev release and still have the same problem.

Hopefully I'm missing something simple.

Although the module still has its rough edges, it all fits together in a logical way. Good work, and I look forward to making the switch.

Regards, David

Comments

Subscribing

Just to make sure, have you put in a Google Maps API key?

Thanks for the quick reply.

Yes, I'd copied the API key over from my Gmap installation.

And just to be sure I tried what happens if I made a change to the key string. Then I get a pop-up saying the key is wrong.

Are other people using the Google layer ok with this version of the Openlayers module?

I have a key, gmap module works with it on same site. This error affects any base layer except OSM streetmap.

I havent actually tested this yet. But I feel like the hosted version of OpenLayers.js jas been screwy lately. Can you try downloading the latest version 2.9.1 and using a local version (assuming you are not).

http://openlayers.org/

Same error shows up here using Alpha7 release. After deactivating google layers everything works fine. Strange because till yesterday google layer with layer switcher was working like a charm.

Same issue here -- was working fine yesterday, now showing the error. Subscribing.

Switching to using a local version seems to work!

Strangely, the error was happening for me on one server but not another (remote, but not my local).

Category:bug» support

Yeah, I think the hosted version is weird at the moment. Though I havent tested it myself or heard anything about it yet. But I have seen other behaviors that suggest this as well.

So, for a fix, download and use a local version. This is suggested for better performance (and stability), anyway.

Can maybe one more person confirm this and then we can resolve this. Obviously someone should be going upstream with this.

I confirm that using local version (2.9.1) of Openlayers fixes this error and Google Layers work again.

Status:Active» Closed (fixed)

Switching to local version fixed it for me too. Thanks for the quick support.

Status:Closed (fixed)» Active

even with local library i got an error "Error during map rendering: Syntax error, unrecognized expression: #" in CCK node body display (node/%id/view). There is no this problem on node/%id/edit page, but i have only one preset at all.

Title:Google Layer causes "Error during map rendering:"Google Layer causes "Error during map rendering:" (use local OL library)

Hi @fasdalf@fasdalf.ru, is this actually related to the Google problem, or even the hosted library problem. This sounds like its something to do with Views and CCK. Maybe this should be another ticket.

The hosted version of OpenLayers.js has not changed at all since the 2.9.1 release.

crschmidt@olympia:~$ ls -l /www/openlayers/docs/api/OpenLayers.js
lrwxrwxrwx 1 crschmidt mcopenlayers 44 2010-05-06 09:14 /www/openlayers/docs/api/OpenLayers.js -> /www/openlayers/docs/api/2.9.1/OpenLayers.js

I do not know why the hosted version would behave differently from a local version. The md5sum for the hosted OpenLayers.js file is the same as the OpenLayers.js included in the 2.9.1 tarball/zipfile.

I'm assuming you're not comparing this to loading lib/OpenLayers.js (the non-singlefile version); that would be much different, since OpenLayers would load in a different order than by using the /api/OpenLayers.js file.

My best guess would be a change in Google's code; loading time could mean that the difference between loading locally (fast) and remotely (openlayers.org/'slow') is the actual difference here, and if you published a site, you'd have the same problems. Unfortunately, Google changes their code almost daily, so keeping up with testing all of those changes is well beyond the scope of what OpenLayers can do.

If you wish to debug/discuss further, taking a single HTML page which demonstrates the problem, then turning that into the minimal possible example that still demonstrates the problem, and bringing it to the OpenLayers mailing lists, would probably be the ideal way to discuss this situation.

As an FYI, I tried switching back to the hosted version of OpenLayers.js today, and it is working ok now.

I've found that the default URL for online API in 6.x-1.0-rc2 was not appropriate to correctly find assets, that is:

http://openlayers.org/dev/OpenLayers.js

Instead, using the proper url fixed it for me:

http://openlayers.org/api/OpenLayers.js

I see the same '/dev/' url is the default in the 6.x-2.x version, so this is what may be causing troubles.

@gwulo : do you confirm you used the '/api/' url when "switching back" to the hosted version ?

This is a bug with the variable defulat for the OL source in openlayers_include. Fixed:
http://drupal.org/cvs?commit=378154

We should make a new release as this is a big deal.

Status:Active» Fixed

Title:Google Layer causes "Error during map rendering:" (use local OL library)Google Layer causes "Error during map rendering:"

So, the quick fix here would be to just save your openlayers settings for the library and the variable will get set instead of using the badly formed default.

For the record, the issue we're talking about is discussed in http://drupal.org/node/823736

The first time (when I had the problem reported initially) I used the default value from a new install.

When I "switched bacK" I pasted the path in from the description on the settings page, which uses the correct 'api' path, so that matches the description in #16.

I noticed that Openlayers has problem with Panels. I brought the map out of the panel now everything works.

Title:Google Layer causes "Error during map rendering:"Default OL library included is Dev version

@farshad592, please open a issue for the Panels issue. Also, please provide some more detailed information otherwise we cannot actually help you. Some sort of error message would be helpful.

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

I would like to reopen this issue.

I have exactly the same error with goolge using open layers 2.10 locally or from the openlayers page.

If I use 2.9.1 locally the error is gone. Can anyone confirm that there is a problem with 2.10?

Regards
Marcus

Status:Active» Closed (fixed)

Yes; it is confirmed here and in the 2.10 compatibility ticket that this module is not yet compatible with OpenLayers 2.10.

Hi,

Maybe I should open a new issue for this, but I tried various configurations of Openlayers (2.9, 2.9.1) and of the Drupal module (alpha10, dev and CVS) and no matter what I try, on a view page of an Openlayers geocoder field (I'm using the Openlayers geocoder module), I get "Error during map rendering: Syntax error, unrecognized expression: #" in Firefox.

Note that:
* In Chrome, everything works fine
* In the edit tab, everything works fine for both Firefox and Chrome (not for IE though)
* In IE 8, nothing works (the map is simply not displayed)
* If I use OSM instead of Google Maps, the map is displayed properly

Thanks for any help on this...

Hi,

Ok so I ended up finding the solution to my problem. I was using one single preset for the CCK field, a preset called "Standard Google Map". In this preset, in order to be able to draw a point in the edition of the field, I had activated the Draw features. I deactivated the Draw features and everything now works perfectly, and I still have the drawing tools in the edition of the field.

i had same error "Error during map rendering: Syntax error, unrecognized expression: #" with latest dev version in IE6 and IE7 and indeed, removing draw features from behaviors shows my points from view