Add more layers
This commit is contained in:
parent
3f512497be
commit
2b6f80e9c0
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,7 +1,8 @@
|
||||
*.qmd
|
||||
*.swp
|
||||
*.swo
|
||||
*.rar
|
||||
*.shp*
|
||||
*.log
|
||||
vendor/
|
||||
docs/
|
||||
docs/
|
||||
|
8
geojson/paesistici.geojson
Normal file
8
geojson/paesistici.geojson
Normal file
File diff suppressed because one or more lines are too long
32
geojson/siti.geojson
Normal file
32
geojson/siti.geojson
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"name": "siti",
|
||||
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
||||
"features": [
|
||||
{ "type": "Feature", "properties": { "Layer": "1", "PaperSpace": null, "SubClasses": null, "Linetype": null, "EntityHand": null, "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255510982332186, 40.549235083726821 ], [ 14.255488653309849, 40.549272340839408 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "463", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255708987991836, 40.549311248877281 ], [ 14.255631168506454, 40.549264776792882 ], [ 14.255635331027468, 40.54926072097922 ], [ 14.255607437590497, 40.549244063604718 ], [ 14.255607437590497, 40.549244063604718 ], [ 14.25560506706154, 40.549242747110455 ], [ 14.255602581917175, 40.549241559960151 ], [ 14.255599994264731, 40.549240507937476 ], [ 14.255597316711006, 40.549239596167787 ], [ 14.255594562300756, 40.549238829093113 ], [ 14.255591744453199, 40.549238210450596 ], [ 14.255588876896521, 40.549237743254139 ], [ 14.255585973601196, 40.549237429779879 ], [ 14.25558304871179, 40.549237271555072 ], [ 14.255580116478001, 40.549237269350549 ], [ 14.255577191185376, 40.549237423177047 ], [ 14.255574287085651, 40.549237732285135 ], [ 14.255571418327259, 40.549238195168897 ], [ 14.255568598886471, 40.549238809573176 ], [ 14.25556584249934, 40.549239572504703 ], [ 14.255563162594678, 40.54924048024651 ], [ 14.255560572228685, 40.549241528376236 ], [ 14.255558084021372, 40.549242711787429 ], [ 14.255555710094997, 40.549244024714696 ], [ 14.25555346201511, 40.549245460761568 ], [ 14.255551350734109, 40.549247012931765 ], [ 14.255549386537961, 40.549248673663307 ], [ 14.255547578996016, 40.549250434865264 ], [ 14.255545936914436, 40.549252287957259 ], [ 14.255544468293312, 40.549254223911227 ], [ 14.255543180287617, 40.549256233295345 ], [ 14.255542079172386, 40.549258306320191 ], [ 14.255541170312169, 40.549260432886136 ], [ 14.255540458134856, 40.549262602632801 ], [ 14.255539946110106, 40.549264804989392 ], [ 14.25553963673249, 40.549267029226243 ], [ 14.255539531509283, 40.549269264507096 ], [ 14.255539630953143, 40.549271499941909 ], [ 14.255539934579604, 40.54927372463986 ], [ 14.255540440909433, 40.549275927762437 ], [ 14.255541147475887, 40.549278098576217 ], [ 14.255542050836647, 40.549280226505282 ], [ 14.255543146590657, 40.549282301182529 ], [ 14.25554442939953, 40.549284312500305 ], [ 14.255545893013544, 40.549286250659719 ], [ 14.255547530302156, 40.549288106218185 ], [ 14.255549333288632, 40.549289870135667 ], [ 14.255551293189072, 40.549291533818533 ], [ 14.255553400454964, 40.549293089161388 ], [ 14.255555644819966, 40.549294528586834 ], [ 14.255583538264675, 40.549311185973764 ], [ 14.25558749441965, 40.549307331243043 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "464", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.25558749441965, 40.549307331243043 ], [ 14.255665313923252, 40.549353803356688 ], [ 14.255656477620489, 40.54936241313127 ], [ 14.25561537090053, 40.549337865105393 ], [ 14.255589752742631, 40.549362826482998 ], [ 14.255630859468212, 40.549387374517934 ], [ 14.255623503056553, 40.54939454233071 ], [ 14.255618030103978, 40.549391274005124 ], [ 14.255619929873589, 40.549389422940919 ], [ 14.255582340361805, 40.549366975305134 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "465", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255631168506454, 40.549264776792882 ], [ 14.255629169564248, 40.549263666663585 ], [ 14.255627073972921, 40.549262665603173 ], [ 14.255624891942036, 40.549261778488791 ], [ 14.255622634102142, 40.549261009642322 ], [ 14.255620311453258, 40.549260362809477 ], [ 14.255617935311033, 40.549259841141598 ], [ 14.255615517251819, 40.549259447180177 ], [ 14.255613069056162, 40.549259182844544 ], [ 14.255610602651345, 40.549259049422552 ], [ 14.255608130053506, 40.549259047564192 ], [ 14.255605663308803, 40.549259177278508 ], [ 14.255603214435029, 40.549259437933529 ], [ 14.255600795362794, 40.549259828259444 ], [ 14.255598417877534, 40.549260346354558 ], [ 14.255596093562168, 40.549260989694787 ], [ 14.255593833740484, 40.549261755145864 ], [ 14.25559164942209, 40.549262638978576 ], [ 14.255589551248766, 40.549263636886941 ], [ 14.255587549442611, 40.549264744009328 ], [ 14.255585653756196, 40.549265954951913 ], [ 14.255583873425142, 40.549267263815146 ], [ 14.255582217122996, 40.549268664222332 ], [ 14.255580692919109, 40.549270149350839 ], [ 14.255579308239286, 40.549271711965339 ], [ 14.255578069829509, 40.549273344452864 ], [ 14.255576983723238, 40.549275038860145 ], [ 14.255576055211824, 40.549276786932161 ], [ 14.255575288818955, 40.549278580152532 ], [ 14.255574688278429, 40.549280409784878 ], [ 14.255574256515967, 40.549282266915334 ], [ 14.255573995635141, 40.549284142496234 ], [ 14.255573906906928, 40.549286027389911 ], [ 14.255573990763626, 40.549287912413376 ], [ 14.2555742467967, 40.54928978838295 ], [ 14.255574673758813, 40.549291646159112 ], [ 14.255575269569833, 40.549293476690949 ], [ 14.255576031327081, 40.549295271060309 ], [ 14.255576955319357, 40.549297020525174 ], [ 14.255578037045014, 40.549298716562369 ], [ 14.255579271234094, 40.549300350908908 ], [ 14.255580651873695, 40.549301915602456 ], [ 14.255582172237506, 40.549303403019998 ], [ 14.255583824918451, 40.549304805914915 ], [ 14.255585601864887, 40.549306117452488 ], [ 14.255587494419675, 40.549307331243043 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "468", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255553271516195, 40.549245793703022 ], [ 14.255537646220104, 40.549236462586393 ], [ 14.255529014616336, 40.549244872899749 ], [ 14.255544639913142, 40.549254204017586 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "46A", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255665313923252, 40.549353803356688 ], [ 14.255708987991836, 40.549311248877281 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "46B", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255612154243854, 40.549405600186013 ], [ 14.255623503056553, 40.54939454233071 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "46C", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255630859468212, 40.549387374517934 ], [ 14.255656477620489, 40.54936241313127 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "475", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255626762903121, 40.549413801479737 ], [ 14.255642466515718, 40.549420918560592 ], [ 14.255628954964768, 40.549438265652178 ], [ 14.255655671427178, 40.549450373892086 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "476", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255619698850236, 40.549414655164583 ], [ 14.255636202848397, 40.549422134991708 ], [ 14.255624073884746, 40.549437707016963 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "477", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255661569034332, 40.549429576064739 ], [ 14.255677249012757, 40.549436682426197 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "492", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255732210501879, 40.549318335400756 ], [ 14.255730968665066, 40.549319665259596 ], [ 14.255726576255109, 40.54931970832375 ], [ 14.255721664522175, 40.549318819011241 ], [ 14.255708987991836, 40.549311248877281 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "494", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255579366635697, 40.549397696885201 ], [ 14.25558060866403, 40.549398280807587 ], [ 14.255578427648501, 40.549400980157763 ], [ 14.255594888429158, 40.549408718963342 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "495", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255777716389304, 40.549330386550281 ], [ 14.255773217351303, 40.549340248566558 ], [ 14.255771371229278, 40.549340223394736 ], [ 14.255770352684273, 40.5493401809902 ], [ 14.255768164195892, 40.549339068244706 ], [ 14.255767030101234, 40.549338297499453 ], [ 14.255767080241764, 40.549337596781086 ], [ 14.255773695568259, 40.549323095803175 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4F7", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.2555771222281, 40.549273601797758 ], [ 14.255561668768879, 40.549264373307615 ], [ 14.255564584770951, 40.549261532062744 ], [ 14.255557983779878, 40.549257590084423 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4F8", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.25556198329668, 40.549253693102621 ], [ 14.2555685842876, 40.549257635080721 ], [ 14.255570300371119, 40.549255962991801 ], [ 14.255585753829628, 40.549265191480806 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4F9", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255506792588545, 40.549233622646895 ], [ 14.255510982332186, 40.549235083726821 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4FB", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255503362691531, 40.549235421258508 ], [ 14.255509497802308, 40.549237560742021 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4FC", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255501099485205, 40.549237626727624 ], [ 14.255508013272328, 40.549240037757258 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4FD", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255499366152469, 40.549240016978416 ], [ 14.255506528742247, 40.549242514772494 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4FE", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255496987489439, 40.549242182184564 ], [ 14.25550504421204, 40.54924499178766 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "4FF", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255529005163371, 40.549244867254664 ], [ 14.255537636767162, 40.549236456941273 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "500", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255531902253102, 40.549246597339632 ], [ 14.255540533856742, 40.549238187026042 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "501", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255534954987118, 40.549248420372095 ], [ 14.255543586590603, 40.549240010058298 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "503", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255660841133986, 40.549358161481521 ], [ 14.255675977384023, 40.549367200507447 ], [ 14.255677835022935, 40.549365289006957 ], [ 14.255677859154034, 40.549363110333836 ], [ 14.255677990456517, 40.549361373495444 ], [ 14.255665313923252, 40.549353803356688 ] ] ] } }
|
||||
]
|
||||
}
|
@ -13,14 +13,19 @@ const BASE_URL = location.href;
|
||||
* @returns {Map}
|
||||
*/
|
||||
GIS.initMap = async function (mapId, zoomLevel = 15) {
|
||||
let layerSiti = await this.loadLayer('siti.geojson', '#800040');
|
||||
let layerVincoli = await this.loadLayer('vincoli.geojson');
|
||||
// TODO named parameters??
|
||||
let layerPaesistici = await this.loadLayer('paesistici.geojson', '#222', '#ff8000');
|
||||
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxNativeZoom : 22,
|
||||
maxZoom: 22,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
});
|
||||
let map = L.map(mapId, {
|
||||
attributionControl: false,
|
||||
minZoom: 11,
|
||||
layers: [osmap, layerVincoli]
|
||||
layers: [osmap, layerVincoli, layerSiti, layerPaesistici]
|
||||
}).setView([40.5492, 14.2317], zoomLevel);
|
||||
|
||||
map.crs = L.CRS.EPSG4326;
|
||||
@ -28,11 +33,13 @@ GIS.initMap = async function (mapId, zoomLevel = 15) {
|
||||
const baseMap = {
|
||||
"Mappa di base (OpenStreetMap)" : osmap
|
||||
};
|
||||
const archeoConstraints = {
|
||||
"Vincoli archeologici" : layerVincoli
|
||||
const archeo = {
|
||||
"Siti indagati" : layerSiti,
|
||||
"Vincoli archeologici" : layerVincoli,
|
||||
"Vincoli paesistici" : layerPaesistici,
|
||||
};
|
||||
|
||||
let layerControl = L.control.layers(baseMap, archeoConstraints).addTo(map);
|
||||
let layerControl = L.control.layers(baseMap, archeo).addTo(map);
|
||||
|
||||
//DEBUG
|
||||
// Il sistema di riferimento per i livelli geoJSON è EPSG3857
|
||||
@ -42,7 +49,7 @@ GIS.initMap = async function (mapId, zoomLevel = 15) {
|
||||
* @param {string} geoJSON
|
||||
* @param {Map} map
|
||||
*/
|
||||
GIS.loadLayer = async function (geoJSON, color = '#987db7') {
|
||||
GIS.loadLayer = async function (geoJSON, color = '#222', fillColor = '#987db7') {
|
||||
const data = await fetch(`${BASE_URL}/geojson/${geoJSON}`)
|
||||
.then(res => res.json())
|
||||
.catch(error => console.error(`Can't load layer ${geoJSON}. Reason: ${error}`));
|
||||
@ -54,10 +61,10 @@ GIS.loadLayer = async function (geoJSON, color = '#987db7') {
|
||||
const layer = new L.geoJson(data, {
|
||||
style: function (feature) {
|
||||
let style = {
|
||||
color: '#222',
|
||||
color: color,
|
||||
opacity: 0.8,
|
||||
weight: 1,
|
||||
fillColor: color,
|
||||
fillColor: fillColor,
|
||||
fillOpacity: 0.8
|
||||
};
|
||||
return style;
|
||||
@ -87,6 +94,14 @@ GIS.featurePopup = function (layerName, feature) {
|
||||
<tr><td class="text-bold">Proprietà</td><td>${feature.properties.PROPRIETA}</td></tr>
|
||||
</table>
|
||||
`,
|
||||
'paesistici.geojson' : `
|
||||
<table class="table m-2">
|
||||
<tr><td class="text-bold">Oggetto</td><td>${feature.properties.OGGETTO}</td></tr>
|
||||
<tr><td class="text-bold">Anno</td><td>${feature.properties.ANNO}</td></tr>
|
||||
<tr><td class="text-bold">Comune</td><td>${feature.properties.COMUNE}</td></tr>
|
||||
<tr><td class="text-bold">Proprietà</td><td>${feature.properties.PROPRIETA}</td></tr>
|
||||
</table>
|
||||
`,
|
||||
};
|
||||
|
||||
return content[layerName];
|
||||
|
Loading…
Reference in New Issue
Block a user