|
|
<!DOCTYPE html> <html> <head> <title> Leaflet Demo </title> </head> <body> </body> </html>
<head> <title> Leaflet Demo </title> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> </head>
<body> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> </body>
<body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> </body>
<head> <title> Leaflet Demo </title> <style> body, html { height: 100%; } #map { width: 100%; height: 100%; } </style> </head>
<body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script> </script> </body>
var map = L.map('map').setView([40.018, -105.278], 15);
L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'OpenStreetMap and MapQuest', subdomains: '1234', type: 'map' }).addTo(map);
var marker = L.marker([40.018, -105.278]).addTo(map);
<body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script src="http://mapsarecool.com/maptime2015/boulder_restaurants.geojson"></script> <script> ... </script> </body>
L.geoJson(boulderData, { pointToLayer: function(feature, latlng) { return L.circleMarker(latlng); } }).addTo(map);
L.geoJson(boulderData, { pointToLayer: function(feature, latlng) { return L.circleMarker(latlng, { color: 'white', fillOpacity: 1, radius: 6 }); } }).addTo(map);
var colors = { 'bar': '#8e44ad', 'cafe': '#e74c3c', 'pub ': '#16a085', 'restaurant': '#f1c40f' };
L.geoJson(boulderData, { pointToLayer: function(feature, latlng) { return L.circleMarker(latlng, { color: 'white', fillColor: colors[feature.properties.amenity], fillOpacity: 1, radius: 6 }); } }).addTo(map);
<body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script src="http://mapsarecool.com/maptime2015/boulder_restaurants.geojson"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script> <script> ... </script> </body>
var popupContent = function(properties) { var content = '<div class="popup">' + '<span class="title">{{name}}</span><br/>' + '{{address}}<br/>' + '<hr/>' + '<span class="title">Amenity</span>: {{amenity}}<br/>' + '<span class="title">Cuisine</span>: {{cuisine}}<br/>' + '</div>'; return Handlebars.compile(content)(properties); };
L.geoJson(boulderData, { pointToLayer: function(feature, latlng) { return L.circleMarker(latlng, { color: 'white', fillColor: colors[feature.properties.amenity], fillOpacity: 1, radius: 6 });}, onEachFeature: function(feature, layer) { return layer.bindPopup(popupContent(feature.properties)); } }).addTo(map);
<!DOCTYPE html> <html> <head> <title> #maptime Boulder Leaflet Demo </title> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> <style> body, html { height: 100%; } #map { width: 100%; height: 100%; } </style> </head> <body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script src="http://mapsarecool.com/maptime2015/boulder_restaurants.geojson"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script> <script> var map = L.map('map').setView([40.018, -105.278], 15); var colors = { 'bar': '#8e44ad', 'cafe': '#e74c3c', 'pub ': '#16a085', 'restaurant': '#f1c40f' }; var popupContent = function(properties) { var content = '<div class="popup">' + '<span class="title">{{name}}</span><br/>' + '{{address}}<br/>' + '<hr/>' + '<span class="title">Amenity</span>: {{amenity}}<br/>' + '<span class="title">Cuisine</span>: {{cuisine}}<br/>' + '</div>'; return Handlebars.compile(content)(properties); }; L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'OpenStreetMap and MapQuest', subdomains: '1234', type: 'map' }).addTo(map); var marker = L.marker([40.018, -105.278]).addTo(map); L.geoJson(boulderData, { pointToLayer: function(feature, latlng) { return L.circleMarker(latlng, { color: 'white', fillColor: colors[feature.properties.amenity], fillOpacity: 1, radius: 6 });}, onEachFeature: function(feature, layer) { return layer.bindPopup(popupContent(feature.properties)); } }).addTo(map); </script> </body> </html>
<head> <title> Leaflet Demo </title> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> </head>
<body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/reqwest/1.1.5/reqwest.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script> <script src="http://leaflet.github.io/Leaflet.draw/leaflet.draw.js"></script> <script> ... </script> </body>
var drawnItems = new L.FeatureGroup(); map.addLayer(drawnItems); var drawControl = new L.Control.Draw({ draw: { position: 'topleft', polygon: { title: 'Draw a sexy polygon!', allowIntersection: false, drawError: { color: '#b00b00', timeout: 1000 }, shapeOptions: { color: '#bada55' }, showArea: true }, polyline: { metric: false }, circle: { shapeOptions: { color: '#662d91' } } }, edit: { featureGroup: drawnItems } }); map.addControl(drawControl); map.on('draw:created', function (e) { var type = e.layerType, layer = e.layer; if (type === 'marker') { layer.bindPopup('A popup!'); } drawnItems.addLayer(layer); });