3

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 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.