Skip to content

Commit

Permalink
jk
Browse files Browse the repository at this point in the history
  • Loading branch information
HillaryKoros committed Oct 13, 2023
1 parent cf6df02 commit 217444b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style>
body {
font-family: Arial, sans-serif;
margin: 0; /* Reset default margin */
margin:0; /* Reset default margin */
padding: 0; /* Reset default padding */
display: flex;
flex-direction: column;
Expand Down
15 changes: 13 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@ fetch(geoJsonUrl)
L.geoJSON(geoJsonData, {
style: function (feature) {
var area = feature.properties.area; // Get the area from the properties
// Assign colors based on the area value
var fillColor = area > 1 ? 'green' : 'yellow';
// Assign colors based on a gradient
var fillColor = area > 10? 'green' : 'yellow';

// Modify fillColor based on the area value for a gradient effect
if (area > 10) {
fillColor = 'green';
} else if (area > 5) {
fillColor = 'yellow';
} else {
fillColor = 'red';
}

return {
fillColor: fillColor,
fillOpacity: 0.5,
color: 'blue',
weight: 2
};
},

onEachFeature: function (feature, layer) {
// Create a popup with all properties
var popupContent = '<strong>Properties:</strong><br>' +
Expand Down

0 comments on commit 217444b

Please sign in to comment.