Skip to content

Commit e1dd6f6

Browse files
author
lvonnied
committed
Merge of both Folium and Leaflet execises
1 parent 4bc3d43 commit e1dd6f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4149
-0
lines changed

.idea/workspace.xml

+430
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JS/config.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
L.mapbox.accessToken = 'pk.eyJ1Ijoic2ZyaXRzY2hpIiwiYSI6ImNqMWM3bWc0ZzAwNHczM3BhdDY3aGM4NHUifQ.4L6rSyUbvozhhYjbhl8HRg';
2+
3+
var osmAttributionUrl = "https://www.openstreetmap.org/copyright";
4+
var osmAttributionText = "OSM";
5+
var mapboxAttributionUrl = "https://www.mapbox.com/about/maps/";
6+
var mapboxAttributionText = "MapBox";
7+
8+
var mapboxUrl = "https://api.tiles.mapbox.com/v4/sfkeller.k0onh2me/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoic2ZrZWxsZXIiLCJhIjoia3h4T3pScyJ9.MDLSUwpRpPqaV7SVfGcZDw";
9+
var osmUrl = "https://tile.osm.ch/osm-swiss-style/{z}/{x}/{y}.png";
10+
11+
var createAttribution = function(mapsrc, mapdesc){
12+
return "<a href='https://wiki.openstreetmap.org/wiki/Open_Database_License'>OpenStreetMap</a> contributors | "
13+
+ "Map data &copy; <a href=" + mapsrc + ">" + mapdesc + "</a> | "
14+
+ "<a href='https://giswiki.hsr.ch/Webmapping_Clients'>About</a> | "
15+
+ "<a href='https://www.hsr.ch/geometalab'>By GeometaLab</a>";
16+
};
17+
18+
var mapboxAttribution = createAttribution(mapboxAttributionUrl, mapboxAttributionText),
19+
osmAttribution = createAttribution(osmAttributionUrl, osmAttributionText);
20+
21+
var mapboxSatellite = L.tileLayer(mapboxUrl, {id: 'mapid', attribution: mapboxAttribution}),
22+
mapboxStreets = L.tileLayer(osmUrl, {id: 'mapid', attribution: mapboxAttribution});
23+
24+
var baseMaps = {
25+
"Satellite": mapboxSatellite,
26+
"Streets": mapboxStreets
27+
};

JS/geojsonHandler.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
var getGeojson = function(path) {
2+
var geoJson = new L.geoJson();
3+
4+
$.ajax({
5+
dataType: "json",
6+
url: path,
7+
success: function(data) {
8+
$(data.features).each(function(key, data) {
9+
geoJson.addData(data);
10+
});
11+
}
12+
}).error(function() {});
13+
return geoJson;
14+
}
15+
16+
// Übung 3 - geojson castles
17+
var loadGeojson = function(filepath, layergoup, icon){
18+
$.getJSON(filepath, function(data) {
19+
var jsoncastles = L.geoJson(data, {
20+
//go through every element of the json and add it to the layer
21+
onEachFeature: function (feature, layer) {
22+
layer.bindPopup(feature.properties.name ? feature.properties.name : "Kein Name");
23+
},
24+
pointToLayer: function (feature, latlng) {
25+
return L.marker(latlng, {icon: icon });
26+
}
27+
});
28+
jsoncastles.addTo(layergoup);
29+
});
30+
return layergoup;
31+
};
32+
33+
// Übung 4 - geojson castles with leaflet-clusters-plugin
34+
var castleMarkers;
35+
36+
var loadGeojsonCluster = function(filepath, layergroup, icon){
37+
$.getJSON(filepath, function(data) {
38+
castleMarkers = L.markerClusterGroup();
39+
var jsonCastles = L.geoJson(data, {
40+
// go through every element of the json and add it to the layer.
41+
onEachFeature: function (feature, layer) {
42+
layer.bindPopup(feature.properties.name ? feature.properties.name : "Kein Name");
43+
},
44+
pointToLayer: function (feature, latlng) {
45+
return L.marker(latlng, {icon: icon });
46+
}
47+
});
48+
// Add generated "jsonCastles" layer to "castleMarkers".
49+
jsonCastles.addTo(castleMarkers);
50+
castleMarkers.addTo(layergroup);
51+
});
52+
return layergroup;
53+
};

JS/imageMapResizer.min.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JS/osmtogeojson.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JS/staticMapElements.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var marker = L.marker([47.22234, 8.81727]);
2+
3+
var polygon = L.polygon([
4+
[47.22354, 8.81872],
5+
[47.22325, 8.8182],
6+
[47.22294, 8.81857],
7+
[47.22323, 8.81909]
8+
], {
9+
color: '#dde21a',
10+
fillColor: 'yellow',
11+
fillOpacity: 0.5
12+
});
13+
14+
var circle = L.circle([47.2225, 8.81481], {
15+
color: 'red',
16+
fillColor: '#f03',
17+
fillOpacity: 0.5,
18+
radius: 20
19+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.marker-cluster-small {
2+
background-color: rgba(181, 226, 140, 0.6);
3+
}
4+
.marker-cluster-small div {
5+
background-color: rgba(110, 204, 57, 0.6);
6+
}
7+
8+
.marker-cluster-medium {
9+
background-color: rgba(241, 211, 87, 0.6);
10+
}
11+
.marker-cluster-medium div {
12+
background-color: rgba(240, 194, 12, 0.6);
13+
}
14+
15+
.marker-cluster-large {
16+
background-color: rgba(253, 156, 115, 0.6);
17+
}
18+
.marker-cluster-large div {
19+
background-color: rgba(241, 128, 23, 0.6);
20+
}
21+
22+
/* IE 6-8 fallback colors */
23+
.leaflet-oldie .marker-cluster-small {
24+
background-color: rgb(181, 226, 140);
25+
}
26+
.leaflet-oldie .marker-cluster-small div {
27+
background-color: rgb(110, 204, 57);
28+
}
29+
30+
.leaflet-oldie .marker-cluster-medium {
31+
background-color: rgb(241, 211, 87);
32+
}
33+
.leaflet-oldie .marker-cluster-medium div {
34+
background-color: rgb(240, 194, 12);
35+
}
36+
37+
.leaflet-oldie .marker-cluster-large {
38+
background-color: rgb(253, 156, 115);
39+
}
40+
.leaflet-oldie .marker-cluster-large div {
41+
background-color: rgb(241, 128, 23);
42+
}
43+
44+
.marker-cluster {
45+
background-clip: padding-box;
46+
border-radius: 20px;
47+
}
48+
.marker-cluster div {
49+
width: 30px;
50+
height: 30px;
51+
margin-left: 5px;
52+
margin-top: 5px;
53+
54+
text-align: center;
55+
border-radius: 15px;
56+
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
57+
}
58+
.marker-cluster span {
59+
line-height: 30px;
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
2+
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
3+
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
4+
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
5+
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
6+
}
7+
8+
.leaflet-cluster-spider-leg {
9+
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
10+
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
11+
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
12+
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
13+
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
We don't ship the .js files in the git master branch.
2+
They are only present in version tags and in npm.
3+
4+
See how to get the JS files here: https://github.com/Leaflet/Leaflet.markercluster#using-the-plugin
5+
Or how to build them: https://github.com/Leaflet/Leaflet.markercluster#building-testing-and-linting-scripts

0 commit comments

Comments
 (0)