Search adjustments + building techs
This commit is contained in:
@@ -74,6 +74,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
|
||||
await this.addLayerGroups(map);
|
||||
await this.fetchCartographyLayers();
|
||||
const buildingTechs = await this.buildingTechs();
|
||||
|
||||
const reprojectedWMSLayer = GIS.reprojectWMS();
|
||||
const wmsLayer = new reprojectedWMSLayer(
|
||||
@@ -94,6 +95,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
'Fabbricati' : buildings,
|
||||
'Vincoli archeologici' : layerVincoli,
|
||||
'Vincoli archeologici indiretti' : layerPaesistici,
|
||||
'Tecniche murarie' : buildingTechs,
|
||||
};
|
||||
L.control.layers(baseMap, cartography).addTo(map);
|
||||
|
||||
@@ -114,6 +116,35 @@ GIS.fetchCartographyLayers = async function () {
|
||||
GisState.cartography.historic.push({id, label});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create building techs layer
|
||||
* @returns {L.Layer}
|
||||
*/
|
||||
GIS.buildingTechs = async function () {
|
||||
let techsData = await fetch(`${API_URL}/building_techs`)
|
||||
.then(data => data.json());
|
||||
|
||||
let techs = new L.LayerGroup();
|
||||
|
||||
for (let record of techsData) {
|
||||
const marker = L.marker(
|
||||
record.coordinates,
|
||||
{icon: Icons.techs, label: record.technique}
|
||||
)
|
||||
.bindTooltip(record.technique)
|
||||
.bindPopup(UI.createBuildingTechTable(record));
|
||||
|
||||
techs.addLayer(marker);
|
||||
const markerLabel = `${record.coordinates[0]} ${record.coordinates[1]}`;
|
||||
marker.options.data = record;
|
||||
marker.options.site = record.site.label;
|
||||
GisState.markers.buildingTechs[markerLabel] = marker;
|
||||
}
|
||||
|
||||
GisState.layers.buildingTechs = techs;
|
||||
|
||||
return techs;
|
||||
}
|
||||
/**
|
||||
* Load georeferenced image overlays layer group
|
||||
* @param {Number} imageId - The API id of the georeferenced image
|
||||
|
||||
Reference in New Issue
Block a user