This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Simple example on the wiki for a slippy map does not work

0

Hello !

I would like to start with a simple map example and I am here: https://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example

There is somethings basically wrong: The OSM library mentioned, "OpenLayers.js" does not exists. If you go to their webseite, you'll lost in space, because there are hundreds of scripts, but not that mentioned one.

Any help would be great !

Thanks anyway and best regards,

Manfred

asked 19 Nov '15, 04:51

mabra77's gravatar image

mabra77
11112
accept rate: 0%

edited 19 Nov '15, 06:15

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


3 Answers:

2

the www.openstreetmap.org website currently uses leaflet as the library for slippy maps instead of OpenLayers. You can follow the example here instead: http://leafletjs.com/examples/quick-start.html

answered 19 Nov '15, 06:11

PlaneMad's gravatar image

PlaneMad
28237
accept rate: 33%

edited 19 Nov '15, 19:19

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

2

In general people prefer to use Leaflet as it is somewhat less complex than OpenLayers and works better on mobile devices. Chris Hill wrote a few how-tos for Leaflet on this blog (e.g. http://chris-osm.blogspot.co.uk/2013/11/using-leaflet-v07_21.html): these are probably better documented and easier to follow than the wiki.

answered 19 Nov '15, 11:00

SK53's gravatar image

SK53 ♦
28.1k48268433
accept rate: 22%

1

I have put up a note on https://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example#Instructions - with a download link for version two (which the example seems to be based on). The example works - I have just tried it. A example for the current version 3 is at http://openlayers.org/en/v3.11.1/doc/quickstart.html

answered 19 Nov '15, 06:26

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554
accept rate: 18%

edited 19 Nov '15, 06:54

Source code available on GitHub .