123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Leaflet GeoJSON Example</title>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
- </head>
- <body>
- <div id="map" style="width: 1200px; height: 700px"></div>
- <script src="tr-hydrant.js" type="text/javascript"></script>
- <script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
- <script>
- var map = L.map('map').setView([48.9547, 10.9083], 16);
- L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
- attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
- }).addTo(map);
- function onEachFeature(feature, layer) {
- var popupContent = "<p>" + feature.geometry.type + "</p>";
- if (feature.properties && feature.properties.popupContent) {
- popupContent += feature.properties.popupContent;
- }
- layer.bindPopup(popupContent);
- }
- L.geoJson(regions, {
- style: function (feature) {
- st = { weight: 1, color: "#000", opacity: 1, fillColor: "#ff0", fillOpacity: 0.5 }
- if(feature.properties.done) {
- st["fillColor"] = "#dc0067";
- }
- if(feature.properties.outdoor) {
- st["weight"] = 0;
- }
- return st
- },
- onEachFeature: onEachFeature,
- pointToLayer: function (feature, latlng) {
- return L.circleMarker(latlng, {
- radius: 8,
- fillColor: "#ff7800",
- color: "#000",
- weight: 1,
- opacity: 1,
- fillOpacity: 0.8
- });
- }
- }).addTo(map);
- </script>
- </body>
- </html>
|