Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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: http://www.theglobeandmail.com/life/home-and-garden/real-estate/exclusive-how-much-are-homes-in-your-toronto-neighbourhood/article4520994/)

Any help would be much appreciated.

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.