I realized a project with OpenLayers 3 some time ago, but now I do not understand anything anymore.

I should install any packages?

npm install ol. But even that does not work.

I now have the package "v5.1.3.zip Includes all the above plus examples, API docs, and sources." downloaded to the server. Within this package all examples work, but if I copy the codes displayed in the examples into another file, nothing works.

As well as?

It is everywhere this "import" specified, but it is missing in the HTML header, the reference to the OL Script.

What's going on there?

I currently want to put several markers via Lat Lon, nothing more. But I fail already at the beginning.

The "Quickstart" "Put a map on a page" works. https://openlayers.org/en/latest/doc/quickstart.html

Then i go to the "Tutorial" page. https://openlayers.org/en/latest/doc/tutorials/ and found "import", "import", "import", ... I found a answer about "import" by mozilla...

Then i go to the "get the code" page and download the code. https://openlayers.org/download/ More infos about this on the top.

I "install" the ol via npm.

I go to the "example" page. [Link: max 3 ...] On the example pages are code blocks. I copy a code block and insert it into a new file. nothing works. ... I have no idea what now.

What do you want to hear?

I have no idea what I have to do.

Where is a tutorial and examples that work?

for latest. It is also very difficult to find something, because there are now many different versions of OL (1-2,3-4,5) and rarely the tutorials and examples are marked with the version on the internet.


You can find very easy ways to start in the official OpenLayers website:


I never use npm for openlayers, just the css and js references.

| improve this answer | |

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