Guest User

Untitled

a guest
May 20th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. {
  2. "type": "FeatureCollection",
  3. "features": [{
  4. "type": "Feature",
  5. "properties": {
  6. "mag": 5.4,
  7. "place": "48km SSE of Pondaguitan, Philippines",
  8. "status": "AUTOMATIC" },
  9. "geometry": {
  10. "type": "Point",
  11. "coordinates": [126.3832, 5.9775] },
  12. },
  13. {
  14. "type": "Feature",
  15. "properties": {
  16. "mag": 5.7,
  17. "place": "35km ESE of Ndoi Island, Fiji",
  18. "status": "REVIEWED" },
  19. "geometry": {
  20. "type": "Point",
  21. "coordinates": [-178.3725, -20.753] },
  22. },
  23. ]
  24. }
  25.  
  26. <!DOCTYPE html>
  27. <html>
  28. <head>
  29. <style>
  30. <link rel="stylesheet" href="style.css">
  31. </style>
  32. </head>
  33. <body>
  34.  
  35. <script>
  36. var gmarkers1 = [];
  37. var markers1 = [];
  38. var map;
  39.  
  40. function initMap() {
  41. map = new google.maps.Map(document.getElementById('map'), {
  42. zoom: 2,
  43. center: new google.maps.LatLng(2.8,-187.3),
  44. mapTypeId: 'terrain',
  45. streetViewControl: false,
  46. mapTypeControl: false
  47. });
  48.  
  49. var script = document.createElement('script');
  50.  
  51. script.src = 'https://developers.google.com/maps/documentation/javascript/examples/json/earthquake_GeoJSONP.js';
  52. document.getElementsByTagName('head')[0].appendChild(script);
  53. }
  54.  
  55. window.eqfeed_callback = function(results) {
  56. for (var i = 0; i < results.features.length; i++) {
  57. var coords = results.features[i].geometry.coordinates;
  58. var latLng = new google.maps.LatLng(coords[1],coords[0]);
  59. var marker = new google.maps.Marker({
  60. position: latLng,
  61. map: map
  62. });
  63. }
  64. }
  65.  
  66. gmarkers1.push(marker1);
  67.  
  68. // Function to filter markers by category
  69.  
  70. filterMarkers = function (category) {
  71. for (i = 0; i < markers1.length; i++) {
  72. marker = gmarkers1[i];
  73.  
  74. // If is same category or category not picked
  75. if (marker.category == category || category.length === 0) {
  76. marker.setVisible(true);
  77. }
  78. // Categories don't match
  79. else {
  80. marker.setVisible(false);
  81. }
  82. }
  83. }
  84.  
  85. </script>
  86.  
  87. <script async defer
  88. src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
  89. </script>
  90.  
  91. <div class="mapWrap">
  92. <div id="map"></div>
  93.  
  94. <div class="investCast">
  95.  
  96. <select id="mag" onchange="filterMarkers(this.value);">
  97. <option value="">Selected the magnitude</option>
  98. <!-- value="4.5=<" Is this correct? I want to load all the values less or equal than 4.5 -->
  99. <option value="4.5=<">Less than or equal 4.5</option>
  100. <!-- value="4.6 to 4.9=<" Is this correct? I want to load all the values between 4.6 to 4.9 -->
  101. <option value="4.6 to 4.9">Between 4.6 and 4.9</option>
  102. <!-- value="4.6 to 4.9=<" Is this correct? I want to load all the values greater or equal 5 -->
  103. <option value=">=5">Greater than or equal 5</option>
  104. </select>
  105.  
  106. </div>
  107. </div>
  108.  
  109. </body>
  110. </html>
Add Comment
Please, Sign In to add comment