Commit e10dba3f authored by barth23's avatar barth23
Browse files

update js

parent e654afaa
This diff is collapsed.
......@@ -15,7 +15,7 @@ var translation = {
"military":"constructions militaires",
"religious":"édifices religieux",
"infrastructure":"infrastructure",
"public":"édifices publiques",
"public":"édifices publics",
"garden":"jardins",
"geographic":"villes",
"miscellaneous":"autres"
......@@ -41,18 +41,24 @@ var translation = {
"de": {
"hre": "<b>HRR 1700</b>",
"france": "<b>Frankreich 1700</b>"
}
}
},
"baseLayer": {
"fra": "<b>Des endroits</b>",
"de": "<b>Orte</b>"
}
}
//Function Definitions
//OnEachFeature Function
function onEachFeature(feature, layer) {
if (lang === "fra") {
layer.on('click', function() { openPlaceName('plc:'+feature.properties.id) });
layer.bindPopup(feature.properties.description.fra);
//layer.bindPopup('<iframe src="https://adwmainz.pages.gitlab.rlp.net/regesta-imperii/lab/landing/"></iframe>')
layer.setIcon(setMarker(feature.properties.type, feature.properties.color))
}
else if (lang === "de") {
layer.on('click', function() { openPlaceName('plc:'+feature.properties.id) });
//layer.bindPopup(feature.properties.description.de);
layer.bindPopup('<iframe src="https://adwmainz.pages.gitlab.rlp.net/regesta-imperii/lab/landing/"></iframe>')
layer.setIcon(setMarker(feature.properties.type, feature.properties.color))
}
}
......@@ -77,16 +83,17 @@ function overlayName(type, lang) {
}
}
//Function to Define Overlay Name
//Function to Define Overlay Names
function overlayNames(lang) {
if (lang==="fra") {
var overlayMaps = {
"Pitzler":"",
"Harrach":"",
"Corfey":"",
"Knesebeck":"",
"Sturm":"",
"Knesebeck":"",
"Corfey":"",
"Pitzler":"",
"Neumann":"",
"Harrach":"",
"Neumann":"",
"<b>Des endroits</b>":"",
"<b>France 1700</b>":"",
"<b>Saint-Empire 1700</b>":""
};
......@@ -94,12 +101,13 @@ function overlayNames(lang) {
}
else if (lang==="de"){
var overlayMaps = {
"Pitzler":"",
"Harrach":"",
"Corfey":"",
"Knesebeck":"",
"Sturm":"",
"Knesebeck":"",
"Corfey":"",
"Pitzler":"",
"Neumann":"",
"Harrach":"",
"Neumann":"",
"<b>Orte</b>":"",
"<b>HRR 1700</b>":"",
"<b>Frankreich 1700</b>":""
};
......@@ -399,7 +407,7 @@ function setMarker(type, color) {
width="37.5562mm" height="17.7202mm"
viewBox="0 0 365 560">
<path id="Geographic"
fill="${color}" fill-opacity="0.8" stroke="black" stroke-width="7"
fill="${color}" fill-opacity="0.8" stroke="black" stroke-width="17"
d="M182.9,551.7c0,0.1,0.2,0.3,0.2,0.3S358.3,283,358.3,194.6c0-130.1-88.8-186.7-175.4-186.9
C96.3,7.9,7.5,64.5,7.5,194.6c0,88.4,175.3,357.4,175.3,357.4S182.9,551.7,182.9,551.7z M122.2,187.2c0-33.6,27.2-60.8,60.8-60.8
c33.6,0,60.8,27.2,60.8,60.8S216.5,248,182.9,248C149.4,248,122.2,220.8,122.2,187.2z"/>
......@@ -488,21 +496,21 @@ function setMarker(type, color) {
//Init Map
var map = L.map('mapid').setView([48.856667, 2.351667], 5);
//Traditional
//Wikimedia
var Wikimedia = L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png', {
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>',
minZoom: 1,
//Minimal
//Carto DB No Labels
var CartoDB_PositronNoLabels = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>. Icons: <a href="https://thenounproject.com/">The Noun Project</a>',
subdomains: 'abcd',
minZoom:6,
maxZoom: 19
});
//Minimal
//Carto DB
var CartoDB_Positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
minZoom: 1,
//Traditional
//Wikimedia
var Wikimedia = L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png', {
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>. Icons: <a href="https://thenounproject.com/">The Noun Project</a>',
minZoom: 6,
maxZoom: 19
}).addTo(map);
......@@ -511,10 +519,10 @@ var franceLabel = overlayName("france", lang);
var hreLabel = overlayName("hrr", lang);
//Layer Groups
//Base Maps
//Base Maps Container
var baseMaps = {
"Wikimedia": Wikimedia,
"Carto DB" : CartoDB_Positron
"Wikimedia" : Wikimedia,
"Carto DB No Labels": CartoDB_PositronNoLabels
};
//Overlay Maps
......@@ -557,7 +565,7 @@ return d === "édifices domestiques" ? 'https://vwestric.github.io/paris-project
d === "constructions militaires" ? 'https://vwestric.github.io/paris-project/svg/military.svg' :
d === "édifices religieux" ? 'https://vwestric.github.io/paris-project/svg/spiritual.svg' :
d === "infrastructure" ? 'https://vwestric.github.io/paris-project/svg/bridge.svg' :
d === "édifices publiques" ? 'https://vwestric.github.io/paris-project/svg/public.svg' :
d === "édifices publics" ? 'https://vwestric.github.io/paris-project/svg/public.svg' :
d === "jardins" ? 'https://vwestric.github.io/paris-project/svg/garden.svg' :
d === "villes" ? 'https://vwestric.github.io/paris-project/svg/marker.svg' :
d === "autres" ? 'https://vwestric.github.io/paris-project/svg/circle.svg' :
......@@ -617,6 +625,11 @@ fetch('https://vwestric.github.io/paris-project/geojson/visitsEuropeGeolocated.g
.then(data => {
//Layer Group Cities for overlayMaps
//Base Group
var all = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filter:function(feature, layer) {
return feature.properties.visitor=="All";
}})]).addTo(map);
//Sturm Group
var sturm = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filter:function(feature, layer) {
return feature.properties.visitor=="Sturm";
......@@ -648,16 +661,17 @@ var harrach = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filte
}})]);
//Add Layer Group Travelogues to overlayMaps
overlayMaps["Sturm"] = sturm
overlayMaps["Knesebeck"] = knesebeck
overlayMaps["Corfey"] = corfey
overlayMaps[translation["baseLayer"][lang]] = all
overlayMaps["Pitzler"] = pitzler
overlayMaps["Neumann"] = neumann
overlayMaps["Harrach"] = harrach
overlayMaps["Corfey"] = corfey
overlayMaps["Knesebeck"] = knesebeck
overlayMaps["Sturm"] = sturm
overlayMaps["Neumann"] = neumann
//Add layer control to map
L.control.layers(baseMaps, overlayMaps).addTo(map);
L.control.layers(baseMaps, overlayMaps, {collapsed:false}).addTo(map);
});
......
......@@ -16,7 +16,7 @@ var translation = {
"military":"constructions militaires",
"religious":"édifices religieux",
"infrastructure":"infrastructure",
"public":"édifices publiques",
"public":"édifices publics",
"garden":"jardins",
"geographic":"villes",
"miscellaneous":"autres"
......@@ -33,6 +33,10 @@ var translation = {
"geographic":"Städte",
"miscellaneous":"Sonstige"
}
},
"baseLayer": {
"fra": "<b>Des endroits</b>",
"de": "<b>Orte</b>"
}
}
......@@ -40,11 +44,11 @@ var translation = {
//OnEachFeature Function
function onEachFeature(feature, layer) {
if (lang === "fra") {
layer.on('click', function() { openPlaceName('plc:'+feature.properties.id) });
layer.bindPopup(feature.properties.description.fra);
layer.setIcon(setMarker(feature.properties.type, feature.properties.color))
}
else if (lang === "de") {
layer.on('click', function() { openPlaceName('plc:'+feature.properties.id) });
layer.bindPopup(feature.properties.description.de);
layer.setIcon(setMarker(feature.properties.type, feature.properties.color))
}
}
......@@ -328,7 +332,7 @@ function setMarker(type, color) {
width="37.5562mm" height="17.7202mm"
viewBox="0 0 365 560">
<path id="Geographic"
fill="${color}" fill-opacity="0.8" stroke="black" stroke-width="7"
fill="${color}" fill-opacity="0.8" stroke="black" stroke-width="17"
d="M182.9,551.7c0,0.1,0.2,0.3,0.2,0.3S358.3,283,358.3,194.6c0-130.1-88.8-186.7-175.4-186.9
C96.3,7.9,7.5,64.5,7.5,194.6c0,88.4,175.3,357.4,175.3,357.4S182.9,551.7,182.9,551.7z M122.2,187.2c0-33.6,27.2-60.8,60.8-60.8
c33.6,0,60.8,27.2,60.8,60.8S216.5,248,182.9,248C149.4,248,122.2,220.8,122.2,187.2z"/>
......@@ -419,38 +423,61 @@ var map = L.map('mapid').setView([48.856667, 2.351667], 5);
//Minimal
//Carto DB No Labels
var CartoDB_PositronNoLabels = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>. Icons: <a href="https://thenounproject.com/">The Noun Project</a>',
subdomains: 'abcd',
minZoom: 12,
maxZoom: 19
});
//Traditional
//Carto DB
var CartoDB_Positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
minZoom: 12,
maxZoom: 19
//Wikimedia
var Wikimedia = L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png', {
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>. Icons: <a href="https://thenounproject.com/">The Noun Project</a>',
minZoom: 12,
maxZoom: 19
}).addTo(map);
//Layer Groups
//Base Maps Container
var baseMaps = {
"Carto DB" : CartoDB_Positron,
"Wikimedia" : Wikimedia,
"Carto DB No Labels": CartoDB_PositronNoLabels
};
//Overlay Maps Container
var overlayMaps = {
//Function to Define Overlay Name
function overlayNames(lang) {
if (lang==="fra") {
var overlayMaps = {
"Pitzler":"",
"Harrach":"",
"Corfey":"",
"Knesebeck":"",
"Sturm":"",
"Neumann":"",
"<b>Des endroits</b>":"",
"<b>Paris 1778</b>":""
};
return overlayMaps
}
else if (lang==="de"){
var overlayMaps = {
"Pitzler":"",
"Harrach":"",
"Corfey":"",
"Knesebeck":"",
"Sturm":"",
"Knesebeck":"",
"Corfey":"",
"Pitzler":"",
"Neumann":"",
"Harrach":"",
"<b>Paris 1778</b>":""
"Neumann":"",
"<b>Orte</b>":"",
"<b>Paris 1778</b>":""
};
return overlayMaps
}
}
//Overlay Maps Container
var overlayMaps = overlayNames(lang);
//Image Overlay
var imageUrl = 'https://vwestric.github.io/paris-project/raster/parisBW.png',
......@@ -480,7 +507,7 @@ return d === "édifices domestiques" ? 'https://vwestric.github.io/paris-project
d === "constructions militaires" ? 'https://vwestric.github.io/paris-project/svg/military.svg' :
d === "édifices religieux" ? 'https://vwestric.github.io/paris-project/svg/spiritual.svg' :
d === "infrastructure" ? 'https://vwestric.github.io/paris-project/svg/bridge.svg' :
d === "édifices publiques" ? 'https://vwestric.github.io/paris-project/svg/public.svg' :
d === "édifices publics" ? 'https://vwestric.github.io/paris-project/svg/public.svg' :
d === "jardins" ? 'https://vwestric.github.io/paris-project/svg/garden.svg' :
d === "villes" ? 'https://vwestric.github.io/paris-project/svg/marker.svg' :
d === "autres" ? 'https://vwestric.github.io/paris-project/svg/circle.svg' :
......@@ -540,6 +567,11 @@ fetch('https://vwestric.github.io/paris-project/geojson/visitsParisGeolocated.ge
.then(data => {
//Layer Group Cities for overlayMaps
//Base Group
var all = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filter:function(feature, layer) {
return feature.properties.visitor=="All";
}})]).addTo(map);
//Sturm Group
var sturm = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filter:function(feature, layer) {
return feature.properties.visitor=="Sturm";
......@@ -571,6 +603,7 @@ var harrach = L.layerGroup([L.geoJSON(data, {onEachFeature: onEachFeature, filte
}})]);
//Add Layer Group Travelogues to overlayMaps
overlayMaps[translation["baseLayer"][lang]] = all
overlayMaps["Sturm"] = sturm
overlayMaps["Knesebeck"] = knesebeck
overlayMaps["Corfey"] = corfey
......@@ -580,7 +613,7 @@ overlayMaps["Harrach"] = harrach
//Add layer control to map
L.control.layers(baseMaps, overlayMaps).addTo(map);
L.control.layers(baseMaps, overlayMaps, {collapsed:false}).addTo(map);
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment