Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active February 19, 2017 13:30
Show Gist options
  • Save ThomasG77/3512a676222f0de63ce1aff143c903d4 to your computer and use it in GitHub Desktop.
Save ThomasG77/3512a676222f0de63ce1aff143c903d4 to your computer and use it in GitHub Desktop.
Correction for cluster example in my "Beginner's Guide OpenLayers 3" due to change in OpenLayers library itself

Due to request on Twitter https://twitter.com/Stephanux40/status/833289922777903104

There were two issues:

  • change due to ol.source.GeoJSON removal in 3.5.0 https://github.com/openlayers/openlayers/releases/tag/v3.5.0 See section "New Vector API" for the exact documentation for upgrading.
  • because the data from cluster.geojson is using projection 3857 instead of the default EPSG 4326, we needed to add in the new ol.format.GeoJSON the following:
  ..
  format: new ol.format.GeoJSON({
    defaultDataProjection: 'EPSG:3857'
  })
  ..
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment