Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

I'm breaking down my question into three parts. I am a beginner to Leaflet and to writing code. Currently, I have a JSON file with all of my markers linked to my map page. The idea is that every marker will have a different image so when the user clicks on the marker the thumbnail for the image will appear in the map, which will link to an image in the website.

Here is an example of a marker in the JSON file:

var mapshs4 = {
    "type": "FeatureCollection",

    "features": [

    { "type": "Feature", "id": 0, "properties": { "idcode": "A", "popupContent": "Here!" + '< img src="thumbnail">' }, "geometry": { "type": "Point", "coordinates": [ -89.2, 22.4 ] } }
  1. Is there a way to resize the popup box to the image in the popup of a marker.

  2. At the same time, I would like the click event to connect to a larger sized image embedded within the site. My guess is that I would have to attach an ID to each image and to each marker to link them together.

  3. Conversely, how do you make it so that when the user clicks on the image embedded in the site, it will go to that marker on the map? (For an example that uses a label:

Any help would be much appreciated.

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.