Context

We are using addressfield, geofield and geocode to store locations. Addresses are sometimes incomplete (e.g. street names only, without house numbers), so geocode cannot pinpoint. Our fallback is OpenLayers widget. Idea is to move marker from approximate to precise location on map.

Problem

Map cannot zoom and center on marker. So even when user hits node save and reloads node editing form, map keeps initial center and zoom.

Screenshot of setting:
Zoom to layer

Screenshot of resulting map:
Map not centered

Same settings work fine in node view. Problem seems to be only with widget.

Enabled modules

  • OpenLayers-7.x-2.0-beta7+8-dev
  • Geofield-7.x-2.0-alpha2+9-dev
  • Addressfield-7.x-1.0-beta4
  • Geocoder-7.x-1.2
CommentFileSizeAuthor
2013-06-25_1123.png431.32 KBbbujisic
2013-06-25_1120.png10.73 KBbbujisic
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

le dendrite’s picture

Bump Bump

I concur; this is not working for me either.
I seem to be having a related issue, but with some caveats.
Likely the same issue manifested another way...

Goal.
Essentially what I'd like to accomplish is to use the Display map of a parent/ related node as the select Widget for the child/ related node, of a different content type.
*In my use case I cannot use the actual display map but rather I need to get its location via Views.

Build.
Using Geofield, Openlayers, Views, References: Node Reference URL widget. Also trying views utilizing a Geocoder field, again with no success.
I have created a Display map as well as a Widget map for each content type and I do think I have configured them correctly.
This has left me trying endless variations in my Openlayers Data Overlay View (select widget)

Prior to reading this post I was thinking I was just not getting the View correct (also still possible), or suspecting a possible inability to pull the location via the Node Reference URL Widget, Which lead me to trying to use a Geocoder field, no luck.

Can anyone offer any further insight into this?
Has anyone accomplished this?

Just as Branislav Bujisic stated, the node displays work fine, but I cant seem to accomplish the same with a widget.

I have a live sandbox setup I can toss an account to someone if they wanna look. hit me up.

Related Post: https://drupal.org/node/1987204

Installs.
Drupal core 7.24
Chaos tool suite (ctools) 7.x-1.3
Geofield 7.x-2.1
Geocoder 7.x-1.2
geoPHP 7.x-1.7
Proj4JS 7.x-1.2
References 7.x-2.1
Node Reference URL Widget 7.x-1.12
OpenLayers 7.x-2.0-beta7
Views 7.x-3.7

---------
Update
Oddly I've found this is working on some content types and not others. I cannot find any wrong settings so I will try recreating the problem content types and see where that gets me.
So this leads me to think my issue may not be the same as the author of this original post.

Exploratus’s picture

Issue summary: View changes

I have the same problem

umakart’s picture

Here the same:
geofield_widget_map cannot zoom and center on marker.
(zoom to Layer)
geofield_formatter_map does.
Is there no solution for this problem?

Max1’s picture

Max1’s picture

Max1’s picture

Max1’s picture

Max1’s picture

Version: 7.x-2.0-beta7 » 7.x-2.0-beta11
Component: OL CCK » OL Behaviors
Priority: Normal » Major

This bug has 2-year history, many followers and reentered tickets (I found at least four, added here), as well as references on other sites. The bug reproduces on last stable version Openlayers2 and on last dev version too. And it looks annoying to users.

Can I set the priority to Major?

Max1’s picture

Max1’s picture

Max1’s picture

Max1’s picture

t_stallmann’s picture

Not sure how many people are still seeing this issue, but I ran into it as well locally and wanted to report back from some digging.. it seems like the geofield placeholder actually adds a 2nd vector layer with the data in it when the map renders, but the javascript for the Zoom to Layer plugin filters this layer out because it has a `drupal_id` which does not match any of the layers which have been selected in the UI. On the site I'm working on a simple fix was to add a new custom "Zoom to All Layers" behavior which duplicates the "Zoom to Layer" behavior but replaces the
var layers = ... line with

var layers = map.getLayersBy('isBaseLayer', false);