Harry Wood
home
>
maps
>
examples
> leaflet >
Leaflet marker
Leaflet marker
Adding a marker. Continuing their
quick Start tutorial
<html> <head> <title>Leaflet marker</title> <link rel="stylesheet" href="leaflet/leaflet.css" /> <!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" /><![endif]--> <script src="leaflet/leaflet.js"></script> <script language="javascript"> function init() { var map = new L.Map('map'); L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors', maxZoom: 18 }).addTo(map); map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text. // Location to centre the map var london = new L.LatLng(51.505, -0.09); map.setView(london, 13); // Location of the marker var markerLocation = new L.LatLng(51.5, -0.09); var marker = new L.Marker(markerLocation); map.addLayer(marker); } </script> </head> <body onLoad="javascript:init();"> <div id="map" style="height: 200px"></div> </body> </html>
view directly
Home
Blog
About
Maps
Other
Contact