I am not sure if this is the way it's designed or it's a bug. When I use Openlayers widget with optional geocoding, I click the "Find using ... field" and the map widget disappears. There is still an empty div taking up the space where the map was.

I expected the map widget to remain and get updated so that the marker is pointing to the geocoder result.

When I save the node then edit it again, the Openlayers widget has the marker correctly and I can manipulate it.

Comments

Robin_K’s picture

I have the same issue, it seems to be a bug with the OpenLayers configuration for the css files.

When I check the requests to the server when I click the "Find using..." button I see a 404 request for some OpenLayers css, it seems like the link to the css files is wrong.

In my case, the request URL is .../sites/all/modules/openlayers/themes/default_dark/style.css,sites/all/modules/openlayers/themes/default_dark/style.css

For some reason the file path for the css is appended twice.

Robin_K’s picture

I did some further debugging to see what is going wrong in the OpenLayers javascript, the css request isn't the source of the problem.

It seems like whenever the "Find using..." button is clicked a new openlayers object is created, but instead of creating a new object, GeoField takes the old object and appends the new values, resulting in an OpenLayers object containing arrays with 2 values where 1 single value should be.
I'm assuming this causes OpenLayers to fail.

Exploratus’s picture

I have the same problem. Just enbled the widget, and when I click Find using button the map disapears.

iztok’s picture

Experienced same bug.

Module versions:
Geofield 7.x-2.x-dev - 2013-Apr-07
openlayers 7.x-2.0-beta5

Enric Climent’s picture

Same bug here with profile2 and with normal content type.
Any suggestions?
Thanks

geigerg’s picture

Priority: Normal » Major
Dave Cohen’s picture

Same problem here.

Lemontonix’s picture

Same problem here

bbujisic’s picture

Project: Geofield » Openlayers
Version: 7.x-2.x-dev » 7.x-2.0-beta7
StatusFileSize
new44.64 KB

This seems to be an openlayers problem.

I still did not find a solution, as I do not totally understand Openlayers, but seems I found a problem, or at least got relatively close to problem.

  • Map object in openlayers.js file gets corrupt after geocoding.
  • For example, normal map.center.initial.centerpoint has a string value "0, 0". After you hit the "Find using address field" button, the value will become array of two elements: ["0, 0", "0, 0"].
  • Similar error happens in map.mapExtent, which is supposed to be array of four items. Geocoding adds extra four items to it.
  • Even map name becomes an array of two values after geocoding.

These changes in map object break OpenLayers.Bounds.fromString and OpenLayers.LatLon.fromString, probably other functions too. So they definitely ARE culprit.

I attached a console screenshot which illustrates my findings.

Any help from somebody who knows the process behind these map object amendments?

plopesc’s picture

Project: Openlayers » Geofield
Version: 7.x-2.0-beta7 » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new4.36 KB

Hello

I've been debugging this error and finally I found that the problem was in Geofield and the way that AJAX managed the form when clicking geocoding button.

Attaching patch that fixes the problem for me.

Working with:

  • Geofield 7.x-2.x-dev
  • GeoPHP 7.x-1.7
  • OpenLayers 7.x-2.0-beta7

Regards

shadysamir’s picture

#10 Works for me too. Many thanks @plopesc

bbujisic’s picture

Status: Needs review » Reviewed & tested by the community

+1 for #10! Thanks Pablo!

Brandonian’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch, @plopesc! Patch in #10 committed to 7.x-2.x.

http://drupalcode.org/project/geofield.git/commit/edd75ee

Status: Fixed » Closed (fixed)

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