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

Where are the baselayers and overlays defind in osm ?

1

In top right corner there is a "+" menu that has a lot of baselayers and overlays. Where is that menu defined?

asked 16 Nov '11, 15:41

alexz's gravatar image

alexz
225212226
accept rate: 0%


2 Answers:

4

The main bit of javascript for doing this is a map.js file. In the rails app on github, you can find this under '/app/assets/map.js.erb'

OpenLayers has some built-in pre-packaging of definitions of OpenStreetMap layers. We have a local (modified?) copy of this in our repo here ...but this comes with OpenLayers.

But perhaps you're looking for more basic information: The OpenStreetMap front page uses OpenLayers, but it is not the easiest place to learn about how to invoke OpenLayers. Here's an easier example of invoking OpenLayers with many layers (do 'view source' to see how that works)

answered 16 Nov '11, 16:10

Harry%20Wood's gravatar image

Harry Wood
9.5k2588128
accept rate: 14%

edited 16 Nov '11, 16:11

Thanks a lot for that but i was looking for the definition of the menu itself. I want to add there a new layer: the marker's layer, the one that is activated when the request has mlon and mlat values. I use it to add some popup markers. I want that layer to be in the menu too.

(17 Nov '11, 07:29) alexz

-1

The '+' is a standard feature of OpenLayers, which is one of the javascript libraries that can be used to present a movable map (slippy map) on a web page. An alternate library is Leaflet; read more at http://leaflet.cloudmade.com

answered 17 Nov '11, 11:10

ChrisH's gravatar image

ChrisH
4.1k134262
accept rate: 15%

Thx, but i don't want to implement a different technology.

(17 Nov '11, 14:18) alexz

Source code available on GitHub .