By Andrew T


2019-01-10 20:18:16 8 Comments

I'm looking at a project and trying to determine if from a features standpoint if I will lose anything by just pointing to the CSS and JS files for OpenLayers like https://openlayers.org/en/latest/doc/quickstart.html ?

If I want to add something down the road, like drawing tools or heat maps, or something else, will I be able to do so with just the CSS and JS files, or will I need to port it all over to the NPM ol package as described on https://openlayers.org/en/latest/doc/tutorials/bundle.html

I guess my specific problem is I see NPM is recommended, but I can not currently adequately explain to others involved why it is recommended for OpenLayers.

1 comments

@bennos 2019-01-11 08:29:05

If you use the files like in the quickstart guide you will not lose anything.

The ol.js and ol.css from the download page (like the linked versions from rawgit) contain the whole code you need for all features in this specific OpenLayers version. So you will be able to add features like drawing tools down the road without changing or adding anything.

The NPM version in combination with a bundler (like Parcel or Webpack) creates a specific version of OL containing only the required components you need for your current map. The benefit is a smaller file which can be loaded faster.

Related Questions

Sponsored Content

0 Answered Questions

OL5 functions in JavaScript not working with NodeJS

1 Answered Questions

[SOLVED] Understanding OpenLayers?

1 Answered Questions

[SOLVED] Geoserver's scale values corresponds to OL's zoom levels

1 Answered Questions

[SOLVED] OpenLayers install npm install --save-dev parcel-bundler error

1 Answered Questions

[SOLVED] How to add features where there are no other features in Openlayers 4.x

  • 2018-05-16 19:24:12
  • Ben Upham
  • 25 View
  • 0 Score
  • 1 Answer
  • Tags:   openlayers

0 Answered Questions

OpenLayers 4 WFS add new features in real time

  • 2018-03-23 14:04:03
  • zsoooc
  • 127 View
  • 1 Score
  • 0 Answer
  • Tags:   openlayers wfs

1 Answered Questions

[SOLVED] OpenLayers 4 styling draw features

  • 2018-01-16 10:04:04
  • Sebastiano
  • 733 View
  • 0 Score
  • 1 Answer
  • Tags:   openlayers

0 Answered Questions

OpenLayers 4 add/remove features/interactions

  • 2017-11-15 10:25:52
  • Sebastiano
  • 630 View
  • 1 Score
  • 0 Answer
  • Tags:   openlayers

2 Answered Questions

[SOLVED] OpenLayers-3 add geolocation marker

  • 2014-12-02 15:28:19
  • dave_does_not_understand
  • 18734 View
  • 3 Score
  • 2 Answer
  • Tags:   openlayers

0 Answered Questions

Openlayers: keep polyline horizontal when panning

  • 2017-02-24 09:07:26
  • Mat
  • 26 View
  • 1 Score
  • 0 Answer
  • Tags:   openlayers

Sponsored Content