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

Hello,

I want to add a share button on the map. By clicking it user should able to share current map Image. Such functionality is already given at http://www.openstreetmap.org/#map=2/49.0/124.1.

I want to do the same. Can I have small example?

Thanks Hardik Pancholi

asked 24 Mar '14, 06:03

hardikpancholi85's gravatar image

hardikpancho...
41335
accept rate: 0%

edited 24 Mar '14, 10:17

iii's gravatar image

iii
4.9k84082


You are refering to what we call 'permalink'. This functionality is embedded in the particular webmap library you are using to display the interactive map. So there are different ways on how to enable this kind of functionality on the libs:

Then you just need a piece of JavaScript that triggers that functionality and returns an link wherever you want it.

permanent link

answered 24 Mar '14, 10:16

iii's gravatar image

iii
4.9k84082
accept rate: 10%

Hello,

You gave very nice example. Using http://openlayers.org/dev/examples/controls.html now I am able to add zooming pane. But in this example there isn't anything related to Share functionality. Can you give some specific example for share?

Thanks

(25 Mar '14, 03:30) hardikpancho...

click the "permalink" in the right bottom corner. The URL in your browser will change. It typically adds coordinates and depending on the application selected layers, etc. Copy the http-address from your browser's address bar, This is different UI from the Share button you see on OSM.org, but does basically the same.

(25 Mar '14, 16:05) escada
1

Hello,

Sorry but I didn't get you. What I want to share functionality same as on http://www.openstreetmap.org/.

In right side menu list there are list of functionality are there. I want to implement share functionality. It will be really good If I can have example.

Thanks

(27 Mar '14, 06:30) hardikpancho...

perhaps look at the source code of the main page. All functionality is Javascript and can be examined through your browser. Or look at the source repository for the website (I don't have a link to that)

(27 Mar '14, 16:26) escada

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:

×122
×74
×4

question asked: 24 Mar '14, 06:03

question was seen: 4,467 times

last updated: 27 Mar '14, 16:26

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