Hi Rik!

I've just upgraded to latest DEV version of both ip_geoloc and openlayers.

Results: all my maps have disappeared and the following warning is shown:

There's a problem in the plugin definition of the layer type openlayers_layer_type_ip_geoloc. The layer will be disabled.

(see attachment)

What can be the issue?

Comments

rdeboer’s picture

Hi Max,

As far as I know nothing has changed on the IP Geolocation V&M side of things in terms of the interface with OpenLayers.
So the OpenLayers guys must have changed something in their datastructures that make it incompatible with the way they did things previously.
If that is indeed the case, expect other OpenLayers site builders to have the same problem... and perhaps a solution. Suggest you check the OpenLayers issue queue.

Rik

mxt’s picture

Project: IP Geolocation Views & Maps » Openlayers
Version: 7.x-1.x-dev » 7.x-2.x-dev

Thank you Rik, I'll move this to openlayers issue queue in the hope that they tell us what has changed in particular that can breaks things.

Thank you

pol’s picture

Hello,

As explained in #1331410: Better Handling of Projections, there are changes in the way Projections are handled.

Example, in the file ip_geoloc.openlayers.inc:
Line 77: Change baselayer into isBaseLayer.
Line 79: Change '900913' into 'EPSG:900913'.
Line 91: Change 4326 into EPSG:4326.

Do that for every layers defined there and it should be good.

mxt’s picture

Thank you for your answer Pol: I did the changes as you've suggested, but nothing is changed: maps are still not visible and the warning message is still shown...

There is something other we have to consider?

Thank you for your support.

rdeboer’s picture

Title: There's a problem in the plugin definition of the layer type openlayers_layer_type_ip_geoloc. The layer will be disabled. » Error:"There's a problem in the plugin definition of the layer type openlayers_layer_type_ip_geoloc.The layer will be disabled."

Thanks Pol for the pointers.
I'll have a closer look at the "IP Geolocation V&M" end as well, but don't have much time for a few days.

I did spot this as potentially suspicious, if the API has changed:
Line 99: $marker_layer->api_version = 1;
may have to be:
$marker_layer->api_version = 2; ?

Related: I guess this means we need two copies of the interface to OpenLayers now?

pol’s picture

Here's a patch fixing the warnings, I didn't not tested it though...

rdeboer’s picture

Thanks Pol! Hope to test-drive these changes soon.
Rik

mxt’s picture

I've applied patch in #6 with the following results:

  1. Warning message "There's a problem in the plugin definition of the layer type openlayers_layer_type_ip_geoloc. The layer will be disabled." has disappeared
  2. No maps are shown yet
  3. When trying to edit a map in /admin/structure/openlayers/maps/list/default/edit I get an ERROR page like this:

    Notice: Undefined offset: 0 in openlayers_render_map_data() (line 253 of /var/www/mysite/sites/all/modules/contrib/openlayers/openlayers.module).
    Exception: Projection lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 977 of /var/www/mysite/sites/all/modules/contrib/openlayers/openlayers.module).
    The website encountered an unexpected error. Please try again later.

This using latest openlayers DEV.

Please help me to resolve

Thank you very much

augustus.kling’s picture

I don't have any clue about the named layer type, so the following is a pure guess:
In line 253 of openlayers.module a projection of the layer is read to be sent to the client. However it appears there is no projection defined for your layer. Please open the edit screen of your layer and make sure a projection is selected in the projection list there. From looking at Pol's patch I assume either EPSG:900913 or EPSG:3857 should be selected.

mxt’s picture

Thank you Augustus,

I went to /admin/structure/openlayers/layers

and edit ALL ip_geoloc_marker and geofield layers: EPSG:900913 was already selected, but I RE-SAVED all layers to be sure and error 3 above has disappeared.

Unfortunately no maps are shown yet in my views pages using "Map (OpenLayers, via IP Geolocation)" as format.

jpablus’s picture

Hi
Additionally to changes suggested on comment 3, I did
Line 107: Change '900913' into 'EPSG:900913'.
And it works

mxt’s picture

Applying patch in #6 and after updating to last openlayers 7.x-2.0-beta5 my maps have reappeared, but:

  1. Only one marker appear even if my view retrieve more than one result
  2. Marker position is wrong: it always appear centred on map, regardless of its right coordinates.

What can be the problem?

pol’s picture

It's a projection problem, is this site online so I can have a look ?

mxt’s picture

Hi Pol, the website is not online but I can show you it on staging environment.

I wrote to you the details using your contact form here on drupal.org.

Thank you very much for help.

pol’s picture

Hello,

This is clearly a projection problem.
I don't use ip_geoloc, but by looking at the source, I think I see something wrong... but I'm not sure.

"title": "Location markers #1",
                        "features": [{
                                "attributes": {
                                    "description": "\u003Ca href=\u0022\u002Fen\u002Fprofessionals\u002Fwild-hog\u0022\u003EWild Hog\u003C\u002Fa\u003E\u003Cbr\u002F\u003E\u003Ca href=\u0022\u002Fen\u002Fprofessionals\u002Fmanufacturers-aftermarket-accessories\u0022 typeof=\u0022skos:Concept\u0022 property=\u0022rdfs:label skos:prefLabel\u0022 datatype=\u0022\u0022\u003EManufacturers of aftermarket accessories\u003C\u002Fa\u003E\u003Cbr\u002F\u003EVia Aleardi 2, Reggio Emilia, RE, 42100, Italy\u003Cbr\u002F\u003E\u003Ca href=\u0022\u002Fen\u002Fprofessionals\u002Fwild-hog\u0022\u003EMore info\u003C\u002Fa\u003E"
                                },
                                "projection": "4326",
                                "wkt": "POINT(10.6020381 44.6951636)"
                            }, {
                        

The projection should be: EPSG:4326 instead of 4326.

Check this issue and the links inside: #1959018: Error message on OpenLayers with latest dev version (1.19+18-dev), it should gives you a way to fix it.

mxt’s picture

Project: Openlayers » IP Geolocation Views & Maps
Version: 7.x-2.x-dev » 7.x-1.x-dev
Priority: Normal » Major

Thank you Pol!

Following your suggestion I was able to find where the projection is not set correctly.

So, in ip_geoloc module > views folder > ip_geoloc_plugin_style_openlayers.inc file > line 122

from:

$feature = array(
          // Only 'name' and 'description' are valid attribute names, see openlayers_behavior_popup.js
          'attributes' => array('description' => $location->balloon_text),
          'projection' => '4326',
          'wkt' => 'POINT(' . $location->longitude . ' ' . $location->latitude . ')'
        );

sould be:

$feature = array(
          // Only 'name' and 'description' are valid attribute names, see openlayers_behavior_popup.js
          'attributes' => array('description' => $location->balloon_text),
          'projection' => 'EPSG:4326',
          'wkt' => 'POINT(' . $location->longitude . ' ' . $location->latitude . ')'
        );

This resolve correctly markers position.

I'll switch to ip_geoloc issue in the hope that RdeBoer will commit your patch and correction above in this post

Thank you!

pol’s picture

You're welcome!

rdeboer’s picture

Thanks Pol and MXT. I have applied your combined patches to IP Geolocation Views and Maps 7.x-1.x-dev.

In my simple test map the markers show up correctly (as simple black circles) without errors.

However we're not done yet. When I go to this page: admin/structure/openlayers/maps and click "Edit" or "Clone" on any of the maps I get the same as what is mentioned here: http://drupal.org/node/1944074#comment-7324132.

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

Therefore I can't do anything like assigning colours or info balloon, as described in the IP Geolocation Views & Maps README:

Initially the location markers are likely to show up as black circles. To
change the marker shapes and colours you need to first associate the "Location
markers" layer with your map at Structure >> OpenLayers >> Maps >> List. If
there is no custom map on this page yet, you have to first clone and save under
a different name one of the existing maps. Once you've done that, you'll find
that on Structure >> OpenLayers >> Maps >> List the map appears with an Edit
link. Click that, followed by the "Layers & Styles" vertical tab. In the bottom
section of the page you'll find the "Current visitor marker" layer and a number
of "Location markers" layers. You'll only need to activate Location markers #1,
unless you have defined a "differentiator" (e.g. taxonomy term) on your view.
Pick marker styles from the drop-downs as you please and press Save. Note that
the location markers won't show up in the map preview, but the visitor marker
should. This is because the map doesn't know which view it will be paired with.
In fact there may be several views using the same map. Return to edit your view.
Under Format, Settings select the map you've just created and edited. Save the
format and the view. Visit the page containing your view and all markers should
appear in the colours you chose.
In order to make the text balloons pop up at a marker when hovered or clicked,
visit Structure >> OpenLayers >> Maps >> Edit and click the "Behaviors"
vertical tab. Scroll down the page until you reach the "Pop Up for Features"
check box. Tick it and select the layers you're interested with, e.g.
ip_geoloc_visitor_marker_layer1 and/or ip_geoloc_marker_layer. Same for
"Tooltip for Features". Other nice behaviors that you may wish to flick on on
the same page are "Full Screen", "Layer Switcher", "Pan and Zoom Bar Controls"
and "Scale Line".

pol’s picture

Status: Active » Fixed

I'll test and report ASAP, thanks !

pol’s picture

I'm not able to reproduce the bug Rick.

Can you test with simplytest.me ?

rdeboer’s picture

I'll give it a go... quite a few modules involved though...

rdeboer’s picture

Hmmm... works here: http://s540fd173c35cc02.s3.simplytest.me (try admin/admin) and visit /map.

So what's going on?

rdeboer’s picture

Hi Pol,

The test site from #22 was working with a clean install of IP Geolocation Views and Maps (7.x-1.x branch), CTools, Views, Proj4s, Libraries and Openlayers, but has been auto-deleted. This suggests that Openlayers 7.x-2.0-beta5 is good on a pristine vanilla install.

However, I also checked on my local system, which has the identical set of modules. Despite running update.php and clearing all caches a couple of times I find that function openlayers_get_projection_by_identifier($identifier) gets called sometimes with and sometime without the preceding 'EPSG:' authority code.

We talked about this before. The patch that works on my system is to simply prefix the received $identifier with the authority code if it isn't already there.

openlayers.module (7.x-2.0-beta5) , line 989:

function openlayers_get_projection_by_identifier($identifier) {
  ctools_include('export');

  /** RdeBoer: inserting these next 3 lines solves my problem. **/
  if (strpos($identifier, ':') === FALSE) {
    $identifier = 'EPSG:' . $identifier;
  }
  ....

Adding these 3 lines would save a lot of people a lot of upgrade issues, don't you think?

Rik

pol’s picture

Hello Rick,

We already discussed this and I'm aware that it would help people, and I'm sorry but we won't allow it. We prefer not doing that to force module developers to upgrade their module and provide a good code.

We are about to release a new beta tonight, I'm happy that this is finally sorted out.

Have a good day.

rdeboer’s picture

Hi Pol,
Ok, if you say so.
Good night here ;-)
Rik

Status: Fixed » Closed (fixed)

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