mapicgc-gl-js 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/mapicgc-gl.css +59 -5
- package/dist/mapicgc-gl.js +1873 -138
- package/dist/mapicgc-gl.umd.js +1873 -138
- package/docu_Map.md +0 -0
- package/exemples/compare.html +6 -39
- package/exemples/orto3d.html +115 -0
- package/nodeDeploy.js +3 -2
- package/nodeSetConfig.js +25 -17
- package/package.json +11 -5
- package/public/mapicgc-gl.css +59 -5
- package/src/config.js +94 -71
- package/src/configNode.js +94 -71
- package/src/constants/Layers.js +23 -22
- package/src/constants/Styles.js +2 -1
- package/src/constants/Terrains.js +2 -2
- package/src/map/Map.js +260 -106
- package/test/Proposa_DAC_min.geojson +2639 -34115
- package/test/index.html +14 -5
- package/vite.config.mjs +4 -0
package/src/map/Map.js
CHANGED
|
@@ -2,6 +2,10 @@ import maplibregl from "maplibre-gl";
|
|
|
2
2
|
// import flatgeobuf from "flatgeobuf";
|
|
3
3
|
import Pitch3DToggleControl from "../controls/Toggle3DControl.js";
|
|
4
4
|
// import MeasuresControl from 'maplibre-gl-measures';
|
|
5
|
+
import { MapboxLayer } from "@deck.gl/mapbox";
|
|
6
|
+
import { Tile3DLayer } from "@deck.gl/geo-layers";
|
|
7
|
+
import { Tiles3DLoader } from "@loaders.gl/3d-tiles";
|
|
8
|
+
import { AmbientLight, LightingEffect } from "@deck.gl/core";
|
|
5
9
|
import {
|
|
6
10
|
MaplibreExportControl,
|
|
7
11
|
Size,
|
|
@@ -52,8 +56,8 @@ export default class Map {
|
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
options.maxZoom = 18;
|
|
59
|
+
|
|
60
|
+
// options.maxZoom = 18;
|
|
57
61
|
options.maxPitch = 85;
|
|
58
62
|
options.maplibreLogo = false;
|
|
59
63
|
options.attributionControl = false;
|
|
@@ -66,6 +70,99 @@ export default class Map {
|
|
|
66
70
|
compact: true,
|
|
67
71
|
})
|
|
68
72
|
);
|
|
73
|
+
|
|
74
|
+
this.map.on("load", () => {
|
|
75
|
+
// console.log('sss', this.map.getStyle().name)
|
|
76
|
+
|
|
77
|
+
if (window.document.querySelector(".maplibregl-compact-show")) {
|
|
78
|
+
var element = window.document.querySelector(".maplibregl-compact-show");
|
|
79
|
+
element.classList.remove("maplibregl-compact-show");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this._dealOrto3dStyle(this.map.getStyle().name);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_dealOrto3dStyle(name) {
|
|
87
|
+
try {
|
|
88
|
+
if (name == "orto3d") {
|
|
89
|
+
// console.log('entro', name)
|
|
90
|
+
const ambientLight = new AmbientLight({
|
|
91
|
+
intensity: 4,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const lightingEffect = new LightingEffect({
|
|
95
|
+
ambientLight,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
this.map.setTerrain({
|
|
99
|
+
source: defaultOptions.map3dOptions.terrainSource,
|
|
100
|
+
exaggeration: 1,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const citiesMapboxLayer = this._createCitiesMapboxLayer();
|
|
104
|
+
|
|
105
|
+
if (!this.map.getLayer(defaultOptions.map3dOptions.layerId3d)) {
|
|
106
|
+
this.map.addLayer(
|
|
107
|
+
citiesMapboxLayer,
|
|
108
|
+
defaultOptions.map3dOptions.layerIdOrder
|
|
109
|
+
);
|
|
110
|
+
this.map.setLayerZoomRange(
|
|
111
|
+
defaultOptions.map3dOptions.layerId3d,
|
|
112
|
+
defaultOptions.map3dOptions.minZoomRange,
|
|
113
|
+
defaultOptions.map3dOptions.maxZoomRange
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
citiesMapboxLayer.deck.setProps({
|
|
117
|
+
effects: [lightingEffect],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (this.map.getLayer(defaultOptions.map3dOptions.layerId3d)) {
|
|
122
|
+
this.map.removeLayer(defaultOptions.map3dOptions.layerId3d);
|
|
123
|
+
|
|
124
|
+
this.map.setTerrain(null);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error(`Error dealing orto 3D: ${error.message}`);
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
_createCitiesMapboxLayer() {
|
|
134
|
+
try {
|
|
135
|
+
const citiesMapboxLayer = new MapboxLayer({
|
|
136
|
+
id: defaultOptions.map3dOptions.layerId3d,
|
|
137
|
+
type: Tile3DLayer,
|
|
138
|
+
data: defaultOptions.map3dOptions.urlTilesetCities,
|
|
139
|
+
loader: Tiles3DLoader,
|
|
140
|
+
|
|
141
|
+
loadOptions: {
|
|
142
|
+
tileset: {
|
|
143
|
+
viewDistanceScale: 1,
|
|
144
|
+
updateTransforms: false,
|
|
145
|
+
maximumScreenSpaceError:
|
|
146
|
+
defaultOptions.map3dOptions.spaceErrorFactor,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
onTilesetLoad: (tileset3d) => {
|
|
151
|
+
tileset3d.options.maximumScreenSpaceError =
|
|
152
|
+
defaultOptions.map3dOptions.spaceErrorFactor;
|
|
153
|
+
},
|
|
154
|
+
onTileLoad: (tileHeader) => {
|
|
155
|
+
tileHeader.content.cartographicOrigin.z -=
|
|
156
|
+
defaultOptions.map3dOptions.zfactor;
|
|
157
|
+
},
|
|
158
|
+
operation: "terrain+draw",
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return citiesMapboxLayer;
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error(`Error adding MapboxLayer: ${error.message}`);
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
69
166
|
}
|
|
70
167
|
|
|
71
168
|
/**
|
|
@@ -274,7 +371,6 @@ inputsearch[0].addEventListener('input', function(event) {
|
|
|
274
371
|
* @param {string} name - The geometry name (e.g., 'buildings').
|
|
275
372
|
* @param {Object} options - Additional options for configuring the layer.
|
|
276
373
|
*/
|
|
277
|
-
|
|
278
374
|
async fetchData(url, name, options) {
|
|
279
375
|
try {
|
|
280
376
|
const response = await fetch(url);
|
|
@@ -401,6 +497,28 @@ inputsearch[0].addEventListener('input', function(event) {
|
|
|
401
497
|
const response = await fetch(url);
|
|
402
498
|
const geojson = await response.json();
|
|
403
499
|
|
|
500
|
+
const menuGroup = document.getElementById("menu-group");
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
if (featureTree !== 'all'){
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
const nameTitle = document.createElement("div");
|
|
508
|
+
nameTitle.id = "titleDivMenu"
|
|
509
|
+
nameTitle.textContent = name;
|
|
510
|
+
menuGroup.appendChild(nameTitle);
|
|
511
|
+
|
|
512
|
+
const featureTreeTitle = document.createElement("div");
|
|
513
|
+
featureTreeTitle.id = "titleDivMenuSub"
|
|
514
|
+
featureTreeTitle.textContent = `📂 ${featureTree}`;
|
|
515
|
+
menuGroup.appendChild(featureTreeTitle);
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
}else{
|
|
519
|
+
|
|
520
|
+
}
|
|
521
|
+
|
|
404
522
|
let type = geojson.features[0].geometry.type;
|
|
405
523
|
|
|
406
524
|
if ( featureTree === 'all'){
|
|
@@ -508,21 +626,21 @@ if ( featureTree === 'all'){
|
|
|
508
626
|
}
|
|
509
627
|
// geojsonStore = geojson
|
|
510
628
|
// map.addLayerTree(geojson);
|
|
511
|
-
map.addMenuItem(name);
|
|
512
629
|
|
|
630
|
+
map.addMenuItem(name);
|
|
631
|
+
map.addFeatureQuery(name)
|
|
513
632
|
}else{
|
|
514
633
|
|
|
515
634
|
let field= featureTree
|
|
516
|
-
// console.log('field', field, geojson.features)
|
|
517
635
|
|
|
518
|
-
// let lll = geojson.features
|
|
519
636
|
const layers = {};
|
|
520
637
|
geojson.features.forEach(feature => {
|
|
521
638
|
const fieldMarker = feature.properties[field];
|
|
522
|
-
|
|
523
|
-
|
|
639
|
+
// aqui podriem mirar si te simbologia i afegir-la a la capa
|
|
640
|
+
|
|
641
|
+
|
|
524
642
|
if (!layers[fieldMarker]) {
|
|
525
|
-
|
|
643
|
+
|
|
526
644
|
if (type.includes("ine")) {
|
|
527
645
|
//line
|
|
528
646
|
if (options !== undefined){
|
|
@@ -632,7 +750,6 @@ geojson.features.forEach(feature => {
|
|
|
632
750
|
}
|
|
633
751
|
}
|
|
634
752
|
|
|
635
|
-
// Agregar la nueva capa al objeto de capas
|
|
636
753
|
layers[fieldMarker] = true;
|
|
637
754
|
map.addMenuItem(fieldMarker);
|
|
638
755
|
}
|
|
@@ -641,78 +758,68 @@ geojson.features.forEach(feature => {
|
|
|
641
758
|
|
|
642
759
|
}
|
|
643
760
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
//add feature queries
|
|
653
|
-
// map.addFeatureQuery(name);
|
|
654
761
|
} catch (error) {
|
|
655
762
|
console.error(`Error fetching data: ${error.message}`);
|
|
656
763
|
}
|
|
657
764
|
}
|
|
658
765
|
|
|
659
|
-
async geocodeAddress() {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
async fetchDataWithSearchbox(url, type, name, optionsGeo, options) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
766
|
+
// async geocodeAddress() {
|
|
767
|
+
// try {
|
|
768
|
+
// var inputElement = document.getElementById("addressInput");
|
|
769
|
+
// var address = inputElement.value;
|
|
770
|
+
// const response = await fetch(url);
|
|
771
|
+
// const geojson = await response.json();
|
|
772
|
+
// var resultsContainer = document.getElementById("results");
|
|
773
|
+
// resultsContainer.innerHTML = ""; // Limpiar resultados anteriores
|
|
774
|
+
|
|
775
|
+
// function geocode(address) {
|
|
776
|
+
// var result = turf.filter(geojson, "address", address);
|
|
777
|
+
// return result.features.slice(0, 5);
|
|
778
|
+
// }
|
|
779
|
+
|
|
780
|
+
// var results = geocode(address);
|
|
781
|
+
|
|
782
|
+
// if (results.length > 0) {
|
|
783
|
+
// results.forEach(function (feature) {
|
|
784
|
+
// var coordinates = feature.geometry.coordinates;
|
|
785
|
+
// var address = feature.properties.address;
|
|
786
|
+
|
|
787
|
+
// var resultItem = document.createElement("div");
|
|
788
|
+
// resultItem.innerHTML =
|
|
789
|
+
// "<strong>" +
|
|
790
|
+
// address +
|
|
791
|
+
// "</strong><br>Coordenadas: " +
|
|
792
|
+
// coordinates.join(", ");
|
|
793
|
+
|
|
794
|
+
// resultsContainer.appendChild(resultItem);
|
|
795
|
+
// });
|
|
796
|
+
// } else {
|
|
797
|
+
// resultsContainer.innerHTML =
|
|
798
|
+
// "No se encontraron resultados para la dirección: " + address;
|
|
799
|
+
// }
|
|
800
|
+
// } catch (error) {}
|
|
801
|
+
// }
|
|
802
|
+
// /**
|
|
803
|
+
// * Fetches GeoJSON data from a URL and adds a corresponding layer to the map based on the specified geometry type.
|
|
804
|
+
// * @param {string} url - The URL to fetch GeoJSON data from.
|
|
805
|
+
// * @param {string} type - The geometry type (e.g., 'line', 'polygon', 'point').
|
|
806
|
+
// * @param {string} name - The geometry name (e.g., 'buildings').
|
|
807
|
+
// * @param {Object} options - Additional options for configuring the layer.
|
|
808
|
+
// */
|
|
809
|
+
|
|
810
|
+
// async fetchDataWithSearchbox(url, type, name, optionsGeo, options) {
|
|
811
|
+
// try {
|
|
812
|
+
// const response = await fetch(url);
|
|
813
|
+
// const geojson = await response.json();
|
|
814
|
+
|
|
815
|
+
// function geocode(address) {
|
|
816
|
+
// var result = turf.filter(geojson, "address", address);
|
|
817
|
+
// return result.features.slice(0, 5);
|
|
818
|
+
// }
|
|
819
|
+
// } catch (error) {
|
|
820
|
+
// console.error(`Error fetching data: ${error.message}`);
|
|
821
|
+
// }
|
|
822
|
+
// }
|
|
716
823
|
|
|
717
824
|
/**
|
|
718
825
|
* Adds an event listener to the map.
|
|
@@ -763,6 +870,7 @@ geojson.features.forEach(feature => {
|
|
|
763
870
|
setStyle(style, options) {
|
|
764
871
|
try {
|
|
765
872
|
console.log("kk", style);
|
|
873
|
+
/*
|
|
766
874
|
for (const key of Styles) {
|
|
767
875
|
if (Styles.hasOwnProperty(key)) {
|
|
768
876
|
const styl = Styles[key];
|
|
@@ -772,6 +880,7 @@ geojson.features.forEach(feature => {
|
|
|
772
880
|
}
|
|
773
881
|
}
|
|
774
882
|
}
|
|
883
|
+
*/
|
|
775
884
|
console.log("base", style);
|
|
776
885
|
|
|
777
886
|
if (options !== undefined) {
|
|
@@ -779,6 +888,20 @@ geojson.features.forEach(feature => {
|
|
|
779
888
|
} else {
|
|
780
889
|
this.map.setStyle(style);
|
|
781
890
|
}
|
|
891
|
+
|
|
892
|
+
this.map.on("styledata", () => {
|
|
893
|
+
if (window.document.querySelector(".maplibregl-compact-show")) {
|
|
894
|
+
var element = window.document.querySelector(
|
|
895
|
+
".maplibregl-compact-show"
|
|
896
|
+
);
|
|
897
|
+
element.classList.remove("maplibregl-compact-show");
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
this._dealOrto3dStyle(this.map.getStyle().name);
|
|
901
|
+
//init test3d
|
|
902
|
+
|
|
903
|
+
//end test 3d
|
|
904
|
+
});
|
|
782
905
|
} catch (error) {
|
|
783
906
|
console.error(`Error setting style: ${error.message}`);
|
|
784
907
|
}
|
|
@@ -813,15 +936,33 @@ geojson.features.forEach(feature => {
|
|
|
813
936
|
/**
|
|
814
937
|
* Sets layout property for a layer on the map.
|
|
815
938
|
* @function setLayoutProperty
|
|
816
|
-
* @param {Object} object - Object containing layer ID
|
|
939
|
+
* @param {Object} object - Object containing layer ID.
|
|
940
|
+
* @param {Object} property - Object containing property to set.
|
|
941
|
+
* @param {Object} value - Object containing value.
|
|
817
942
|
*/
|
|
818
|
-
setLayoutProperty(object) {
|
|
943
|
+
setLayoutProperty(object, property, value) {
|
|
819
944
|
try {
|
|
820
|
-
this.map.setLayoutProperty(object);
|
|
945
|
+
this.map.setLayoutProperty(object, property, value);
|
|
821
946
|
} catch (error) {
|
|
822
947
|
console.error(`Error setting layout property: ${error.message}`);
|
|
823
948
|
}
|
|
824
949
|
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Sets layout property for a layer on the map.
|
|
953
|
+
* @function setPaintProperty
|
|
954
|
+
* @param {Object} object - Object containing layer ID.
|
|
955
|
+
* @param {Object} property - Object containing property to set.
|
|
956
|
+
* @param {Object} value - Object containing value.
|
|
957
|
+
*/
|
|
958
|
+
setPaintProperty(object, property, value) {
|
|
959
|
+
try {
|
|
960
|
+
this.map.setPaintProperty(object, property, value);
|
|
961
|
+
} catch (error) {
|
|
962
|
+
console.error(`Error setting paint property: ${error.message}`);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
825
966
|
/**
|
|
826
967
|
* Adds a control to the map with the specified position.
|
|
827
968
|
* @function addControl
|
|
@@ -940,14 +1081,21 @@ geojson.features.forEach(feature => {
|
|
|
940
1081
|
*/
|
|
941
1082
|
setTerrain(options) {
|
|
942
1083
|
try {
|
|
943
|
-
this.map.on("load", () => {
|
|
944
|
-
|
|
945
|
-
});
|
|
1084
|
+
//this.map.on("load", () => {
|
|
1085
|
+
return this.map.setTerrain(options);
|
|
1086
|
+
//});
|
|
946
1087
|
// this.map.getZoom();
|
|
947
1088
|
} catch (error) {
|
|
948
1089
|
console.error(`Error setting terrain: ${error.message}`);
|
|
949
1090
|
}
|
|
950
1091
|
}
|
|
1092
|
+
setLayerZoomRange(layerId, nimZoom, maxZoom) {
|
|
1093
|
+
try {
|
|
1094
|
+
return this.map.setLayerZoomRange(layerId, nimZoom, maxZoom);
|
|
1095
|
+
} catch (error) {
|
|
1096
|
+
console.error(`Error setting terrain: ${error.message}`);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
951
1099
|
|
|
952
1100
|
/**
|
|
953
1101
|
* Retrieves the canvas of the map.
|
|
@@ -978,10 +1126,11 @@ geojson.features.forEach(feature => {
|
|
|
978
1126
|
* Adds a layer to the map.
|
|
979
1127
|
* @function addLayer
|
|
980
1128
|
* @param {Object} layer - Options for the layer to add.
|
|
1129
|
+
* @param {string} layerIdOrder - Optional layer Id draw position.
|
|
981
1130
|
*/
|
|
982
|
-
addLayer(layer) {
|
|
1131
|
+
addLayer(layer, layerIdOrder) {
|
|
983
1132
|
try {
|
|
984
|
-
this.map.addLayer(layer);
|
|
1133
|
+
this.map.addLayer(layer, layerIdOrder);
|
|
985
1134
|
} catch (error) {
|
|
986
1135
|
console.error(`Error adding layer: ${error.message}`);
|
|
987
1136
|
}
|
|
@@ -1115,7 +1264,7 @@ geojson.features.forEach(feature => {
|
|
|
1115
1264
|
/**
|
|
1116
1265
|
* Adds base layers to the map.
|
|
1117
1266
|
* @function addBasemapsICGC
|
|
1118
|
-
* @param {Object[]}
|
|
1267
|
+
* @param {Object[]} basesArray - Array of base layer objects.
|
|
1119
1268
|
*/
|
|
1120
1269
|
addBasemapsICGC(basesArray) {
|
|
1121
1270
|
try {
|
|
@@ -1570,6 +1719,7 @@ geojson.features.forEach(feature => {
|
|
|
1570
1719
|
/**
|
|
1571
1720
|
* Adds a fullscreen control to the map.
|
|
1572
1721
|
* @function addFullScreen
|
|
1722
|
+
* @param {string} [position='top-right'] - Position to add the control on the map.
|
|
1573
1723
|
*/
|
|
1574
1724
|
addFullScreen(position) {
|
|
1575
1725
|
try {
|
|
@@ -1589,7 +1739,6 @@ geojson.features.forEach(feature => {
|
|
|
1589
1739
|
*/
|
|
1590
1740
|
addMenuItem(name) {
|
|
1591
1741
|
try {
|
|
1592
|
-
if (name.length > 0){
|
|
1593
1742
|
const menuGroup = document.getElementById("menu-group");
|
|
1594
1743
|
|
|
1595
1744
|
const input = document.createElement("input");
|
|
@@ -1612,7 +1761,6 @@ geojson.features.forEach(feature => {
|
|
|
1612
1761
|
e.target.checked ? "visible" : "none"
|
|
1613
1762
|
);
|
|
1614
1763
|
});
|
|
1615
|
-
}
|
|
1616
1764
|
} catch (error) {
|
|
1617
1765
|
console.error(`Error adding menu item: ${error.message}`);
|
|
1618
1766
|
}
|
|
@@ -1772,8 +1920,7 @@ geojson.features.forEach(feature => {
|
|
|
1772
1920
|
* Adds an ICGC image layer to the map based on the specified name and year.
|
|
1773
1921
|
* @function addImageLayerICGC
|
|
1774
1922
|
* @param {string} name - The name of the layer. Mandatory. options: 'orto', 'geo', 'slope', 'dem', 'relleu', etc.
|
|
1775
|
-
|
|
1776
|
-
*/
|
|
1923
|
+
*/
|
|
1777
1924
|
addImageLayerICGC(name) {
|
|
1778
1925
|
try {
|
|
1779
1926
|
console.log("name", name);
|
|
@@ -1863,9 +2010,8 @@ geojson.features.forEach(feature => {
|
|
|
1863
2010
|
* Adds an ICGC vector layer to the map based on the specified name and year.
|
|
1864
2011
|
* @function addVectorLayerICGC
|
|
1865
2012
|
* @param {string} url - The url of the vector layer.
|
|
1866
|
-
* @param {string} year - The year associated with the vector layer (optional).
|
|
1867
2013
|
*/
|
|
1868
|
-
async addVectorLayerICGC(layerUrl
|
|
2014
|
+
async addVectorLayerICGC(layerUrl) {
|
|
1869
2015
|
try {
|
|
1870
2016
|
function getKeyByUrl(url) {
|
|
1871
2017
|
for (const key in Layers.VectorAdmin) {
|
|
@@ -1949,6 +2095,7 @@ geojson.features.forEach(feature => {
|
|
|
1949
2095
|
// let op = Terrains.find(
|
|
1950
2096
|
// (objeto) => objeto.name === resolution
|
|
1951
2097
|
// );
|
|
2098
|
+
// console.log('res', resolution)
|
|
1952
2099
|
let op;
|
|
1953
2100
|
for (const key in Terrains) {
|
|
1954
2101
|
if (Terrains.hasOwnProperty(key)) {
|
|
@@ -1956,26 +2103,33 @@ geojson.features.forEach(feature => {
|
|
|
1956
2103
|
|
|
1957
2104
|
if (objeto === resolution) {
|
|
1958
2105
|
op = objeto;
|
|
1959
|
-
|
|
2106
|
+
|
|
1960
2107
|
}
|
|
1961
2108
|
}
|
|
1962
2109
|
}
|
|
1963
2110
|
|
|
1964
2111
|
let urlTerrainICGC = op;
|
|
2112
|
+
if (resolution.includes('terrarium') ){
|
|
2113
|
+
// console.log('rsssssses', resolution)
|
|
2114
|
+
// Add terrain source
|
|
2115
|
+
this.map.addSource("terrainICGC-src", {
|
|
2116
|
+
type: "raster-dem",
|
|
2117
|
+
tiles: [urlTerrainICGC],
|
|
2118
|
+
tileSize: 512,
|
|
2119
|
+
encoding: "terrarium",
|
|
2120
|
+
maxzoom: 16,
|
|
2121
|
+
});
|
|
2122
|
+
}else{
|
|
2123
|
+
this.map.addSource("terrainICGC-src", {
|
|
2124
|
+
type: "raster-dem",
|
|
2125
|
+
tiles: [urlTerrainICGC],
|
|
2126
|
+
tileSize: 512,
|
|
2127
|
+
maxzoom: 16,
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
|
|
1965
2131
|
|
|
1966
|
-
|
|
1967
|
-
this.map.addSource("terrainICGC-src", {
|
|
1968
|
-
type: "raster-dem",
|
|
1969
|
-
tiles: [urlTerrainICGC],
|
|
1970
|
-
tileSize: 512,
|
|
1971
|
-
maxzoom: 16,
|
|
1972
|
-
});
|
|
1973
|
-
|
|
1974
|
-
// Add terrain layer
|
|
1975
|
-
// this.map.setTerrain({
|
|
1976
|
-
// source: "terrainMapZen",
|
|
1977
|
-
// exaggeration: 1.5,
|
|
1978
|
-
// });
|
|
2132
|
+
|
|
1979
2133
|
this.map.setTerrain({
|
|
1980
2134
|
source: "terrainICGC-src",
|
|
1981
2135
|
exaggeration: 1.5,
|