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.
Currently, this module defaults to using version 3.11.2 of the Openlayers Javascript library. The latest release is 4.3.3 (the "4" does not designate a major version change, just a switch to using semantic versioning - see https://github.com/openlayers/openlayers/releases/tag/v4.0.0).
I am testing the latest version on my local development site. I will outline any necessary changes I come across here.
Comment | File | Size | Author |
---|---|---|---|
#4 | openlayers_ol4_zoomtosource-2911611-4.patch | 6.41 KB | m.stenta |
Comments
Comment #2
m.stentaSo far, the only immediate issue I found that will require changes on our end is that
map.beforeRender()
andol.animation
were deprecated in 3.20, and removed in 4.0.0.We use
map.beforeRender()
andol.animation
in the following places:Comment #3
m.stentaHere is where they were deprecated: https://github.com/openlayers/openlayers/releases/tag/v3.20.0
And here is where they were removed: https://github.com/openlayers/openlayers/releases/tag/v4.0.0
Comment #4
m.stentaI've started an "ol4" branch in my Github repository: https://github.com/mstenta/openlayers/compare/7.x-3.x...mstenta:ol4
Two changes so far:
I modified the settings of the ZoomToSource component slightly: I merged the two separate "pan" and "zoom" duration settings into a single "duration" setting, and removed the "enableAnimations". This is because the new
view.animate()
method is the only way to perform the zoom-to-source, so animations are a must. If you don't want it to be animated, you can simply set the duration to 0. Also, there doesn't appear to be a way to have separate durations for "pan" and "zoom". So it's a bit more simplified now. I also updated the exported config in the openlayers_examples and openlayers_geofield modules.I think this ZoomToSource Component is complete, so it's ready for review. This is the only one I need currently - but I might take a look at the others now as well to see if they are easy.
Attached is a patch that simply updates the ZoomToSource Component - because I need that immediately in farmOS, which is built via Drush Make currently.
Setting this to "Needs Work" because there is more to be done.
Comment #5
Dirkozoid CreditAttribution: Dirkozoid commentedI can confirm that ZoomToLayer works again also with Openlayers JS library version 4.3.4 after applying this patch. This version of the library fixes this issue Map freezing with iOS 11 #7202.
Thank you very much for this patch!
But the problem with grey Google Maps after pinch zooming persist. It is caused by the fractional zoom levels as default introduced with library version 3.20.0. To get the old behavior set the new constrainResolution parameter to true like this:
new ol.interaction.PinchZoom({constrainResolution: true})
.The Problem is that I don't know where to put this in Drupal openlayers and I need to use Google Maps because their terms of service tell us that we have to use them if we use their geocoding service.
Comment #6
Dirkozoid CreditAttribution: Dirkozoid commentedOne more question:
Could it be that you missed a semicolon in "zoomtosource.js" on line 54?
animate_options.zoom = data.opt.zoom
Best
Dirk
Comment #7
m.stentaSee these release notes for other changes that will need to be made to be compatible with newer versions of the OL library:
https://github.com/openlayers/openlayers/releases/tag/v4.4.0
https://github.com/openlayers/openlayers/releases/tag/v4.5.0
https://github.com/openlayers/openlayers/releases/tag/v4.6.0
Comment #8
Joel MMCC CreditAttribution: Joel MMCC commentedAlso, OpenLayers 5 is a thing now, including 5.1 (up to 5.1.3 as I type this). It, too, seems to be relatively minor in terms of compatibility with previous versions, not the massive break-everything that OL3 was to OL2.
Big advantage in the newer versions and especially 5 is tha it’s now supposed to be much easier to load just the parts you need, rather than a massive monolithic library like in the OL2 and even OL3 days. This should solve the big advantage that Leaflet has over OpenLayers, especially since you have to add plugins to Leaflet to get even such basic functionality as full-screen zoom and marker clustering, let alone things like drawing polygons for data input into GeoFields. And, of course, with plugins, there’s always the spectre of version incompatibilities: what if some new mandatory security release of Leaflet breaks your older release of Leaflet-fullscreen?
Comment #9
monnerat CreditAttribution: monnerat commentedFor OpenLayers 5, see also https://www.drupal.org/project/openlayers/issues/2678204#comment-12669803
Comment #12
ken-g CreditAttribution: ken-g as a volunteer and commentedAt the time of writing this comment (April 2022) the latest version of the Openlayers library is v6.14.1.
I have trawled through the Openlayers change log from v3.11.2 through to v6.14.1 and identified the following changes or deprecations that could affect our Drupal module (there may be more):
I have now made the necessary changes to cater for all of the above, and committed these changes to 7.x-3.x-dev.
It should now be possible to use any version of the Openlayers library from 3.11.2 onwards all the way up to v6.14.1 against the 7.x-3.x-dev version.
Changing status to "Needs review".
Comment #13
ken-g CreditAttribution: ken-g as a volunteer and commentedComment #14
monnerat CreditAttribution: monnerat commentedCommits above fix the problem. Thanks.
Please note it may also obsolete issue 2678204
Comment #15
ken-g CreditAttribution: ken-g as a volunteer and commentedFixed in 7.x-3.2 release.