NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hello,

I want to show MAP key as it is there on http://www.openstreetmap.org/#map=9/23.2439/71.1063

Below is my simple code for map:

<div id="ourMap"></div>

<script  src="http://www.openlayers .org/api/OpenLayers.js"></script> 
<script>  
    map = new  OpenLayers.Map("ourMap"); 
    map.addLayer(new  OpenLayers.Layer.OSM());  
    map.zoomToMaxExtent(); 
</script>

Is there any feature which I have to turn on to show the Map key with same feature as it is giving in above URL?

Regards, Hardik Pancholi

asked 07 Apr '14, 11:02

hardikpancholi85's gravatar image

hardikpancho...
41335
accept rate: 0%

edited 07 Apr '14, 13:41

scai's gravatar image

scai ♦
33.3k21309459


OpenLayers doesn't support an OpenStreetMap Map Key out of the box, so there's no single feature you can enable for this purpose. Also, the OpenStreetMap main page uses Leaflet rather than OpenLayers, which makes a copy&paste somewhat difficult.

Maybe you could use this URL as a starting point to get at least the Map Key information and then enable/disable some of the elements according to your zoom layer (see data-zoom-min/data-zoom-max below). The question remains how to best embed that URL in your application. Maybe you want to use concept similar to a side bar to display your Map Key.

tr class="mapkey-table-entry" data-zoom-max="19" data-zoom-min="0" data-layer="mapnik"
permanent link

answered 21 Apr '14, 08:05

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×535
×122
×22

question asked: 07 Apr '14, 11:02

question was seen: 5,844 times

last updated: 21 Apr '14, 08:05

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum