-1

I used openlayers 4.4 to create a web mapping interface. Is there a special method to update the code and functions to be compatible with versions 6 ?

ericire
  • 409
  • 6
  • 22

1 Answers1

1

If you continue to use the ol.js build as in https://openlayers.org/en/latest/doc/quickstart.html many maps will continue to work, or only need minor changes which are documented in the Upgrade notes. The most common problems are likely to be:

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#new-internal-tile-coordinates

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#new-prerender-and-postrender-layer-events-replace-old-precompose-render-and-postcompose-events

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#layers-can-only-be-added-to-a-single-map (this often affects maps with an OverviewMap control)

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#removal-of-olfeaturestylefunction

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#replacement-of-olsphere-constructor-with-olsphere-functions

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#changes-in-proj4-integration

https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#renaming-of-the-defaultdataprojection-in-the-options-and-property-of-the-olformatfeature-class-and-its-subclasses

Also maps will no longer open with a default size, so you need to use css or otherwise set the size of the map div.

Mike
  • 16,042
  • 2
  • 14
  • 30
  • ok thanks I just saw a first error on my part, it's my way of accessing the properties of objects. I just noticed that Object.o.property does not work with the different versions minified or not. So I changed that to object.getProperties()['property'] over dozens of lines. I continue my adaptation – ericire Jan 18 '22 at 16:18