Last updated October 11, 2013. Created on March 15, 2013.
Edited by azuledu, Pol, augustus.kling. Log in to edit this page.

Affected modules

Projection support was introduced between 7.x-2.0-beta3 and 7.x-2.0-beta4 of the OpenLayers module. In order to work towards cleaner code it was chosen to require providers of extensions to the OpenLayers module to adapt their layer and map definitions.

Rationale

There are various authorities/organizations who define projections. Thus there was the need to provide the authorities names in order to prevent ambiguities.

Required changes

Third party layers and maps need to be updated so that they use authority codes whenever they mention a projection.

Old code lacking authority code

<?php
// Fragment of a layer
$layer->data = array(
 

 
'projection' => array(4326),
 

);

// Fragment of a map
$openlayers_maps->data = array(
 

 
'projection' => 3857,
 
'displayProjection' => 4326,
 

);
?>

New code with authority codes

<?php
// Fragment of a layer
$layer->data = array(
 

 
'projection' => array('EPSG:4326'),
 

);

// Fragment of a map
$openlayers_maps->data = array(
 

 
'projection' => 'EPSG:3857',
 
'displayProjection' => 'EPSG:4326',
 

);
?>

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

Sheldon Rampton’s picture

Is there some reason why a page that is supposed to document a requirement related to "projection support" cannot have a link or some kind of information explaining what a "projection" is?

----------------
Chief Technology Officer, NuCivic
http://nucivic.com

Pol’s picture

Hi Sheldon,

A map projection is the way information on a spherical globe (three dimensions) is displayed on a two dimensions surface.

You have many kind of different projections, depending on the map you want to display it's better to use a projection or another.

Why ? Easy, for some countries, it's better to use conical projection instead of cylindrial.
Example, for the North America area, it's better to use a conical projection, you'll get less deformation than in the cylindral projection.

I think you'll find more details on the wikipedia page.

I don't work in GIS and I think that Augustus will probably explain that in a better way as he's working in GIS every day.

I hope this helps.

Bye.

-Pol-
Find me on Google+ or Twitter

Ariunbold0722’s picture

If your Geofield is 7.x 1.1 then update that module to 7.x-2.x dev

ariunbold

das-peter’s picture

________________________________________
Cando Image GmbH
Else Züblinstrasse 115 :: CH-8404 Winterthur :: Switzerland

josedanielestrada’s picture

I'm having this error:

Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 977 of /Applications/XAMPP/xamppfiles/htdocs/drupal/sites/all/modules/openlayers/openlayers.module)

Not sure where I should add the patch.

kingfisher64’s picture

I'm getting the same error as in the post above when clicking on the /locator link in the OpenLayers Locator proximity search view.

Not sure what to do next as this has been reported already in the http://drupal.org/node/1960538 which leads to http://drupal.org/node/1943968. This patch however this does not apply cleanly against the latest version of openlayers (beta 5).

Is the patch listed 2 posts ago not relevant this this exact issue? I did try patch that against geofield 1.1 stable and it returned a hunk offset warning.

Brick wall hitting at present can anyone shed some light on how to get rid of this error message? Thanks

Error message
Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 996 of /home/sitename/public_html/sites/all/modules/openlayers/openlayers.module).
djhspence’s picture

The nodes that I need to map have addresses picked up by the Location module. I plot them on a map using Views and custom OpenLayers maps, based on the latitude and longitude fields generated by Location.

After the recent update borked all my maps, I finally figured out a manual workaround. First, I chose one of the included sample maps that was closest to the custom map I was updating. In my case, it was example_google. I clicked "Export" on this map and did a text search for "EPSG" and found

  'projection' => 'EPSG:3857',
  'displayProjection' => 'EPSG:4326',

Then I clicked "Export" on my custom map and looked for the same section in the export code. I replaced the values for 'projection' and 'displayProjection' with the values from the example map, then copied all the modified custom map export code and imported it back into the site via /admin/structure/openlayers/maps/import (checking the box for "Allow import to overwrite an existing record"). I clicked "Save" on the next screen, and my maps started working again.

Had to repeat this for each of my custom maps ... tedious, but better than the white screen error my users were getting when they tried loading any page with a map on it.

mattbk’s picture

Thanks! This has helped. Although I just get blank spaces where the maps should be, at least they don't break the page with an error.

1. Go to list of OpenLayers maps
2. Click 'Export' on map you want to fix.
3. Add in the 'EPSG:' to your projection info.
4. Copy the modified map export.
5. Go back to the OL maps list.
7. Click 'Import.'
8. Paste in your modified map export and select the overwrite box (this will replace the map you just exported from).

josedanielestrada’s picture

I did an installation from scratch, created a new content type, added a geofield field and an openlayers map and I still having the same error

Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 996 of /Applications/XAMPP/xamppfiles/htdocs/propiedades/sites/all/modules/openlayers/openlayers.module)

How should I fix this?

Pol’s picture

I suggest you to use Geofield 2.x (development version).

Also, read this: #1942826: Projection incompatibility with openlayers.

-Pol-
Find me on Google+ or Twitter

ASMBL’s picture

7.x-2.0-alpha2+9-dev from June 15, 2013 - 09:19 worked for us.

smartfun’s picture

When I try to edit any map in Open Layers, the following error apperars:
Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. a openlayers_get_projection_by_identifier() (línia 996 de /home/fidelproves/www/bibues/sites/all/modules/openlayers/openlayers.module).

¿What can I do?

menhio’s picture

I have the same problem when adding a new map,
any help would be awesome.
thanks!

Meño

paulfrottawa’s picture

An upgrade to 7.x-3.x-dev solved it for me.

menhio’s picture

i just installed the version you said, but now it won't even let me enable the module.
any ideas?

Meño

Pol’s picture

7.x-3.x is not ready for production yet and almost no module is ready for it !

-Pol-
Find me on Google+ or Twitter

smartfun’s picture

The required changes shown in the preceding paragraph must be done in "geofield.openlayes.inc", found in the "geofield" module in "sites / all / modules / geofield".

menhio’s picture

That did it!

Meño

eleuthere’s picture

Hello,

I'm trying to build events with geographic position using openlayers and leaflet for display.
I could create one using openlayers-7.x-2.0-beta3.tar.gz but openlayers-7.x-2.0-beta5.tar.gz produces an error despite tried to do what is proposed :

------------------
Key layer_type, file is missing in in the plugin definition of the layer type openlayers_layer_type_MY_MODULE. The layer will be disabled.
Message d'erreur
Exception : Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. dans openlayers_get_projection_by_identifier() (ligne 996 dans /home/patrick2/landshoping/sites/all/modules/openlayers/openlayers.module).
------------------

I have Drupal 7.21, openlayers-7.x-2.0-beta5.tar.gz and geofield-7.x-1.1.tar.gz

This is the diff between the before and after the change in geofield.openlayers.inc :

80,81c80,81
< 'projection' => '900913',
< 'displayProjection' => '4326',
---
> 'projection' => 'EPSG:900913',
> 'displayProjection' => 'EPSG:4326',
149,150c149,150
< 'projection' => '900913',
< 'displayProjection' => '4326',
---
> 'projection' => 'EPSG:900913',
> 'displayProjection' => 'EPSG:4326',
196c196
< 'projection' => array('900913'),
---
> 'projection' => array('EPSG:900913'),

If I was allowed any comment, I would express my astonishment about the amount of hardcoding in that file and about the way to use projections defined in the openlayers configuration tabs.

Telle me if I can help.

Long time Linux user, new to Drupal, trying to get help and help in return.

mastermindg’s picture

Installing the DEV version fixes the projection issues.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

eleuthere’s picture

Hi,
I'm not ready to use a dev version but I can help by testing.
Where can I find specs for the next 7.x version ?

Long time Linux user, new to Drupal, trying to get help and help in return.

miaumiaume’s picture

Installing 7.x-2.0-beta5+40-dev doesn't work for me. I get the same error "Exception: Projection 900913 lacks an authority code..."

Noe_’s picture

This worked for me.

Thanks

--
Noë Snaterse
WiredPea