A Leaflet.js map created with Folium- click on the map to add markers, double-click to remove them. This map was generated with the following Python code:
map_4 = folium.Map(location=[46.8527, -121.7649], tiles='Stamen Terrain',
zoom_start=13)
map_4.simple_marker(location=[46.8354, -121.7325], popup='Camp Muir')
map_4.click_for_marker(popup='Waypoint')
map_4.create_map(path='mtrainier.html')
xxxxxxxxxx
<head>
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.min.js"></script>
<style>
#map {
position:absolute;
top:0;
bottom:0;
right:0;
left:0;
}
</style>
</head>
<body>
<div id="map" style="width: 960px; height: 500px"></div>
<script>
var map = L.map('map').setView([46.8527, -121.7649], 13);
L.tileLayer('https://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.jpg', {
maxZoom: 18,
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
}).addTo(map);
var marker_1 = L.marker([46.8354, -121.7325]);
marker_1.bindPopup("Camp Muir");
map.addLayer(marker_1)
function newMarker(e){
var new_mark = L.marker().setLatLng(e.latlng).addTo(map);
new_mark.dragging.enable();
new_mark.on('dblclick', function(e){map.removeLayer(e.target)})
var lat = e.latlng.lat.toFixed(4),
lng = e.latlng.lng.toFixed(4);
new_mark.bindPopup("Waypoint");
};
map.on('click', newMarker)
</script>
</body>
Modified http://cdn.leafletjs.com/leaflet-0.5/leaflet.js to a secure url
https://cdn.leafletjs.com/leaflet-0.5/leaflet.js