mapicgc-gl-js 1.0.6 → 1.0.7

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.
@@ -2,6 +2,8 @@
2
2
  const Orto = {
3
3
  ortofotoColorProvisional: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_provisional",
4
4
  ortofotoColorVigent: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_vigent",
5
+ ortofotoColor2025: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_2025",
6
+ ortofotoColor2024: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_2024",
5
7
  ortofotoColor2023: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_2023",
6
8
  ortofotoColor2022: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_2022",
7
9
  ortofotoColor2021: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_2021",
@@ -31,6 +33,8 @@ ortofotoBlancINegre1945: "https://geoserveis.icgc.cat/servei/catalunya/orto-terr
31
33
  ortofotoColorSerieAnual: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_color_serie_anual",
32
34
  ortofotoInfraroigProvisional: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_provisional",
33
35
  ortofotoInfraroigVigent: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_vigent",
36
+ ortofotoInfraroig2025: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2025",
37
+ ortofotoInfraroig2024: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2024",
34
38
  ortofotoInfraroig2023: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2023",
35
39
  ortofotoInfraroig2022: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2022",
36
40
  ortofotoInfraroig2021: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2021",
@@ -47,7 +51,7 @@ ortofotoInfraroig2011: "https://geoserveis.icgc.cat/servei/catalunya/orto-territ
47
51
  ortofotoInfraroig2010: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2010",
48
52
  ortofotoInfraroig2009: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2009",
49
53
  ortofotoInfraroig2008: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2008",
50
- ortofotoInfraroig20062007: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2006-2007",
54
+ ortofotoInfraroig2007: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_2007",
51
55
  ortofotoInfraroig19961997: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_1996-1997",
52
56
  ortofotoInfraroigSerieAnual: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_infraroig_serie_anual",
53
57
  ortofotoGrisVigent: "https://geoserveis.icgc.cat/servei/catalunya/orto-territorial/wms?&bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&STYLES=&srs=EPSG:3857&transparent=true&width=256&height=256&layers=ortofoto_gris_vigent",
@@ -60,6 +64,10 @@ agrupacionsCensals2018: "agrupacions_censals_2018",
60
64
  agrupacionsCensals2019: "agrupacions_censals_2019",
61
65
  agrupacionsCensals2020: "agrupacions_censals_2020",
62
66
  agrupacionsCensals2021: "agrupacions_censals_2021",
67
+ agrupacionsCensals2022: "agrupacions_censals_2022",
68
+ agrupacionsCensals2023: "agrupacions_censals_2023",
69
+ agrupacionsCensals2024: "agrupacions_censals_2024",
70
+ agrupacionsCensals2025: "agrupacions_censals_2025",
63
71
  agrupacionsCensalsVigent: "agrupacions_censals_vigent",
64
72
  agrupacionsCensalsVigentText: "agrupacions_censals_vigent_text",
65
73
  areesBasiquesPolicials2019: "arees_basiques_policials_2019",
@@ -70,15 +78,20 @@ areesBasiquesPolicials2023Text: "arees_basiques_policials_2023_text",
70
78
  areesBasiquesPolicialsVigent: "arees_basiques_policials_vigent",
71
79
  areesBasiquesPolicialsVigent2023: "arees_basiques_policials_vigent_2023",
72
80
  areesBasiquesPolicialsVigent2023Text: "arees_basiques_policials_vigent_2023_text",
81
+ areesBasiquesPolicialsVigent2024: "arees_basiques_policials_vigent_2024",
82
+ areesBasiquesPolicialsVigent2024Text: "arees_basiques_policials_vigent_2024_text",
73
83
  areesBasiquesPolicialsVigentText: "arees_basiques_policials_vigent_text",
74
84
  areesBasiquesSalutVigent: "arees_basiques_salut_vigent",
75
85
  areesBasiquesServeisSocialsVigent: "arees_basiques_serveis_socials_vigent",
76
86
  areesBasiquesServeisSocialsVigentText: "arees_basiques_serveis_socials_vigent_text",
77
87
  areesGestioAssistencialVigent: "arees_gestio_assistencial_vigent",
78
88
  areesHidrogeologiquesAquifersVigent: "arees_hidrogeologiques_aquifers_vigent",
89
+ catalunya2025: "catalunya_2025",
79
90
  catalunyaVigent: "catalunya_vigent",
80
91
  catalunyaVigentText: "catalunya_vigent_text",
81
92
  comarques2022: "comarques_2022",
93
+ comarques2025: "comarques_2025",
94
+ comarques2026: "comarques_2026",
82
95
  comarquesVigent: "comarques_vigent",
83
96
  comarquesVigentText: "comarques_vigent_text",
84
97
  comarquesVigents: "comarques_vigents",
@@ -92,6 +105,8 @@ districtesCensals2020: "districtes_censals_2020",
92
105
  districtesCensals2021: "districtes_censals_2021",
93
106
  districtesCensals2022: "districtes_censals_2022",
94
107
  districtesCensals2023: "districtes_censals_2023",
108
+ districtesCensals2024: "districtes_censals_2024",
109
+ districtesCensals2025: "districtes_censals_2025",
95
110
  districtesCensalsVigent: "districtes_censals_vigent",
96
111
  districtesCensalsVigentText: "districtes_censals_vigent_text",
97
112
  espaisNaturalsEnpeVigent: "espais_naturals_enpe_vigent",
@@ -102,13 +117,23 @@ incendisForestalsVigent: "incendis_forestals_vigent",
102
117
  incendisForestalsVigentText: "incendis_forestals_vigent_text",
103
118
  municipis2022: "municipis_2022",
104
119
  municipis2022Text: "municipis_2022_text",
120
+ municipis2025: "municipis_2025",
121
+ municipis2026: "municipis_2026",
105
122
  municipisVigent: "municipis_vigent",
106
123
  municipisVigentText: "municipis_vigent_text",
107
124
  partitsJudicialsVigent: "partits_judicials_vigent",
108
125
  partitsJudicialsVigentText: "partits_judicials_vigent_text",
109
126
  plaTerritorial2015: "pla_territorial_2015",
127
+ plaTerritorial2019: "pla_territorial_2019",
128
+ plaTerritorial2020: "pla_territorial_2020",
129
+ plaTerritorial2021: "pla_territorial_2021",
130
+ plaTerritorial2022: "pla_territorial_2022",
131
+ plaTerritorial2023: "pla_territorial_2023",
132
+ plaTerritorial2024: "pla_territorial_2024",
133
+ plaTerritorial2025: "pla_territorial_2025",
110
134
  plaTerritorialVigent: "pla_territorial_vigent",
111
135
  plaTerritorialVigentText: "pla_territorial_vigent_text",
136
+ provincies2025: "provincies_2025",
112
137
  provinciesVigent: "provincies_vigent",
113
138
  provinciesVigentText: "provincies_vigent_text",
114
139
  provinciesVigents: "provincies_vigents",
@@ -126,9 +151,12 @@ seccionsCensals2020: "seccions_censals_2020",
126
151
  seccionsCensals2021: "seccions_censals_2021",
127
152
  seccionsCensals2022: "seccions_censals_2022",
128
153
  seccionsCensals2023: "seccions_censals_2023",
154
+ seccionsCensals2024: "seccions_censals_2024",
155
+ seccionsCensals2025: "seccions_censals_2025",
129
156
  seccionsCensalsVigent: "seccions_censals_vigent",
130
157
  seccionsCensalsVigentText: "seccions_censals_vigent_text",
131
158
  sectorsSanitarisVigent: "sectors_sanitaris_vigent",
159
+ vegueries2025: "vegueries_2025",
132
160
  vegueriesVigent: "vegueries_vigent",
133
161
  vegueriesVigentText: "vegueries_vigent_text",
134
162
  };
@@ -138,6 +166,8 @@ agrupacionsCensalsVigentText: "https://tilemaps.icgc.cat/vector/fgb/agrupacions_
138
166
  areesBasiquesPolicialsVigent: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent.fgb",
139
167
  areesBasiquesPolicialsVigent2023: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent_2023.fgb",
140
168
  areesBasiquesPolicialsVigent2023Text: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent_2023_text.fgb",
169
+ areesBasiquesPolicialsVigent2024: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent_2024.fgb",
170
+ areesBasiquesPolicialsVigent2024Text: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent_2024_text.fgb",
141
171
  areesBasiquesPolicialsVigentText: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_policials_vigent_text.fgb",
142
172
  areesBasiquesSalutVigent: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_salut_vigent.fgb",
143
173
  areesBasiquesServeisSocialsVigent: "https://tilemaps.icgc.cat/vector/fgb/arees_basiques_serveis_socials_vigent.fgb",
@@ -1,13 +1,13 @@
1
1
 
2
2
  const Styles = {
3
- TOPO: "https://geoserveis.icgc.cat/styles/icgc_mapa_base_topografic.json",
4
- ORTO: "https://geoserveis.icgc.cat/styles/icgc_orto_estandard.json",
3
+ TOPO: "https://geoserveis.icgc.cat/styles/mapa-base-topografic.json",
4
+ ORTO: "https://geoserveis.icgc.cat/styles/mapa-base-orto.json",
5
5
  ORTO3D: "https://eines.icgc.cat/recursos//styles/icgc_orto_3d.json",
6
- ORTOHYBRID: "https://geoserveis.icgc.cat/styles/icgc_orto_hibrida.json",
7
- ADMIN: "https://geoserveis.icgc.cat/styles/icgc_limits_administratius_gris.json",
6
+ ORTOHYBRID: "https://geoserveis.icgc.cat/styles/mapa-base-orto-hibrida.json",
7
+ ADMIN: "https://geoserveis.icgc.cat/styles/mapa-base-administratiu.json",
8
8
  DARK: "https://geoserveis.icgc.cat/styles/icgc_mapa_base_fosc.json",
9
- LIGHT: "https://geoserveis.icgc.cat/styles/icgc_mapa_base_gris.json",
10
- GEOLOGY: "https://geoserveis.icgc.cat/styles/icgc_geologic_informacio.json",
9
+ LIGHT: "https://geoserveis.icgc.cat/styles/mapa-base-estandard-gris.json",
10
+ GEOLOGY: "https://geoserveis.icgc.cat/styles/mapa-base-geologic.json",
11
11
  RASTER: {
12
12
  TOPO: {
13
13
  url: "https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/topografic/MON3857NW/{z}/{x}/{y}.png",
package/src/map/Map.js CHANGED
@@ -3149,16 +3149,40 @@ export default class Map {
3149
3149
  */
3150
3150
  addTerrainICGC(url, controlPosition) {
3151
3151
  try {
3152
- let op;
3153
- for (const key in Terrains) {
3154
- if (Terrains.hasOwnProperty(key)) {
3155
- const objeto = Terrains[key];
3156
- if (objeto === url) {
3157
- op = objeto;
3158
- }
3159
- }
3152
+ const terrainConfigsRaw = defaultOptions?.urlTerrainICGC || [];
3153
+ const terrainConfigs = Array.isArray(terrainConfigsRaw)
3154
+ ? terrainConfigsRaw
3155
+ : Object.values(terrainConfigsRaw);
3156
+ let terrainConfig = null;
3157
+ const requestedTerrain = typeof url === "string" ? url.trim() : "";
3158
+ const requestedTerrainLower = requestedTerrain.toLowerCase();
3159
+
3160
+ // Accept both terrain key (e.g. "WORLD30M") and full URL.
3161
+ if (requestedTerrain) {
3162
+ terrainConfig =
3163
+ terrainConfigs.find(
3164
+ (terrain) => terrain?.name?.toLowerCase?.() === requestedTerrainLower
3165
+ ) ||
3166
+ terrainConfigs.find((terrain) => terrain?.url === requestedTerrain);
3167
+ }
3168
+
3169
+ let urlTerrainICGC = terrainConfig?.url;
3170
+ if (!urlTerrainICGC && requestedTerrain) {
3171
+ // Backward compatibility with Terrains dictionary values/keys.
3172
+ const terrainEntryByKey = Object.entries(Terrains || {}).find(
3173
+ ([key]) => key.toLowerCase() === requestedTerrainLower
3174
+ );
3175
+ const terrainEntryByUrl = Object.entries(Terrains || {}).find(
3176
+ ([, value]) => value === requestedTerrain
3177
+ );
3178
+ urlTerrainICGC =
3179
+ terrainEntryByKey?.[1] || terrainEntryByUrl?.[1] || requestedTerrain;
3180
+ }
3181
+
3182
+ if (!urlTerrainICGC) {
3183
+ throw new Error("Terrain URL not found in configuration");
3160
3184
  }
3161
- let urlTerrainICGC = op;
3185
+
3162
3186
  if (this.getSource("terrainICGC") !== undefined) {
3163
3187
  let lyrs = this.getStyle().layers;
3164
3188
  lyrs.forEach((element) => {
@@ -3169,23 +3193,55 @@ export default class Map {
3169
3193
  this.removeSource("terrainICGC");
3170
3194
  }
3171
3195
  if (this.getSource("terrainICGC") === undefined) {
3172
- if (url.includes("terrarium")) {
3173
- this.map.addSource("terrainICGC", {
3174
- type: "raster-dem",
3175
- tiles: [urlTerrainICGC],
3176
- tileSize: 512,
3177
- encoding: "terrarium",
3178
- maxzoom: 16,
3179
- });
3180
- } else {
3181
- this.map.addSource("terrainICGC", {
3182
- type: "raster-dem",
3183
- tiles: [urlTerrainICGC],
3184
- tileSize: 256,
3185
- maxzoom: 14,
3186
- minzoom: 7,
3187
- });
3196
+ const terrainName =
3197
+ terrainConfig?.name?.toLowerCase?.() || requestedTerrainLower;
3198
+ const sourceConfig = {
3199
+ type: "raster-dem",
3200
+ tiles: [urlTerrainICGC],
3201
+ };
3202
+
3203
+ if (terrainConfig?.encoding) {
3204
+ sourceConfig.encoding = terrainConfig.encoding;
3188
3205
  }
3206
+ if (terrainConfig?.attribution) {
3207
+ sourceConfig.attribution = terrainConfig.attribution;
3208
+ }
3209
+ if (typeof terrainConfig?.tileSize === "number") {
3210
+ sourceConfig.tileSize = terrainConfig.tileSize;
3211
+ }
3212
+ if (typeof terrainConfig?.maxzoom === "number") {
3213
+ sourceConfig.maxzoom = terrainConfig.maxzoom;
3214
+ }
3215
+ if (typeof terrainConfig?.minzoom === "number") {
3216
+ sourceConfig.minzoom = terrainConfig.minzoom;
3217
+ }
3218
+
3219
+ if (!sourceConfig.tileSize) {
3220
+ if (terrainName === "world30m") {
3221
+ sourceConfig.tileSize = 512;
3222
+ } else if (terrainName === "icgc5m") {
3223
+ sourceConfig.tileSize = 256;
3224
+ } else {
3225
+ sourceConfig.tileSize =
3226
+ sourceConfig.encoding === "terrarium" ? 512 : 256;
3227
+ }
3228
+ }
3229
+ if (typeof sourceConfig.maxzoom !== "number") {
3230
+ if (terrainName === "world30m") {
3231
+ sourceConfig.maxzoom = 16;
3232
+ } else {
3233
+ sourceConfig.maxzoom =
3234
+ sourceConfig.encoding === "terrarium" ? 16 : 14;
3235
+ }
3236
+ }
3237
+ if (
3238
+ sourceConfig.encoding !== "terrarium" &&
3239
+ typeof sourceConfig.minzoom !== "number"
3240
+ ) {
3241
+ sourceConfig.minzoom = 7;
3242
+ }
3243
+
3244
+ this.map.addSource("terrainICGC", sourceConfig);
3189
3245
  }
3190
3246
  this.map.setTerrain({
3191
3247
  source: "terrainICGC",