Skip to content

Instantly share code, notes, and snippets.

@letswritetw
Created September 30, 2020 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letswritetw/6fc4294370f2fdf16e81686fbd3655f6 to your computer and use it in GitHub Desktop.
Save letswritetw/6fc4294370f2fdf16e81686fbd3655f6 to your computer and use it in GitHub Desktop.
leaflet-osm-basic
const popup = L.popup();
function onMapClick(e) {
let lat = e.latlng.lat; // 緯度
let lng = e.latlng.lng; // 經度
popup
.setLatLng(e.latlng)
.setContent(`緯度:${lat}<br/>經度:${lng}`)
.openOn(map);
}
map.on('click', onMapClick);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment