Skip to content

Commit

Permalink
starting challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
JodeeHarris committed Oct 11, 2023
1 parent 5aba35c commit 93d7aca
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 0 deletions.
Binary file added Starter_Code/Images/1-Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/2-BasicMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/3-Data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/4-JSON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/5-Advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/6-Time_Keeps_On_Ticking.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/Cluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Starter_Code/Images/Heat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Starter_Code/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Leaflet Step-1</title>

<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin="" />

<!-- Our CSS -->
<link rel="stylesheet" type="text/css" href="static/css/style.css">
</head>

<body>

<!-- The div that holds our map -->
<div id="map"></div>

<!-- Leaflet JS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<!-- D3 JavaScript -->
<script src="https://d3js.org/d3.v7.min.js"></script>
<!-- Our JavaScript -->
<script type="text/javascript" src="static/js/logic.js"></script>
</body>

</html>
10 changes: 10 additions & 0 deletions Starter_Code/static/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
body {
padding: 0;
margin: 0;
}

#map,
body,
html {
height: 100%;
}
36 changes: 36 additions & 0 deletions Starter_Code/static/js/logic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson"
depth = function(d){
if (d >= 90) {
return "red"}
else if (d>=70){
return "green"
}
else if (d>=50){
return "orange"
}
else if (d>=30){
return "yellow"
}
else {
return "blue"
}
}
d3.json(url).then(function(eqData){
console.log(eqData)
map = L.map("map",{
center:[0,0],
zoom: 2
})
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.geoJson(eqData,{pointToLayer:function(feature, cord){
return L.circleMarker(cord,{
color: depth(feature.geometry.coordinates[2]),
fillColor: depth(feature.geometry.coordinates[2]),
opacity: 1,
fillOpacity: .7,
radius: feature.properties.mag * 10
})
}}).addTo(map);
})

0 comments on commit 93d7aca

Please sign in to comment.