Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the layer I want to center my map to contains only one item, the Zoom to Layer behavior centers/zooms the map to the Initial Map View set in the Center & Bounds map properties section.
It should instead center the map to the layer only item and extend the map according to the point zoom level set in the Zoom to Layer behavior.
Comment | File | Size | Author |
---|---|---|---|
#14 | 0001-Issue-1710634-Zoom-to-Layer-doesn-t-work-when-the-la.patch | 1.16 KB | thechumley |
Comments
Comment #1
PolHello,
We committed a fix that probably fix your problem, can you update your version to the latest dev and give me some feedback ?
Thanks
Comment #2
goron CreditAttribution: goron commentedI was experiencing this issue as well and updating to latest dev fixed it.
Comment #3
tryitonce CreditAttribution: tryitonce commentedI found the same problem and believe the issue is not fixed.
I have the following observations:
when I have only one or several locations in reach of a proximity search the map centres on its base location centre - i.e. 0,0.
I am using the set-up of http://drupal.org/project/ol_locator and am working on a more detailed tutorial here - Openlayer Proximity Search – Drupal 7 .
Hope this helps to find the solution - thanks ....
Comment #4
PolHello,
The last update on OL (-dev) isn't from 31 July. Are you sure that you are using the latest ?
I think the best is to use Git.
Comment #5
tryitonce CreditAttribution: tryitonce commentedAhh, something else to finally get round to doing - "to use Git" - sure, everyone talks about it.
In the meantime - any other link? Zip / tar.gz ...
Shall follow up on this - thanks
Comment #6
PolWhat you can do to be sure to get the latest source tree is:
This will create a directory 'openlayers' and a checkout on the 7.x-2.x branch (the dev).
I'm on irc irc://chat.freenode.net/drupal-geo if you need help, my nick is drupol.
Comment #7
tryitonce CreditAttribution: tryitonce commentedPol, thanks for the git link - I got it - but it seems not to work (for me yet, breing new to git).
Thanks for the help and offering more via irc - another thing I need to understand first - 2 in a day.
I got the download - but it has an incomplete info file.
With this the module is not showing up under .../admin/reports/updates. Let's see - but the function seem the be there - so it might have to be like this?
But - it is not working - the map centres to 0,0.
Time to have a look at irc ...
Comment #8
cesareaugusto CreditAttribution: cesareaugusto commentedIt seems to be fixed now!
Comment #9
tryitonce CreditAttribution: tryitonce commentedHi Cesare,
which version are you using.
What I got through git did not work. I am still using OpenLayers 7.x-2.0-beta1 which at least centres on a single location, but does not zoom in on it.
Thanks
....
Comment #10
goron CreditAttribution: goron commentedtryitonce - please try the latest version of OpenLayers (7.x-2.x-dev from Aug 3). You can download this very easily by clicking on the (red) link on the module page. The problem is fixed there.
Comment #11
tryitonce CreditAttribution: tryitonce commentedThanks goron, I am now using (7.x-2.x-dev from Aug 10) and it seems to be working now.
Though, there are still some inconsistencies and if I can pint point them I will come back to update.
Just a general hint for all is to double check the map settings - the right layers have to be activated - also under "Behaviors".
There is another question related to this about whether or not the starting point for the proximity search should be included on the map centring - but I will add this to another issue.
.................
Comment #12
JMC CreditAttribution: JMC commentedHi,
I've recently upgraded to the latest dev version (7.x-2.0-beta1+66-dev) and I can see that this has been fixed for most layers but I think it still doesn't zoom to "point level" when there's only one point on the layer AND when the layer is KML or GEOJSON. This is probably due to them being loaded by the browser, and I'm guessing the new additional code runs before the page has completely finished loading these types of layers?
I'm still new to OpenLayers/JS so apologies if I've got the wrong end of the stick completely, but I fixed my problem by adding the following code in the openlayers_behavior_zoomtolayer.js file:
I'd be happy to try and create this as a patch but I thought I'd post this first in case I've misunderstood or someone more experienced might want to suggest a cleaner way to do the above.
Comment #13
PolI'll take care of this tomorrow at the Openlayers Sprint in Munich ;-)
Comment #14
thechumley CreditAttribution: thechumley commentedHi all,
Be gentle, this is my first patch - thanks to Pol for helping me out with this at the sprint at DrupalCon 2012 in Munich.
Comment #15
PolCommitted, thanks @thechumley for your first patch :)
Link: http://drupalcode.org/project/openlayers.git/commit/f169e4a
Comment #17
drupalok CreditAttribution: drupalok commentedi think this issue is back
to recreate:
add openlayers widget to entity
add ONE POINT as feature
save
view node
it does work with multiple points, lines and polygons though...