Harry Wood
home
>
maps
>
examples
> leaflet >
Leaflet showing CartoDB positron
Leaflet showing CartoDB positron
A basic leaflet map with
CartoDB positron tiles
.
<html> <head> <title>Leaflet showing CartoDB positron</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" /> <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script> <style> #map { height: 180px; } </style> <script language="javascript"> function init() { var map = L.map('map').setView([51.505, -0.09], 13); //CartoDB layer names: light_all / dark_all / light_nonames / dark_nonames var layer = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>' }); layer.addTo(map); map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text. Attribution overload } </script> </head> <body onLoad="javascript:init();"> <div id="map"></div> </body> </html>
view directly
Home
Blog
About
Maps
Other
Contact