Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I enable the unique location and zoom level of a user on a web-map to be shared?

For example, if a user zooms to lat: 75, lon: 35, zoom: 8, I would like to be able for the user to share that location through a link (for example, As I'm using OpenLayers, I understand how to record where the lat/lon/zoom of what the user is viewing, and also how to store this in a database if necessary, but I do not have a clear idea how (or if) this argument can be shared via the browser.

My OpenLayers code is usually something of this form:

var mapCenter = new OpenLayers.LonLat(-35, 75);             
map.setCenter(mapCenter, 3);  

For example, I would like to work, and all other permutations of lat/lon/zoom.

share|improve this question
up vote 3 down vote accepted

Let see this permalink example from OpenLayers site. URL in this case looks like:

As you can see alongside coordinates of map center and zoom level you can transfer list of visible layers. For detailed information see source code of Permalink control.

share|improve this answer

You would do something like Then you can either send this to some server side script, extract the variables from the URL and make map use them, or you can use client side Javascript code (I would go for window.location) and do generally the same.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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