Skip to content

Commit

Permalink
[feature] map working
Browse files Browse the repository at this point in the history
  • Loading branch information
nordcomputer committed Jan 10, 2021
0 parents commit 3ab32fb
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Firefight-Corona-Map
6 changes: 6 additions & 0 deletions css/map.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
html,body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
97 changes: 97 additions & 0 deletions js/map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const position = [9.43, 51.01]; // Position (Longitude, Latitude)
const zoomlevel = 5; //Zoomstufe

require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/widgets/Legend"
], function (Map, MapView, FeatureLayer, Legend) {
const defaultSym = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
outline: {
// autocasts as new SimpleLineSymbol()
color: [128, 128, 128, 0.2],
width: "0.5px"
}
};




const renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: defaultSym,
label: "Inzidenz",
visualVariables: [
{
type: "color",
field: "cases7_per_100k",
stops: [
{
value: 0,
color: "#FFFFFF",
label: "0"
},
{
value: 301,
color: "#8b0000",
label: ">300"
}
]
}
]
};
var trailheadsLabels = {
symbol: {
type: "text",
color: "#000000",
haloColor: "#FFFFFF",
haloSize: "1px",
font: {
size: "15px",
family: "Noto Sans",
style: "italic",
weight: "normal"
}
},
labelPlacement: "always-horizontal",
labelExpressionInfo: {
expression:
'return $feature["county"] + " \\n" + $feature["cases7_per_100k_txt"]'
}
};
const povLayer = new FeatureLayer({
url:
"https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0",
renderer: renderer,
labelingInfo: [trailheadsLabels],
title: "7 Tage Inzidenzen auf 100k Einwohner.",
popupTemplate: {
// autocasts as new PopupTemplate()
title: "{COUNTY}",
content:
"{cases7_per_100k_txt} Neu-Infizierte auf 100.000 Einwohner in den letzten 7 Tagen",
fieldInfos: []
}
});

const map = new Map({
basemap: "gray-vector",
layers: [povLayer]
});

const view = new MapView({
container: "viewDiv",
map: map,
center: position,
zoom: zoomlevel
});

view.ui.add(
new Legend({
view: view
}),
"top-right"
);
});
19 changes: 19 additions & 0 deletions map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />

<title>
Corona 7-Tage Inzidenzen/100k Einwohner
</title>


<link rel="stylesheet" href="https://js.arcgis.com/4.17/esri/themes/light/main.css"/>
<script src="https://js.arcgis.com/4.17/"></script>
<script src="js/map.js"></script>
<link rel="stylesheet" href="css/map.css">
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>

0 comments on commit 3ab32fb

Please sign in to comment.