Advertisement
Guest User

Untitled

a guest
Nov 6th, 2015
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  4. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
  5. <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
  7. <script src="https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js"></script>
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. <style>
  15.  
  16. html, body {
  17. width: 100%;
  18. height: 100%;
  19. margin: 0;
  20. padding: 0;
  21. }
  22.  
  23. .legend {
  24. padding: 0px 0px;
  25. font: 10px sans-serif;
  26. background: white;
  27. background: rgba(255,255,255,0.8);
  28. box-shadow: 0 0 15px rgba(0,0,0,0.2);
  29. border-radius: 5px;
  30. }
  31.  
  32. .key path {
  33. display: none;
  34. }
  35.  
  36. </style>
  37. </head>
  38.  
  39. <body>
  40.  
  41. <div id="map" style="width: 100%; height: 100%"></div>
  42.  
  43. <script>
  44.  
  45. queue()
  46. .defer(function(callback){callback(null, JSON.parse('{"type": "Feature", "geometry": {"coordinates": [[-122.42436302145, 37.8004143219856], [-122.42699532676599, 37.80087263276921]], "type": "MultiPoint"}, "properties": {"prop0": "value0"}}'))})
  47. .await(makeMap)
  48.  
  49. function onEachFeature(feature, layer) {
  50. // does this feature have a property named popupContent?
  51. if (feature.properties && feature.properties.popupContent) {
  52. layer.bindPopup(feature.properties.popupContent);
  53. }
  54. };
  55.  
  56. function makeMap(error, gjson_1) {
  57.  
  58.  
  59.  
  60.  
  61.  
  62. function matchKey(datapoint, key_variable){
  63. if (typeof key_variable[0][datapoint] === 'undefined') {
  64. return null;
  65. }
  66. else {
  67. return parseFloat(key_variable[0][datapoint]);
  68. };
  69. };
  70.  
  71.  
  72.  
  73. var map = L.map('map').setView([37.7622, -122.4356], 13);
  74.  
  75. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  76. maxZoom: 18,
  77. minZoom: 1,
  78. attribution: 'Map data (c) <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
  79. }).addTo(map);
  80.  
  81.  
  82. function style_1(feature) {
  83. return {
  84. fillColor: 'blue',
  85. weight: 1,
  86. opacity: 1,
  87. color: 'black',
  88. fillOpacity: 0.6
  89. };
  90. }
  91.  
  92.  
  93.  
  94. gJson_layer_1 = L.geoJson(gjson_1, {style: style_1,onEachFeature: onEachFeature}).addTo(map)
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. };
  112.  
  113. </script>
  114. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement