diff --git a/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json b/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json
index ce91f3d7ce6..8d78a15ae4e 100644
--- a/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json
+++ b/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json
@@ -8,10 +8,15 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Titre", "fr": "Titre" },
- "outfields": { "en": "Titre", "fr": "Titre" },
- "fieldTypes": "string",
- "aliasFields": { "en": "Title", "fr": "Titre" }
+ "nameField": "Titre",
+ "outfields": [
+ {
+ "name": "Titre",
+ "alias": "Titre",
+ "type": "string",
+ "domain": []
+ }
+ ]
}
},
"style": {
diff --git a/packages/geoview-core/public/configs/navigator/13-all-layers.json b/packages/geoview-core/public/configs/navigator/13-all-layers.json
index 9ae02a23e2b..77de557fd80 100644
--- a/packages/geoview-core/public/configs/navigator/13-all-layers.json
+++ b/packages/geoview-core/public/configs/navigator/13-all-layers.json
@@ -169,10 +169,15 @@
"style": "msi-binary",
"featureInfo": {
"queryable": true,
- "nameField": { "en": "band-0-pixel-value", "fr": "band-0-pixel-value" },
- "fieldTypes": "number",
- "outfields": { "en": "band-0-pixel-value", "fr": "band-0-pixel-value" },
- "aliasFields": { "en": "Pixel value", "fr": "Valeur du pixel" }
+ "nameField": "band-0-pixel-value",
+ "outfields": [
+ {
+ "name": "band-0-pixel-value",
+ "alias": "Pixel value",
+ "type": "number",
+ "domain": []
+ }
+ ]
}
}
}
@@ -222,7 +227,7 @@
},
"geoviewLayerType": "vectorTiles",
"metadataAccessPath": {
- "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/"
+ "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/"
},
"listOfLayerEntryConfig": [
{
@@ -231,7 +236,7 @@
"initialSettings": { "minZoom": 3, "maxZoom": 18 },
"source": {
"dataAccessPath": {
- "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/tile/{z}/{y}/{x}.pbf"
+ "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/tile/{z}/{y}/{x}.pbf"
}
}
}
@@ -248,4 +253,4 @@
},
"corePackages": [],
"theme": "geo.ca"
- }
+}
diff --git a/packages/geoview-core/public/configs/navigator/14-wms-layer.json b/packages/geoview-core/public/configs/navigator/14-wms-layer.json
index 000ce590bae..256f50adbd4 100644
--- a/packages/geoview-core/public/configs/navigator/14-wms-layer.json
+++ b/packages/geoview-core/public/configs/navigator/14-wms-layer.json
@@ -26,10 +26,15 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "plain_text", "fr": "plain_texte" },
- "fieldTypes": "string",
- "outfields": { "en": "plain_text", "fr": "plain_texte" },
- "aliasFields": { "en": "Forcast", "fr": "Prévision" }
+ "nameField": "plain_text",
+ "outfields": [
+ {
+ "name": "plain_text",
+ "alias": "Forcast",
+ "type": "string",
+ "domain": []
+ }
+ ]
}
}
},
@@ -58,10 +63,15 @@
"style": "msi-binary",
"featureInfo": {
"queryable": true,
- "nameField": { "en": "band-0-pixel-value", "fr": "band-0-pixel-value" },
- "fieldTypes": "number",
- "outfields": { "en": "band-0-pixel-value", "fr": "band-0-pixel-value" },
- "aliasFields": { "en": "Pixel value", "fr": "Valeur du pixel" }
+ "nameField": "band-0-pixel-value",
+ "outfields": [
+ {
+ "name": "band-0-pixel-value",
+ "alias": "Pixel value",
+ "type": "number",
+ "domain": []
+ }
+ ]
}
}
}
diff --git a/packages/geoview-core/public/configs/navigator/24-vector-tile.json b/packages/geoview-core/public/configs/navigator/24-vector-tile.json
index 8bb53010d2c..a31c8d3c527 100644
--- a/packages/geoview-core/public/configs/navigator/24-vector-tile.json
+++ b/packages/geoview-core/public/configs/navigator/24-vector-tile.json
@@ -17,7 +17,7 @@
},
"geoviewLayerType": "vectorTiles",
"metadataAccessPath": {
- "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/"
+ "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/"
},
"listOfLayerEntryConfig": [
{
@@ -25,7 +25,7 @@
"initialSettings": { "minZoom": 3, "maxZoom": 18 },
"source": {
"dataAccessPath": {
- "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/tile/{z}/{y}/{x}.pbf"
+ "en": "https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/tile/{z}/{y}/{x}.pbf"
}
}
}
diff --git a/packages/geoview-core/public/configs/package-swiper3-config.json b/packages/geoview-core/public/configs/package-swiper3-config.json
index 7f9fe32bb86..04b9835a095 100644
--- a/packages/geoview-core/public/configs/package-swiper3-config.json
+++ b/packages/geoview-core/public/configs/package-swiper3-config.json
@@ -29,15 +29,14 @@
"en": "band-0-pixel-value",
"fr": "band-0-pixel-value"
},
- "outfields": {
- "en": "band-0-pixel-value",
- "fr": "band-0-pixel-value"
- },
- "fieldTypes": "number",
- "aliasFields": {
- "en": "Pixel value",
- "fr": "Valeur du pixel"
- }
+ "outfields": [
+ {
+ "name": "band-0-pixel-value",
+ "alias": "Pixel value",
+ "type": "number",
+ "domain": []
+ }
+ ]
}
}
}
diff --git a/packages/geoview-core/public/datasets/geojson/hydro-metadata.json b/packages/geoview-core/public/datasets/geojson/hydro-metadata.json
index a5e274e8489..8b4004b6e7a 100644
--- a/packages/geoview-core/public/datasets/geojson/hydro-metadata.json
+++ b/packages/geoview-core/public/datasets/geojson/hydro-metadata.json
@@ -29,15 +29,242 @@
"en": "name_en",
"fr": "name_fr"
},
- "outfields": {
- "en": "feature_date,groupe_id,hydrosequence_id,level_path_id,slope,fid,feature_type,name_id,shreve_order,downstream_main_path_hydro_seq,feature_id,feature_type_en,name_en,strahler_order,downstream_minor_path_hydro_seq,md_id,feature_type_fr,name_fr,from_node,start_flag,code_spec,permanency,flow_priority,to_node,terminal_flag,mainstemid,isolated,flow_direction,comid,divergence,work_unit_code,in_isolated_network,hack_order,tocomid,length_km,drainage_area_code,in_network,horton_order,terminal_path_id",
- "fr": "feature_date,groupe_id,hydrosequence_id,level_path_id,slope,fid,feature_type,name_id,shreve_order,downstream_main_path_hydro_seq,feature_id,feature_type_en,name_en,strahler_order,downstream_minor_path_hydro_seq,md_id,feature_type_fr,name_fr,from_node,start_flag,code_spec,permanency,flow_priority,to_node,terminal_flag,mainstemid,isolated,flow_direction,comid,divergence,work_unit_code,in_isolated_network,hack_order,tocomid,length_km,drainage_area_code,in_network,horton_order,terminal_path_id"
- },
- "fieldTypes": "string,number,number,number,number,number,number,number,number,number,number,string,string,number,number,string,string,string,number,number,number,number,number,number,number,number,number,number,number,number,string,number,number,number,number,string,number,number,number",
- "aliasFields": {
- "en": "feature_date,groupe_id,hydrosequence_id,level_path_id,slope,fid,feature_type,name_id,shreve_order,downstream_main_path_hydro_seq,feature_id,feature_type_en,name_en,strahler_order,downstream_minor_path_hydro_seq,md_id,feature_type_fr,name_fr,from_node,start_flag,code_spec,permanency,flow_priority,to_node,terminal_flag,mainstemid,isolated,flow_direction,comid,divergence,work_unit_code,in_isolated_network,hack_order,tocomid,length_km,drainage_area_code,in_network,horton_order,terminal_path_id",
- "fr": "feature_date,groupe_id,hydrosequence_id,level_path_id,slope,fid,feature_type,name_id,shreve_order,downstream_main_path_hydro_seq,feature_id,feature_type_en,name_en,strahler_order,downstream_minor_path_hydro_seq,md_id,feature_type_fr,name_fr,from_node,start_flag,code_spec,permanency,flow_priority,to_node,terminal_flag,mainstemid,isolated,flow_direction,comid,divergence,work_unit_code,in_isolated_network,hack_order,tocomid,length_km,drainage_area_code,in_network,horton_order,terminal_path_id"
- }
+ "outfields": [
+ {
+ "name": "feature_date",
+ "alias": "feature_date",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "groupe_id",
+ "alias": "groupe_id",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "hydrosequence_id",
+ "alias": "hydrosequence_id",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "level_path_id",
+ "alias": "level_path_id",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "slope",
+ "alias": "slope",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "fid",
+ "alias": "fid",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "feature_type",
+ "alias": "feature_type",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "name_id",
+ "alias": "name_id",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "shreve_order",
+ "alias": "shreve_order",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "downstream_main_path_hydro_seq",
+ "alias": "downstream_main_path_hydro_seq",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "feature_id",
+ "alias": "feature_id",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "feature_type_en",
+ "alias": "feature_type_en",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "name_en",
+ "alias": "name_en",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "strahler_order",
+ "alias": "strahler_order",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "downstream_minor_path_hydro_seq",
+ "alias": "downstream_minor_path_hydro_seq",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "md_id",
+ "alias": "dmd_id",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "feature_type_fr",
+ "alias": "feature_type_fr",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "name_fr",
+ "alias": "name_fr",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "from_node",
+ "alias": "from_node",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "start_flag",
+ "alias": "start_flag",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "code_spec",
+ "alias": "code_spec",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "permanency",
+ "alias": "permanency",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "flow_priority",
+ "alias": "flow_priority",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "to_node",
+ "alias": "to_node",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "terminal_flag",
+ "alias": "terminal_flag",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "mainstemid",
+ "alias": "mainstemid",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "isolated",
+ "alias": "isolated",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "flow_direction",
+ "alias": "flow_direction",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "comid",
+ "alias": "comid",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "divergence",
+ "alias": "divergence",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "work_unit_code",
+ "alias": "work_unit_code",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "in_isolated_network",
+ "alias": "in_isolated_network",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "hack_order",
+ "alias": "hack_order",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "tocomid",
+ "alias": "tocomid",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "length_km",
+ "alias": "length_km",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "drainage_area_code",
+ "alias": "drainage_area_code",
+ "type": "string",
+ "domain": []
+ },
+ {
+ "name": "in_network",
+ "alias": "in_network",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "horton_order",
+ "alias": "horton_order",
+ "type": "number",
+ "domain": []
+ },
+ {
+ "name": "terminal_path_id",
+ "alias": "terminal_path_id",
+ "type": "number",
+ "domain": []
+ }
+ ]
}
},
"initialSettings": {
diff --git a/packages/geoview-core/public/datasets/geojson/metadata-blank.json b/packages/geoview-core/public/datasets/geojson/metadata-blank.json
index 0652494c25e..35c695d22f2 100644
--- a/packages/geoview-core/public/datasets/geojson/metadata-blank.json
+++ b/packages/geoview-core/public/datasets/geojson/metadata-blank.json
@@ -8,10 +8,15 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Red", "fr": "Red" },
- "outfields": { "en": "Red,Green,Blue,Yellow,Orange,creationDate", "fr": "Red,Green,Blue,Yellow,Orange,creationDate" },
- "fieldTypes": "number,number,number,number,number,date",
- "aliasFields": { "en": "Red,Green,Blue,Yellow,Orange,Creation Date", "fr": "Rouge,Vert,Bleu,Jaune,Orange,Date de création" }
+ "nameField": "Red",
+ "outfields": [
+ { "name": "Red", "alias": "Red", "type": "number", "domain": null },
+ { "name": "Green", "alias": "Green", "type": "number", "domain": null },
+ { "name": "Blue", "alias": "Blue", "type": "number", "domain": null },
+ { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null },
+ { "name": "Orange", "alias": "Orange", "type": "number", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
diff --git a/packages/geoview-core/public/datasets/geojson/metadata.json b/packages/geoview-core/public/datasets/geojson/metadata.json
index 2bbca60a0fd..2d8a3764fd0 100644
--- a/packages/geoview-core/public/datasets/geojson/metadata.json
+++ b/packages/geoview-core/public/datasets/geojson/metadata.json
@@ -8,10 +8,12 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Province", "fr": "Province" },
- "outfields": { "en": "Province,creationDate,myImages", "fr": "Province,creationDate,myImages" },
- "fieldTypes": "string,date",
- "aliasFields": { "en": "Province,Creation Date,My Images", "fr": "Province,Date de création,Mes images" }
+ "nameField": "Province",
+ "outfields": [
+ { "name": "Province", "alias": "Province", "type": "string", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null },
+ { "name": "myImages", "alias": "My Images", "type": "string", "domain": null }
+ ]
}
},
"style": {
@@ -75,10 +77,11 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Province", "fr": "Province" },
- "outfields": { "en": "Province,creationDate", "fr": "Province,creationDate" },
- "fieldTypes": "string,date",
- "aliasFields": { "en": "Province,Creation Date", "fr": "Province,Date de création" }
+ "nameField": "Province",
+ "outfields": [
+ { "name": "Province", "alias": "Province", "type": "string", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "number", "domain": null }
+ ]
}
},
"style": {
@@ -108,10 +111,12 @@
"source": {
"featureInfo": {
"queryable": false,
- "nameField": { "en": "Road_Number", "fr": "Road_Number" },
- "outfields": { "en": "Road_Number,Province,creationDate", "fr": "Road_Number,Province,creationDate" },
- "fieldTypes": "number,string,date",
- "aliasFields": { "en": "Road Number,Province,Creation Date", "fr": "Numéro de route,Province,Date de création" }
+ "nameField": "Road_Number",
+ "outfields": [
+ { "name": "Road_Number", "alias": "Road Number", "type": "number", "domain": null },
+ { "name": "Province", "alias": "Province", "type": "string", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
@@ -133,10 +138,12 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "data", "fr": "data" },
- "outfields": { "en": "data,label,creationDate", "fr": "data,label,creationDate" },
- "fieldTypes": "string,string,date",
- "aliasFields": { "en": "data,label,Creation Date", "fr": "données,étiquette,Date de création" }
+ "nameField": "data",
+ "outfields": [
+ { "name": "data", "alias": "data", "type": "string", "domain": null },
+ { "name": "label", "alias": "label", "type": "string", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "number", "domain": null }
+ ]
}
},
"style": {
@@ -158,10 +165,15 @@
"source": {
"featureInfo": {
"queryable": false,
- "nameField": { "en": "Red", "fr": "Red" },
- "outfields": { "en": "Red,Green,Blue,Yellow,Orange,creationDate", "fr": "Red,Green,Blue,Yellow,Orange,creationDate" },
- "fieldTypes": "number,number,number,number,number,date",
- "aliasFields": { "en": "Red,Green,Blue,Yellow,Orange,Creation Date", "fr": "Rouge,Vert,Bleu,Jaune,Orange,Date de création" }
+ "nameField": "Red",
+ "outfields": [
+ { "name": "Red", "alias": "Red", "type": "number", "domain": null },
+ { "name": "Green", "alias": "Green", "type": "number", "domain": null },
+ { "name": "Blue", "alias": "Blue", "type": "number", "domain": null },
+ { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null },
+ { "name": "Orange", "alias": "Orange", "type": "number", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
@@ -181,10 +193,15 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Red", "fr": "Red" },
- "outfields": { "en": "Red,Green,Blue,Yellow,Orange,creationDate", "fr": "Red,Green,Blue,Yellow,Orange,creationDate" },
- "fieldTypes": "number,number,number,number,number,date",
- "aliasFields": { "en": "Red,Green,Blue,Yellow,Orange,Creation Date", "fr": "Rouge,Vert,Bleu,Jaune,Orange,Date de création" }
+ "nameField": "Red",
+ "outfields": [
+ { "name": "Red", "alias": "Red", "type": "number", "domain": null },
+ { "name": "Green", "alias": "Green", "type": "number", "domain": null },
+ { "name": "Blue", "alias": "Blue", "type": "number", "domain": null },
+ { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null },
+ { "name": "Orange", "alias": "Orange", "type": "number", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
@@ -204,10 +221,15 @@
"source": {
"featureInfo": {
"queryable": true,
- "nameField": { "en": "Red", "fr": "Red" },
- "outfields": { "en": "Red,Green,Blue,Yellow,Orange,creationDate", "fr": "Red,Green,Blue,Yellow,Orange,creationDate" },
- "fieldTypes": "number,number,number,number,number,date",
- "aliasFields": { "en": "Red,Green,Blue,Yellow,Orange,Creation Date", "fr": "Rouge,Vert,Bleu,Jaune,Orange,Date de création" }
+ "nameField": "Red",
+ "outfields": [
+ { "name": "Red", "alias": "Red", "type": "number", "domain": null },
+ { "name": "Green", "alias": "Green", "type": "number", "domain": null },
+ { "name": "Blue", "alias": "Blue", "type": "number", "domain": null },
+ { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null },
+ { "name": "Orange", "alias": "Orange", "type": "number", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
@@ -227,10 +249,15 @@
"source": {
"featureInfo": {
"queryable": false,
- "nameField": { "en": "Red", "fr": "Red" },
- "outfields": { "en": "Red,Green,Blue,Yellow,Orange,creationDate", "fr": "Red,Green,Blue,Yellow,Orange,creationDate" },
- "fieldTypes": "number,number,number,number,number,date",
- "aliasFields": { "en": "Red,Green,Blue,Yellow,Orange,Creation Date", "fr": "Rouge,Vert,Bleu,Jaune,Orange,Date de création" }
+ "nameField": "Red",
+ "outfields": [
+ { "name": "Red", "alias": "Red", "type": "number", "domain": null },
+ { "name": "Green", "alias": "Green", "type": "number", "domain": null },
+ { "name": "Blue", "alias": "Blue", "type": "number", "domain": null },
+ { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null },
+ { "name": "Orange", "alias": "Orange", "type": "number", "domain": null },
+ { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null }
+ ]
}
},
"style": {
diff --git a/packages/geoview-core/public/datasets/geojson/metadata1.json b/packages/geoview-core/public/datasets/geojson/metadata1.json
index 9e2e9afca0a..7d88690ce28 100644
--- a/packages/geoview-core/public/datasets/geojson/metadata1.json
+++ b/packages/geoview-core/public/datasets/geojson/metadata1.json
@@ -1,122 +1,125 @@
-{
- "schemaVersionUsed": "1,0",
- "copyrightText": "© His Majesty the King in Right of Canada, as represented by the Minister of Natural Resources",
- "listOfLayerEntryConfig": [
- {
- "layerId": "projects.json",
- "layerName": { "en": "Projects" },
- "source": {
- "featureInfo": {
- "queryable": true,
- "nameField": { "en": "Project", "fr": "Project" },
- "outfields": { "en": "program,project_id,geom_type,geom_area,SRID", "fr": "program,project_id,geom_type,geom_area,SRID" },
- "fieldTypes": "string",
- "aliasFields": {
- "en": "Program,Project ID,Geometry type,Geometry area,SRID",
- "fr": "Programme,ID du projet,Geometry type,Geometry area,SRID"
- }
- }
- },
- "style": {
- "Point": {
- "styleType": "uniqueValue",
- "fields": ["Program"],
- "defaultLabel": "Other point projects",
- "defaultSettings": {
- "type": "simpleSymbol",
- "color": "rgba(0,0,255,0.10)",
- "symbol": "X"
- },
- "uniqueValueStyleInfo": [
- {
- "label": "EGP",
- "settings": {
- "type": "simpleSymbol",
- "color": "rgba(0,255,0,0.10)",
- "symbol": "circle"
- },
- "values": ["EGP"]
- },
- {
- "label": "TGI",
- "settings": {
- "type": "simpleSymbol",
- "color": "rgba(0,128,128,0.10)",
- "symbol": "star"
- },
- "values": ["TGI"]
- }
- ]
- },
- "Polygon": {
- "styleId": "uniqueValueId",
- "defaultLabel": "Other projects",
- "styleType": "uniqueValue",
- "defaultSettings": {
- "type": "filledPolygon",
- "color": "rgba(0,0,255,0.10)",
- "paternSize": 10,
- "paternWidth": 2,
- "fillStyle": "diagonalCross",
- "stroke": {
- "color": "rgba(0,0,255,1)",
- "lineStyle": "dot"
- }
- },
- "defaultVisible": true,
- "fields": ["Program"],
- "uniqueValueStyleInfo": [
- {
- "label": "EGP",
- "settings": {
- "type": "filledPolygon",
- "color": "rgba(255,0,0,0.10)",
- "paternSize": 10,
- "paternWidth": 2,
- "fillStyle": "diagonalCross",
- "stroke": {
- "color": "rgba(255,0,0,1)",
- "lineStyle": "dot"
- }
- },
- "values": ["EGP"],
- "visible": true
- },
- {
- "label": "TGI",
- "settings": {
- "type": "filledPolygon",
- "color": "rgba(0,128,128,0.10)",
- "paternSize": 10,
- "paternWidth": 2,
- "fillStyle": "diagonalCross",
- "stroke": {
- "color": "rgba(0,128,128,1)",
- "lineStyle": "dot"
- }
- },
- "values": ["TGI"],
- "visible": true
- },
- {
- "label": "GGN",
- "settings": {
- "type": "filledPolygon",
- "color": "rgba(255,0,255,0.10)",
- "paternSize": 10,
- "paternWidth": 2,
- "fillStyle": "diagonalCross",
- "stroke": {
- "color": "rgba(255,0,255,1)",
- "lineStyle": "dot"
- }
- },
- "values": ["GGN"],
- "visible": true
- }
- ]
- }
- }
- }
- ]
-}
+{
+ "schemaVersionUsed": "1,0",
+ "copyrightText": "© His Majesty the King in Right of Canada, as represented by the Minister of Natural Resources",
+ "listOfLayerEntryConfig": [
+ {
+ "layerId": "projects.json",
+ "layerName": { "en": "Projects" },
+ "source": {
+ "featureInfo": {
+ "queryable": true,
+ "nameField": "Project",
+ "outfields": [
+ [
+ { "name": "program", "alias": "Program", "type": "string", "domain": null },
+ { "name": "project_id", "alias": "Project ID", "type": "string", "domain": null },
+ { "name": "geom_type", "alias": "Geometry type", "type": "string", "domain": null },
+ { "name": "geom_area", "alias": "Geometry area", "type": "string", "domain": null },
+ { "name": "SRID", "alias": "SRID", "type": "string", "domain": null }
+ ]
+ ]
+ }
+ },
+ "style": {
+ "Point": {
+ "styleType": "uniqueValue",
+ "fields": ["Program"],
+ "defaultLabel": "Other point projects",
+ "defaultSettings": {
+ "type": "simpleSymbol",
+ "color": "rgba(0,0,255,0.10)",
+ "symbol": "X"
+ },
+ "uniqueValueStyleInfo": [
+ {
+ "label": "EGP",
+ "settings": {
+ "type": "simpleSymbol",
+ "color": "rgba(0,255,0,0.10)",
+ "symbol": "circle"
+ },
+ "values": ["EGP"]
+ },
+ {
+ "label": "TGI",
+ "settings": {
+ "type": "simpleSymbol",
+ "color": "rgba(0,128,128,0.10)",
+ "symbol": "star"
+ },
+ "values": ["TGI"]
+ }
+ ]
+ },
+ "Polygon": {
+ "styleId": "uniqueValueId",
+ "defaultLabel": "Other projects",
+ "styleType": "uniqueValue",
+ "defaultSettings": {
+ "type": "filledPolygon",
+ "color": "rgba(0,0,255,0.10)",
+ "paternSize": 10,
+ "paternWidth": 2,
+ "fillStyle": "diagonalCross",
+ "stroke": {
+ "color": "rgba(0,0,255,1)",
+ "lineStyle": "dot"
+ }
+ },
+ "defaultVisible": true,
+ "fields": ["Program"],
+ "uniqueValueStyleInfo": [
+ {
+ "label": "EGP",
+ "settings": {
+ "type": "filledPolygon",
+ "color": "rgba(255,0,0,0.10)",
+ "paternSize": 10,
+ "paternWidth": 2,
+ "fillStyle": "diagonalCross",
+ "stroke": {
+ "color": "rgba(255,0,0,1)",
+ "lineStyle": "dot"
+ }
+ },
+ "values": ["EGP"],
+ "visible": true
+ },
+ {
+ "label": "TGI",
+ "settings": {
+ "type": "filledPolygon",
+ "color": "rgba(0,128,128,0.10)",
+ "paternSize": 10,
+ "paternWidth": 2,
+ "fillStyle": "diagonalCross",
+ "stroke": {
+ "color": "rgba(0,128,128,1)",
+ "lineStyle": "dot"
+ }
+ },
+ "values": ["TGI"],
+ "visible": true
+ },
+ {
+ "label": "GGN",
+ "settings": {
+ "type": "filledPolygon",
+ "color": "rgba(255,0,255,0.10)",
+ "paternSize": 10,
+ "paternWidth": 2,
+ "fillStyle": "diagonalCross",
+ "stroke": {
+ "color": "rgba(255,0,255,1)",
+ "lineStyle": "dot"
+ }
+ },
+ "values": ["GGN"],
+ "visible": true
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
diff --git a/packages/geoview-core/public/datasets/geojson/processes-metadata.json b/packages/geoview-core/public/datasets/geojson/processes-metadata.json
index e393da01b5e..d47f9163a96 100644
--- a/packages/geoview-core/public/datasets/geojson/processes-metadata.json
+++ b/packages/geoview-core/public/datasets/geojson/processes-metadata.json
@@ -25,19 +25,22 @@
},
"featureInfo": {
"queryable": "true",
- "nameField": {
- "en": "label_en",
- "fr": "label_fr"
- },
- "outfields": {
- "en": "label_en,percentile_en,period_en,scenario_en,time_begin,time_end,time_step,uom,value_type_en,variable_en,values",
- "fr": "label_fr,percentile_fr,period_fr,scenario_fr,time_begin,time_end,time_step,uom,value_type_fr,variable_fr,values"
- },
- "fieldTypes": "string,string,string,string,date,date,string,string,string,string,number",
- "aliasFields": {
- "en": "label_en,percentile_en,period_en,scenario_en,time_begin,time_end,time_step,uom,value_type_en,variable_en,values",
- "fr": "label_fr,percentile_fr,period_fr,scenario_fr,time_begin,time_end,time_step,uom,value_type_fr,variable_fr,values"
- }
+ "nameField": "label_en",
+ "outfields": [
+ [
+ { "name": "label_en", "alias": "label_en", "type": "string", "domain": null },
+ { "name": "percentile_en", "alias": "percentile_en", "type": "string", "domain": null },
+ { "name": "period_en", "alias": "period_en", "type": "string", "domain": null },
+ { "name": "scenario_en", "alias": "scenario_en", "type": "string", "domain": null },
+ { "name": "time_begin", "alias": "time_begin", "type": "date", "domain": null },
+ { "name": "time_end", "alias": "time_end Date", "type": "date", "domain": null },
+ { "name": "time_step", "alias": "time_step", "type": "string", "domain": null },
+ { "name": "uom", "alias": "uom", "type": "string", "domain": null },
+ { "name": "value_type_en", "alias": "value_type_en", "type": "string", "domain": null },
+ { "name": "variable_en", "alias": "variable_en", "type": "string", "domain": null },
+ { "name": "values", "alias": "values", "type": "number", "domain": null }
+ ]
+ ]
}
},
"style": {
diff --git a/packages/geoview-core/public/templates/demos/demo-function-event.html b/packages/geoview-core/public/templates/demos/demo-function-event.html
index 90bc9a0ee7a..cb7ddd1fbc8 100644
--- a/packages/geoview-core/public/templates/demos/demo-function-event.html
+++ b/packages/geoview-core/public/templates/demos/demo-function-event.html
@@ -114,7 +114,7 @@
API Functions:
cgpv.api.utilities.geo.polygonToExtent(polygon)
- cgpv.api.maps.Map1.layer.redefineFeatureFields('geojsonLYR1/geojsonLYR1/polygons.json', 'Location Province,Date Created,Images', 'aliasFields')
+ cgpv.api.maps.Map1.layer.redefineFeatureFields('geojsonLYR1/geojsonLYR1/polygons.json', 'Location Province,Date Created,Images', 'alias')
cgpv.api.maps.Map1.footerBarApi.selectTab('details')
@@ -317,10 +317,15 @@ Events that will generate notifications:
'style': 'msi-binary',
'featureInfo': {
'queryable': true,
- 'nameField': { 'en': 'band-0-pixel-value', 'fr': 'band-0-pixel-value' },
- 'fieldTypes': 'number',
- 'outfields': { 'en': 'band-0-pixel-value', 'fr': 'band-0-pixel-value' },
- 'aliasFields': { 'en': 'Pixel value', 'fr': 'Valeur du pixel' }
+ 'nameField': 'band-0-pixel-value',
+ 'outfields': [
+ {
+ "name": "band-0-pixel-value",
+ "alias": "Pixel value",
+ "type": "number",
+ "domain": []
+ }
+ ]
}
}
}
@@ -443,7 +448,7 @@ Events that will generate notifications:
// add an event listener when a button is clicked
redefineAliasFieldsButton.addEventListener('click', async () => {
- cgpv.api.maps.Map1.layer.redefineFeatureFields('geojsonLYR1/geojsonLYR1/polygons.json', 'Location Province,Date Created,Images', 'aliasFields')
+ cgpv.api.maps.Map1.layer.redefineFeatureFields('geojsonLYR1/geojsonLYR1/polygons.json', 'Location Province,Date Created,Images', 'alias')
});
// Open details Button========================================================================================================
diff --git a/packages/geoview-core/public/templates/demos/demo-world-of-maps.html b/packages/geoview-core/public/templates/demos/demo-world-of-maps.html
index 474dd6d8f6f..8b97f503f13 100644
--- a/packages/geoview-core/public/templates/demos/demo-world-of-maps.html
+++ b/packages/geoview-core/public/templates/demos/demo-world-of-maps.html
@@ -76,10 +76,27 @@ Water
'source': {
'featureInfo': {
'queryable': true,
- 'nameField': { 'en': 'IDENTIF', 'fr': 'IDENTIF' },
- 'outfields': { 'en': 'IDENTIF,NAME,OBJECTID', 'fr': 'IDENTIF,NAME,OBJECTID' },
- 'fieldTypes': 'string,string',
- 'aliasFields': { 'en': 'Identification,Name,Id', 'fr': 'Identification,Name,Id' }
+ 'nameField': 'IDENTIF',
+ 'outfields': [
+ {
+ 'name': 'IDENTIF',
+ 'alias': 'Identification',
+ 'type': 'string',
+ 'domain': []
+ },
+ {
+ 'name': 'NAME',
+ 'alias': 'Name',
+ 'type': 'string',
+ 'domain': []
+ },
+ {
+ 'name': 'OBJECTID',
+ 'alias': 'Id',
+ 'type': 'number',
+ 'domain': []
+ }
+ ]
}
}
},
@@ -89,10 +106,27 @@ Water
'source': {
'featureInfo': {
'queryable': true,
- 'nameField': { 'en': 'IDENTIF', 'fr': 'IDENTIF' },
- 'outfields': { 'en': 'IDENTIF,NAME,OBJECTID', 'fr': 'IDENTIF,NAME,OBJECTID' },
- 'fieldTypes': 'string,string',
- 'aliasFields': { 'en': 'Identification,Name,Id', 'fr': 'Identification,Name,Id' }
+ 'nameField': 'IDENTIF',
+ 'outfields': [
+ {
+ 'name': 'IDENTIF',
+ 'alias': 'Identification',
+ 'type': 'string',
+ 'domain': []
+ },
+ {
+ 'name': 'NAME',
+ 'alias': 'Name',
+ 'type': 'string',
+ 'domain': []
+ },
+ {
+ 'name': 'OBJECTID',
+ 'alias': 'Id',
+ 'type': 'number',
+ 'domain': []
+ }
+ ]
}
}
},
diff --git a/packages/geoview-core/public/templates/layers/geojson.html b/packages/geoview-core/public/templates/layers/geojson.html
index c77fcb2304e..f63f19a6d0b 100644
--- a/packages/geoview-core/public/templates/layers/geojson.html
+++ b/packages/geoview-core/public/templates/layers/geojson.html
@@ -188,10 +188,33 @@ 1. Many GeoJSON Layers
},
featureInfo: {
queryable: true,
- nameField: { en: 'comment_en', fr: 'comment_fr' },
- outfields: { en: 'comment_en,death_en_1,end_date,evacuation_en_1', fr: 'comment_fr,death_fr_1,end_date,evacuation_fr_1' },
- fieldTypes: 'string,string,date,string',
- aliasFields: { en: 'comment_en,death_en_1,end_date,evacuation_en_1', fr: 'comment_fr,death_fr_1,end_date,evacuation_fr_1' },
+ nameField: 'comment_en',
+ outfields: [
+ {
+ name: 'comment_en',
+ alias: 'comment_en',
+ type: 'string',
+ domain: []
+ },
+ {
+ name: 'death_en_1',
+ alias: 'death_en_1',
+ type: 'string',
+ domain: []
+ },
+ {
+ name: 'end_date',
+ alias: 'end_date',
+ type: 'date',
+ domain: []
+ },
+ {
+ name: 'evacuation_en_1',
+ alias: 'evacuation_en_1',
+ type: 'string',
+ domain: []
+ }
+ ]
},
},
},
diff --git a/packages/geoview-core/public/templates/layers/vector-tiles.html b/packages/geoview-core/public/templates/layers/vector-tiles.html
index cf0bbc7a600..175c05a7aff 100644
--- a/packages/geoview-core/public/templates/layers/vector-tiles.html
+++ b/packages/geoview-core/public/templates/layers/vector-tiles.html
@@ -76,14 +76,14 @@ 1. Vector Tiles Layers (declutter)
'en': 'new basemap'
},
'geoviewLayerType': 'vectorTiles',
- 'metadataAccessPath': { 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/' },
+ 'metadataAccessPath': { 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/' },
'listOfLayerEntryConfig': [
{
'layerId': 'toner',
'initialSettings': { 'minZoom': 3, 'maxZoom': 18 },
'source': {
'dataAccessPath': {
- 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/tile/{z}/{y}/{x}.pbf'
+ 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/tile/{z}/{y}/{x}.pbf'
}
}
}
@@ -125,14 +125,14 @@ 2. Vector Tiles Layers (no declutter)
'en': 'new basemap'
},
'geoviewLayerType': 'vectorTiles',
- 'metadataAccessPath': { 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/' },
+ 'metadataAccessPath': { 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/' },
'listOfLayerEntryConfig': [
{
'layerId': 'toner',
'initialSettings': { 'minZoom': 3, 'maxZoom': 18 },
'source': {
'dataAccessPath': {
- 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT3978_v11/VectorTileServer/tile/{z}/{y}/{x}.pbf'
+ 'en': 'https://tiles.arcgis.com/tiles/HsjBaDykC1mjhXz9/arcgis/rest/services/CBMT_CBCT_3978_V_OSM/VectorTileServer/tile/{z}/{y}/{x}.pbf'
}
}
}
diff --git a/packages/geoview-core/public/templates/layers/wms.html b/packages/geoview-core/public/templates/layers/wms.html
index 0123a924a88..7d4afbe1665 100644
--- a/packages/geoview-core/public/templates/layers/wms.html
+++ b/packages/geoview-core/public/templates/layers/wms.html
@@ -117,10 +117,15 @@ 1. Many WMS Layers (the map displays the different phases of the
'style': 'msi-binary',
'featureInfo': {
'queryable': true,
- 'nameField': { 'en': 'band-0-pixel-value', 'fr': 'band-0-pixel-value' },
- 'fieldTypes': 'number',
- 'outfields': { 'en': 'band-0-pixel-value', 'fr': 'band-0-pixel-value' },
- 'aliasFields': { 'en': 'Pixel value', 'fr': 'Valeur du pixel' }
+ 'nameField': 'band-0-pixel-value',
+ 'outfields': [
+ {
+ 'name': 'band-0-pixel-value',
+ 'alias': 'Pixel value',
+ 'type': 'number',
+ 'domain': []
+ }
+ ]
}
}
}
diff --git a/packages/geoview-core/schema.json b/packages/geoview-core/schema.json
index d30c03bb863..4e245b9943c 100644
--- a/packages/geoview-core/schema.json
+++ b/packages/geoview-core/schema.json
@@ -32,23 +32,44 @@
"description": "Allow querying. Default = false."
},
"nameField": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The display field (English/French) of the layer. If it is not present the viewer will make an attempt to find the first valid field."
},
"outfields": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "A comma separated list of attribute names (English/French) that should be requested on query (all by default)."
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/TypeOutfields"
+ }
+ }
+ },
+ "required": ["queryable"]
+ },
+ "TypeOutfields": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "description": "The field name.",
+ "type": "string"
},
- "fieldTypes": {
- "type": "string",
- "description": "A comma separated list of types. Type at index i is associated to the variable at index i."
+ "alias": {
+ "description": "The field alias that replaces the name when comes time to display it.",
+ "type": "string"
},
- "aliasFields": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "A comma separated list of attribute names (English/French) that should be use for alias. If empty, no alias will be set if not found."
+ "type": {
+ "description": "The field type.",
+ "$ref": "#/definitions/TypeOutfieldsType"
+ },
+ "domain": {
+ "description": "An array of values that constitute the domain.",
+ "type": "array"
}
},
- "required": ["queryable"]
+ "required": ["name", "alias", "type", "domain"]
+ },
+ "TypeOutfieldsType": {
+ "description": "The types supported by the outfields object.",
+ "additionalProperties": false,
+ "enum": ["string", "number", "date", "url"]
},
"TypeFeatureInfoNotQueryable": {
"additionalProperties": false,
diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/abstract-base-esri-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/abstract-base-esri-layer-entry-config.ts
index 8f0bff4454b..e8f0959f120 100644
--- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/abstract-base-esri-layer-entry-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/abstract-base-esri-layer-entry-config.ts
@@ -136,6 +136,7 @@ export abstract class AbstractBaseEsriLayerEntryConfig extends AbstractBaseLayer
name: fieldEntry.name,
alias: fieldEntry.alias,
type: AbstractBaseEsriLayerEntryConfig.#convertEsriFieldType(fieldEntry.type as string),
+ // TODO refactor - investigate replacing null with empty array for domain
domain: Cast(fieldEntry.domain),
})
);
diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts
index a6838385c53..29cb2b1f0d3 100644
--- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts
@@ -257,7 +257,7 @@ export class WfsLayerEntryConfig extends AbstractBaseLayerEntryConfig {
name: fieldEntry.name,
alias: fieldEntry.name,
type: WfsLayerEntryConfig.#convertFieldType(fieldType),
- domain: null,
+ domain: [],
})
);
});
diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
index 728baafae89..cba71bed11c 100644
--- a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
+++ b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
@@ -16,6 +16,7 @@ import {
TypeValidMapProjectionCodes,
TypeViewSettings,
TypePointMarker,
+ TypeHighlightColors,
} from '@config/types/map-schema-types';
import { cloneDeep } from 'lodash';
import { api } from '@/app';
@@ -318,6 +319,15 @@ export class MapEventProcessor extends AbstractEventProcessor {
return this.getMapStateProtected(mapId).pointMarkers;
}
+ /**
+ * Gets feature highlight color.
+ * @param {string} mapId - The ID of the map
+ * @returns {TypeHighlightColors} The highlight color
+ */
+ static getFeatureHighlightColor(mapId: string): TypeHighlightColors {
+ return this.getMapStateProtected(mapId).featureHighlightColor;
+ }
+
static clickMarkerIconShow(mapId: string, marker: TypeClickMarker): void {
// Project coords
const projectedCoords = Projection.transformPoints(
diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/time-slider-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/time-slider-event-processor.ts
index 298b4b4e261..6362670769a 100644
--- a/packages/geoview-core/src/api/event-processors/event-processor-children/time-slider-event-processor.ts
+++ b/packages/geoview-core/src/api/event-processors/event-processor-children/time-slider-event-processor.ts
@@ -4,12 +4,10 @@ import {
TimeSliderLayerSet,
TypeTimeSliderValues,
} from '@/core/stores/store-interface-and-intial-values/time-slider-state';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { AbstractGeoViewLayer } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { WMS } from '@/geo/layer/geoview-layers/raster/wms';
import { TypeFeatureInfoLayerConfig, TypeLayerEntryConfig, layerEntryIsGroupLayer } from '@/geo/map/map-schema-types';
import { EsriImage } from '@/geo/layer/geoview-layers/raster/esri-image';
-import { AppEventProcessor } from './app-event-processor';
import { MapEventProcessor } from './map-event-processor';
import { UIEventProcessor } from './ui-event-processor';
import { GVWMS } from '@/geo/layer/gv-layers/raster/gv-wms';
@@ -147,17 +145,12 @@ export class TimeSliderEventProcessor extends AbstractEventProcessor {
// If the field type has an alias, use that as a label
let fieldAlias = field;
- let localizedAliasFields;
- let localizedOutFields;
const { featureInfo } = layerConfig.source!;
if (featureInfo) {
- const { aliasFields, outfields } = featureInfo as TypeFeatureInfoLayerConfig;
- localizedOutFields = getLocalizedValue(outfields, AppEventProcessor.getDisplayLanguage(mapId))?.split(',');
- localizedAliasFields = getLocalizedValue(aliasFields, AppEventProcessor.getDisplayLanguage(mapId))?.split(',');
+ const { outfields } = featureInfo as TypeFeatureInfoLayerConfig;
+ const timeOutfield = outfields ? outfields.find((outfield) => outfield.name === field) : undefined;
+ if (timeOutfield) fieldAlias = timeOutfield.alias;
}
- const fieldIndex = localizedOutFields ? localizedOutFields.indexOf(field) : -1;
- if (fieldIndex !== -1 && localizedAliasFields && localizedOutFields && localizedAliasFields?.length === localizedOutFields?.length)
- fieldAlias = localizedAliasFields![fieldIndex];
// eslint-disable-next-line no-nested-ternary
const values = singleHandle
diff --git a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/map-state.ts b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/map-state.ts
index f2c1497a5e0..09a1966217f 100644
--- a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/map-state.ts
+++ b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/map-state.ts
@@ -4,7 +4,7 @@ import { Extent } from 'ol/extent'; // only for Typing
import { FitOptions } from 'ol/View'; // only for typing
import { useStore } from 'zustand';
-import { TypeBasemapOptions, TypeInteraction, TypeValidMapProjectionCodes } from '@config/types/map-schema-types';
+import { TypeBasemapOptions, TypeHighlightColors, TypeInteraction, TypeValidMapProjectionCodes } from '@config/types/map-schema-types';
import { useGeoViewStore } from '@/core/stores/stores-managers';
import { TypeSetStore, TypeGetStore } from '@/core/stores/geoview-store';
import { Projection } from '@/geo/utils/projection';
@@ -32,6 +32,7 @@ export interface IMapState {
clickMarker: TypeClickMarker | undefined;
currentBasemapOptions: TypeBasemapOptions;
currentProjection: TypeValidMapProjectionCodes;
+ featureHighlightColor: TypeHighlightColors;
fixNorth: boolean;
highlightedFeatures: TypeFeatureInfoEntry[];
hoverFeatureInfo: TypeHoverFeatureInfo | undefined | null;
@@ -140,6 +141,7 @@ export function initializeMapState(set: TypeSetStore, get: TypeGetStore): IMapSt
clickMarker: undefined,
currentBasemapOptions: { basemapId: 'transport', shaded: true, labeled: true },
currentProjection: 3857 as TypeValidMapProjectionCodes,
+ featureHighlightColor: 'black',
fixNorth: false,
highlightedFeatures: [],
hoverFeatureInfo: undefined,
@@ -173,6 +175,7 @@ export function initializeMapState(set: TypeSetStore, get: TypeGetStore): IMapSt
: CV_MAP_CENTER[geoviewConfig.map.viewSettings.projection],
currentProjection: geoviewConfig.map.viewSettings.projection,
currentBasemapOptions: geoviewConfig.map.basemapOptions,
+ featureHighlightColor: geoviewConfig.map.highlightColor || 'black',
interaction: geoviewConfig.map.interaction || 'dynamic',
mapExtent: geoviewConfig.map.viewSettings.maxExtent,
northArrow: geoviewConfig.components!.indexOf('north-arrow') > -1 || false,
@@ -869,6 +872,8 @@ export const useMapClickMarker = (): TypeClickMarker | undefined => useStore(use
export const useMapClickCoordinates = (): TypeMapMouseInfo | undefined =>
useStore(useGeoViewStore(), (state) => state.mapState.clickCoordinates);
export const useMapExtent = (): Extent | undefined => useStore(useGeoViewStore(), (state) => state.mapState.mapExtent);
+export const useMapFeatureHighlightColor = (): TypeHighlightColors =>
+ useStore(useGeoViewStore(), (state) => state.mapState.featureHighlightColor);
export const useMapFixNorth = (): boolean => useStore(useGeoViewStore(), (state) => state.mapState.fixNorth);
export const useMapInitialFilters = (): Record => useStore(useGeoViewStore(), (state) => state.mapState.initialFilters);
export const useMapInteraction = (): TypeInteraction => useStore(useGeoViewStore(), (state) => state.mapState.interaction);
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
index 2b47c74df4f..e47dcd432c2 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
@@ -11,7 +11,7 @@ import Feature from 'ol/Feature';
import Source from 'ol/source/Source';
import { shared as iconImageCache } from 'ol/style/IconImageCache';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
+import { TypeLocalizedString, TypeOutfieldsType } from '@config/types/map-schema-types';
import { generateId, getXMLHttpRequest, createLocalizedString, getLocalizedValue, whenThisThen } from '@/core/utils/utilities';
import { TypeJsonObject, toJsonObject } from '@/core/types/global-types';
@@ -1238,13 +1238,13 @@ export abstract class AbstractGeoViewLayer {
* Get and format the value of the field with the name passed in parameter. Vector GeoView layers convert dates to milliseconds
* since the base date. Vector feature dates must be in ISO format.
*
- * @param {Feature} features The features that hold the field values.
- * @param {string} fieldName The field name.
- * @param {'number' | 'string' | 'date'} fieldType The field type.
+ * @param {Feature} feature - The features that hold the field values.
+ * @param {string} fieldName - The field name.
+ * @param {'number' | 'string' | 'date'} fieldType - The field type.
*
* @returns {string | number | Date} The formatted value of the field.
*/
- protected getFieldValue(feature: Feature, fieldName: string, fieldType: 'number' | 'string' | 'date'): string | number | Date {
+ protected getFieldValue(feature: Feature, fieldName: string, fieldType: TypeOutfieldsType): string | number | Date {
const fieldValue = feature.get(fieldName);
let returnValue: string | number | Date;
if (fieldType === 'date') {
@@ -1304,15 +1304,6 @@ export abstract class AbstractGeoViewLayer {
};
const featureInfo = layerConfig?.source?.featureInfo;
- const fieldTypes = featureInfo?.fieldTypes?.split(',') as ('string' | 'number' | 'date')[];
- const outfields = getLocalizedValue(
- featureInfo?.outfields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )?.split(',');
- const aliasFields = getLocalizedValue(
- featureInfo?.aliasFields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )?.split(',');
// Loop on the features to build the array holding the promises for their canvas
const promisedAllCanvasFound: Promise<{ feature: Feature; canvas: HTMLCanvasElement }>[] = [];
@@ -1341,11 +1332,6 @@ export abstract class AbstractGeoViewLayer {
);
});
- // Hold a dictionary built on the fly for the field domains
- const dictFieldDomains: { [fieldName: string]: codedValueType | rangeDomainType | null } = {};
- // Hold a dictionary build on the fly for the field types
- const dictFieldTypes: { [fieldName: string]: 'string' | 'number' | 'date' } = {};
-
// Loop on the promised feature infos
let featureKeyCounter = 0;
let fieldKeyCounter = 0;
@@ -1363,47 +1349,29 @@ export abstract class AbstractGeoViewLayer {
geometry: feature,
featureIcon: canvas,
fieldInfo: {},
- nameField:
- getLocalizedValue(
- layerConfig?.source?.featureInfo?.nameField as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- ) || null,
+ nameField: layerConfig?.source?.featureInfo?.nameField || null,
};
const featureFields = feature.getKeys();
featureFields.forEach((fieldName) => {
if (fieldName !== 'geometry') {
+ const currentOutfield = featureInfo?.outfields?.length
+ ? featureInfo.outfields.find((outfield) => outfield.name === fieldName)
+ : undefined;
+
// Calculate the field domain if not already calculated
- if (!(fieldName in dictFieldDomains)) {
- // Calculate it
- dictFieldDomains[fieldName] = this.getFieldDomain(fieldName, layerConfig);
- }
- const fieldDomain = dictFieldDomains[fieldName];
+ const fieldDomain = currentOutfield?.domain || this.getFieldDomain(fieldName, layerConfig);
// Calculate the field type if not already calculated
- if (!(fieldName in dictFieldTypes)) {
- dictFieldTypes[fieldName] = this.getFieldType(fieldName, layerConfig);
- }
- const fieldType = dictFieldTypes[fieldName];
-
- if (outfields?.includes(fieldName)) {
- const fieldIndex = outfields.indexOf(fieldName);
- featureInfoEntry.fieldInfo[fieldName] = {
- fieldKey: fieldKeyCounter++,
- value: this.getFieldValue(feature, fieldName, fieldTypes![fieldIndex]),
- dataType: fieldTypes![fieldIndex] as 'string' | 'date' | 'number',
- alias: aliasFields![fieldIndex],
- domain: fieldDomain,
- };
- } else if (!outfields) {
- featureInfoEntry.fieldInfo[fieldName] = {
- fieldKey: fieldKeyCounter++,
- value: this.getFieldValue(feature, fieldName, fieldType),
- dataType: fieldType,
- alias: fieldName,
- domain: fieldDomain,
- };
- }
+ const fieldType = currentOutfield?.type || this.getFieldType(fieldName, layerConfig);
+
+ featureInfoEntry.fieldInfo[fieldName] = {
+ fieldKey: fieldKeyCounter++,
+ value: this.getFieldValue(feature, fieldName, fieldType),
+ dataType: fieldType,
+ alias: currentOutfield?.alias || fieldName,
+ domain: fieldDomain,
+ };
}
});
queryResult.push(featureInfoEntry);
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/esri-layer-common.ts b/packages/geoview-core/src/geo/layer/geoview-layers/esri-layer-common.ts
index b5c975e0aaf..b5f9f58f177 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/esri-layer-common.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/esri-layer-common.ts
@@ -33,6 +33,7 @@ import { EsriBaseRenderer, getStyleFromEsriRenderer } from '@/geo/utils/renderer
import { EsriImage } from './raster/esri-image';
import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
+import { TypeOutfields } from '@/api/config/types/map-schema-types';
/** ***************************************************************************************************************************
* This method reads the service metadata from the metadataAccessPath.
@@ -290,46 +291,31 @@ export function commonProcessFeatureInfoConfig(
// dynamic group layer doesn't have fields definition
if (layerMetadata.type !== 'Group Layer') {
- // Process undefined outfields or aliasFields ('' = false and !'' = true). Also, if en is undefined, then fr is also undefined.
- // when en and fr are undefined, we set both en and fr to the same value.
- if (!layerConfig.source.featureInfo.outfields?.en || !layerConfig.source.featureInfo.aliasFields?.en) {
- const processOutField = !layerConfig.source.featureInfo.outfields?.en;
- const processAliasFields = !layerConfig.source.featureInfo.aliasFields?.en;
- if (processOutField) {
- layerConfig.source.featureInfo.outfields = { en: '' };
- layerConfig.source.featureInfo.fieldTypes = '';
- }
- if (processAliasFields) layerConfig.source.featureInfo.aliasFields = { en: '' };
+ // Process undefined outfields or aliasFields
+ if (!layerConfig.source.featureInfo.outfields?.length) {
+ if (!layerConfig.source.featureInfo.outfields) layerConfig.source.featureInfo.outfields = [];
+
(layerMetadata.fields as TypeJsonArray).forEach((fieldEntry) => {
if (layerMetadata.geometryField && fieldEntry?.name === layerMetadata.geometryField.name) return;
- if (processOutField) {
- layerConfig.source.featureInfo!.outfields!.en = `${layerConfig.source.featureInfo!.outfields!.en}${fieldEntry.name},`;
- const fieldType = commonGetFieldType(layer, fieldEntry.name as string, layerConfig);
- layerConfig.source.featureInfo!.fieldTypes = `${layerConfig.source.featureInfo!.fieldTypes}${fieldType},`;
- }
- if (processAliasFields)
- layerConfig.source.featureInfo!.aliasFields!.en = `${layerConfig.source.featureInfo!.aliasFields!.en}${
- fieldEntry.alias ? fieldEntry.alias : fieldEntry.name
- },`;
+ const newOutfield: TypeOutfields = {
+ name: fieldEntry.name as string,
+ alias: (fieldEntry.alias as string) || (fieldEntry.name as string),
+ type: commonGetFieldType(layer, fieldEntry.name as string, layerConfig),
+ domain: commonGetFieldDomain(layer, fieldEntry.name as string, layerConfig),
+ };
+
+ layerConfig.source.featureInfo!.outfields!.push(newOutfield);
});
- layerConfig.source.featureInfo!.outfields!.en = layerConfig.source.featureInfo!.outfields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.fieldTypes = layerConfig.source.featureInfo!.fieldTypes?.slice(0, -1);
- layerConfig.source.featureInfo!.aliasFields!.en = layerConfig.source.featureInfo!.aliasFields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.outfields!.fr = layerConfig.source.featureInfo!.outfields?.en;
- layerConfig.source.featureInfo!.aliasFields!.fr = layerConfig.source.featureInfo!.aliasFields?.en;
}
+
+ layerConfig.source.featureInfo!.outfields.forEach((outfield) => {
+ if (!outfield.alias) outfield.alias = outfield.name;
+ });
+
if (!layerConfig.source.featureInfo.nameField)
- if (layerMetadata.displayField) {
- const nameField = layerMetadata.displayField as string;
- layerConfig.source.featureInfo.nameField = {
- en: nameField,
- fr: nameField,
- };
- } else {
- const en =
- layerConfig.source.featureInfo!.outfields!.en?.split(',')[0] || layerConfig.source.featureInfo!.outfields!.fr?.split(',')[0];
- const fr = en;
- if (en) layerConfig.source.featureInfo.nameField = { en, fr };
+ if (layerMetadata.displayField) layerConfig.source.featureInfo.nameField = layerMetadata.displayField as string;
+ else {
+ layerConfig.source.featureInfo.nameField = layerConfig.source.featureInfo.outfields[0].name;
}
}
}
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts
index 3415aecc9ae..b091d65659d 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts
@@ -679,12 +679,11 @@ export class EsriDynamic extends AbstractGeoViewRaster {
* @private
*/
// GV Layers Refactoring - Obsolete (in layers)
- #formatFieldValue(fieldName: string, rawValue: string | number | Date, sourceFeatureInfo: TypeFeatureInfoLayerConfig): string {
- const fieldIndex = getLocalizedValue(sourceFeatureInfo.outfields, AppEventProcessor.getDisplayLanguage(this.mapId))
- ?.split(',')
- .indexOf(fieldName);
- const fieldType = sourceFeatureInfo.fieldTypes?.split(',')[fieldIndex!];
- switch (fieldType) {
+ static #formatFieldValue(fieldName: string, rawValue: string | number | Date, sourceFeatureInfo: TypeFeatureInfoLayerConfig): string {
+ const { outfields } = sourceFeatureInfo;
+ let selectedOutfield;
+ if (outfields?.length) selectedOutfield = outfields.find((outfield) => outfield.name === fieldName);
+ switch (selectedOutfield?.type) {
case 'date':
return `date '${rawValue}'`;
case 'string':
@@ -716,7 +715,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
): string {
let queryString = styleSettings.defaultVisible !== false && !level ? 'not (' : '(';
for (let i = 0; i < queryTree.length; i++) {
- const value = this.#formatFieldValue(styleSettings.fields[fieldOrder[level]], queryTree[i].fieldValue, sourceFeatureInfo);
+ const value = EsriDynamic.#formatFieldValue(styleSettings.fields[fieldOrder[level]], queryTree[i].fieldValue, sourceFeatureInfo);
// The nextField array is not empty, then it is is not the last field
if (queryTree[i].nextField.length) {
// If i > 0 (true) then we add a OR clause
@@ -803,7 +802,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
if (i === 0) {
if (styleSettings.classBreakStyleInfo[0].visible !== false && styleSettings.defaultVisible === false)
filterArray.push(
- `${styleSettings.field} >= ${this.#formatFieldValue(
+ `${styleSettings.field} >= ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[0].minValue!,
layerConfig.source.featureInfo!
@@ -811,7 +810,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
);
else if (styleSettings.classBreakStyleInfo[0].visible === false && styleSettings.defaultVisible !== false) {
filterArray.push(
- `${styleSettings.field} < ${this.#formatFieldValue(
+ `${styleSettings.field} < ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[0].minValue!,
layerConfig.source.featureInfo!
@@ -821,7 +820,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
}
} else if (styleSettings.classBreakStyleInfo[i].visible !== false && styleSettings.defaultVisible === false) {
filterArray.push(
- `${styleSettings.field} > ${this.#formatFieldValue(
+ `${styleSettings.field} > ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i].minValue!,
layerConfig.source.featureInfo!
@@ -829,7 +828,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
);
if (i + 1 === styleSettings.classBreakStyleInfo.length)
filterArray.push(
- `${styleSettings.field} <= ${this.#formatFieldValue(
+ `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i].maxValue!,
layerConfig.source.featureInfo!
@@ -837,7 +836,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
);
} else if (styleSettings.classBreakStyleInfo[i].visible === false && styleSettings.defaultVisible !== false) {
filterArray.push(
- `${styleSettings.field} <= ${this.#formatFieldValue(
+ `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i].minValue!,
layerConfig.source.featureInfo!
@@ -848,7 +847,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
} else if (styleSettings.defaultVisible === false) {
if (styleSettings.classBreakStyleInfo[i].visible === false) {
filterArray.push(
- `${styleSettings.field} <= ${this.#formatFieldValue(
+ `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i - 1].maxValue!,
layerConfig.source.featureInfo!
@@ -856,7 +855,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
);
} else if (i + 1 === styleSettings.classBreakStyleInfo.length) {
filterArray.push(
- `${styleSettings.field} <= ${this.#formatFieldValue(
+ `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i].maxValue!,
layerConfig.source.featureInfo!
@@ -865,7 +864,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
}
} else if (styleSettings.classBreakStyleInfo[i].visible !== false) {
filterArray.push(
- `${styleSettings.field} > ${this.#formatFieldValue(
+ `${styleSettings.field} > ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[i - 1].maxValue!,
layerConfig.source.featureInfo!
@@ -878,7 +877,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
}
if (visibleWhenGreatherThisIndex !== -1)
filterArray.push(
- `${styleSettings.field} > ${this.#formatFieldValue(
+ `${styleSettings.field} > ${EsriDynamic.#formatFieldValue(
styleSettings.field,
styleSettings.classBreakStyleInfo[visibleWhenGreatherThisIndex].maxValue!,
layerConfig.source.featureInfo!
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts
index a80f759abd2..c3122955da6 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts
@@ -118,6 +118,7 @@ export class VectorTiles extends AbstractGeoViewRaster {
* @returns {'string' | 'date' | 'number'} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in layers)
+ // TODO refactor - this looks like it will not work, investigate further
protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo;
const fieldIndex = getLocalizedValue(
@@ -279,10 +280,9 @@ export class VectorTiles extends AbstractGeoViewRaster {
if (!(layerConfig instanceof VectorTilesLayerEntryConfig)) throw new Error('Invalid layer configuration type provided');
if (this.metadata) {
- const { tileInfo } = this.metadata;
- const extent = this.metadata.fullExtent;
+ const { tileInfo, fullExtent } = this.metadata;
const newTileGrid: TypeTileGrid = {
- extent: [extent.xmin as number, extent.ymin as number, extent.xmax as number, extent.ymax as number],
+ extent: [fullExtent.xmin as number, fullExtent.ymin as number, fullExtent.xmax as number, fullExtent.ymax as number],
origin: [tileInfo.origin.x as number, tileInfo.origin.y as number],
resolutions: (tileInfo.lods as Array).map(({ resolution }) => resolution as number),
tileSize: [tileInfo.rows as number, tileInfo.cols as number],
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts
index b6ef0bb7bac..1b648fa6787 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts
@@ -15,8 +15,6 @@ import { Extent } from 'ol/extent';
import cloneDeep from 'lodash/cloneDeep';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
-
import { Cast, TypeJsonArray, TypeJsonObject } from '@/core/types/global-types';
import {
AbstractGeoViewLayer,
@@ -1003,16 +1001,7 @@ export class WMS extends AbstractGeoViewRaster {
layerConfig: OgcWmsLayerEntryConfig,
clickCoordinate: Coordinate
): TypeFeatureInfoEntry[] {
- const featureInfo = layerConfig?.source?.featureInfo;
- const outfields = getLocalizedValue(
- featureInfo?.outfields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )?.split(',');
- const fieldTypes = featureInfo?.fieldTypes?.split(',');
- const aliasFields = getLocalizedValue(
- featureInfo?.aliasFields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )?.split(',');
+ const outfields = layerConfig?.source?.featureInfo?.outfields;
const queryResult: TypeFeatureInfoEntry[] = [];
let featureKeyCounter = 0;
@@ -1060,20 +1049,24 @@ export class WMS extends AbstractGeoViewRaster {
else {
fieldKeyCounter = 0;
const fieldsToDelete = Object.keys(featureInfoEntry.fieldInfo).filter((fieldName) => {
- if (outfields?.includes(fieldName)) {
- const fieldIndex = outfields.indexOf(fieldName);
+ if (outfields.find((outfield) => outfield.name === fieldName)) {
+ const fieldIndex = outfields.findIndex((outfield) => outfield.name === fieldName);
featureInfoEntry.fieldInfo[fieldName]!.fieldKey = fieldKeyCounter++;
- featureInfoEntry.fieldInfo[fieldName]!.alias = aliasFields![fieldIndex];
- featureInfoEntry.fieldInfo[fieldName]!.dataType = fieldTypes![fieldIndex] as 'string' | 'date' | 'number';
+ featureInfoEntry.fieldInfo[fieldName]!.alias = outfields![fieldIndex].alias;
+ featureInfoEntry.fieldInfo[fieldName]!.dataType = outfields![fieldIndex].type;
return false; // keep this entry
}
+
return true; // delete this entry
});
+
fieldsToDelete.forEach((entryToDelete) => {
delete featureInfoEntry.fieldInfo[entryToDelete];
});
+
queryResult.push(featureInfoEntry);
}
+
return queryResult;
}
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts
index f79989b409f..1dddde08b9d 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts
@@ -17,7 +17,7 @@ import { ProjectionLike } from 'ol/proj';
import { Point } from 'ol/geom';
import { getUid } from 'ol/util';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
+import { TypeLocalizedString, TypeOutfields } from '@config/types/map-schema-types';
import { api } from '@/app';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
@@ -225,27 +225,21 @@ export abstract class AbstractGeoViewVector extends AbstractGeoViewLayer {
// If feature info is queryable
if (layerConfig.source?.featureInfo?.queryable) {
- const featureInfo = (layerConfig.source as TypeBaseSourceVectorInitialConfig).featureInfo!;
- const fieldTypes = featureInfo.fieldTypes?.split(',') || [];
- const fieldNames =
- getLocalizedValue(featureInfo.outfields, AppEventProcessor.getDisplayLanguage(this.mapId))?.split(',') || [];
- const dateFields = fieldTypes?.reduce((accumulator, entryFieldType, i) => {
- if (entryFieldType === 'date') accumulator.push(fieldNames[i]);
- return accumulator;
- }, []);
+ const { outfields } = (layerConfig.source as TypeBaseSourceVectorInitialConfig).featureInfo!;
+ const dateFields = outfields?.filter((outfield) => outfield.type === 'date');
if (dateFields?.length) {
features.forEach((feature) => {
- dateFields.forEach((fieldName) => {
- let fieldValue = feature.get(fieldName);
+ dateFields.forEach((dateField) => {
+ let fieldValue = feature.get(dateField.name);
if (typeof fieldValue === 'number') {
let dateString = DateMgt.convertMilisecondsToDate(fieldValue);
dateString = DateMgt.applyInputDateFormat(dateString, this.serverDateFragmentsOrder);
- (feature as Feature).set(fieldName, DateMgt.convertToMilliseconds(dateString), true);
+ (feature as Feature).set(dateField.name, DateMgt.convertToMilliseconds(dateString), true);
} else {
if (!this.serverDateFragmentsOrder)
this.serverDateFragmentsOrder = DateMgt.getDateFragmentsOrder(DateMgt.deduceDateFormat(fieldValue));
fieldValue = DateMgt.applyInputDateFormat(fieldValue, this.serverDateFragmentsOrder);
- (feature as Feature).set(fieldName, DateMgt.convertToMilliseconds(fieldValue), true);
+ (feature as Feature).set(dateField.name, DateMgt.convertToMilliseconds(fieldValue), true);
}
});
});
@@ -708,9 +702,9 @@ export abstract class AbstractGeoViewVector extends AbstractGeoViewLayer {
/** ***************************************************************************************************************************
* This method sets the outfields and aliasFields of the source feature info.
*
- * @param {string[]} headers An array of field names.
- * @param {string[]} firstRow The first row of data.
- * @param {number[]} lonLatIndices The index of lon and lat in the array.
+ * @param {string[]} headers - An array of field names.
+ * @param {string[]} firstRow - The first row of data.
+ * @param {string[]} excludedHeaders - The headers to exclude from feature info.
* @param {VectorLayerEntryConfig} layerConfig The vector layer entry to configure.
* @private
*/
@@ -722,40 +716,34 @@ export abstract class AbstractGeoViewVector extends AbstractGeoViewLayer {
): void {
if (!layerConfig.source) layerConfig.source = {};
if (!layerConfig.source.featureInfo) layerConfig.source.featureInfo = { queryable: true };
- // Process undefined outfields or aliasFields ('' = false and !'' = true). Also, if en is undefined, then fr is also undefined.
- // when en and fr are undefined, we set both en and fr to the same value.
- if (!layerConfig.source.featureInfo.outfields?.en || !layerConfig.source.featureInfo.aliasFields?.en) {
- const processOutField = !layerConfig.source.featureInfo.outfields?.en;
- const processAliasFields = !layerConfig.source.featureInfo.aliasFields?.en;
- if (processOutField) {
- layerConfig.source.featureInfo.outfields = { en: '' };
- layerConfig.source.featureInfo.fieldTypes = '';
- }
- if (processAliasFields) layerConfig.source.featureInfo.aliasFields = { en: '' };
+
+ // Process undefined outfields or aliasFields
+ if (!layerConfig.source.featureInfo.outfields?.length) {
+ if (!layerConfig.source.featureInfo.outfields) layerConfig.source.featureInfo.outfields = [];
+
headers.forEach((header, index) => {
// If not excluded
if (!excludedHeaders.includes(header)) {
let type = 'string';
if (firstRow[index] && firstRow[index] !== '' && Number(firstRow[index])) type = 'number';
- if (processOutField) {
- layerConfig.source!.featureInfo!.outfields!.en = `${layerConfig.source!.featureInfo!.outfields!.en}${header},`;
- layerConfig.source!.featureInfo!.fieldTypes = `${layerConfig.source!.featureInfo!.fieldTypes}${type},`;
- }
- layerConfig.source!.featureInfo!.aliasFields!.en = `${layerConfig.source!.featureInfo!.outfields!.en}${header},`;
+
+ const newOutfield: TypeOutfields = {
+ name: header,
+ alias: header,
+ type: type as 'string' | 'number',
+ domain: null,
+ };
+ layerConfig.source!.featureInfo!.outfields!.push(newOutfield);
}
});
- // Remove commas from end of strings
- layerConfig.source.featureInfo!.outfields!.en = layerConfig.source.featureInfo!.outfields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.fieldTypes = layerConfig.source.featureInfo!.fieldTypes?.slice(0, -1);
- layerConfig.source.featureInfo!.aliasFields!.en = layerConfig.source.featureInfo!.aliasFields?.en?.slice(0, -1);
- layerConfig.source!.featureInfo!.outfields!.fr = layerConfig.source!.featureInfo!.outfields?.en;
- layerConfig.source!.featureInfo!.aliasFields!.fr = layerConfig.source!.featureInfo!.aliasFields?.en;
- }
- if (!layerConfig.source.featureInfo.nameField) {
- const en =
- layerConfig.source.featureInfo!.outfields!.en?.split(',')[0] || layerConfig.source.featureInfo!.outfields!.fr?.split(',')[0];
- const fr = en;
- if (en) layerConfig.source.featureInfo.nameField = { en, fr };
}
+
+ layerConfig.source.featureInfo!.outfields.forEach((outfield) => {
+ if (!outfield.alias) outfield.alias = outfield.name;
+ });
+
+ // Set name field to first value
+ if (!layerConfig.source.featureInfo.nameField)
+ layerConfig.source.featureInfo.nameField = layerConfig.source.featureInfo!.outfields[0].name;
}
}
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts
index 7518e1ddc4c..8b0017e22cd 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts
@@ -33,6 +33,7 @@ import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/v
import { GroupLayerEntryConfig } from '@/core/utils/config/validation-classes/group-layer-entry-config';
import { createLocalizedString, getLocalizedValue } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
+import { TypeOutfields } from '@/api/config/types/map-schema-types';
export interface TypeSourceGeoPackageInitialConfig extends TypeVectorSourceInitialConfig {
format: 'GeoPackage';
@@ -660,41 +661,38 @@ export class GeoPackage extends AbstractGeoViewVector {
static #processFeatureInfoConfig(fields: TypeJsonObject, layerConfig: VectorLayerEntryConfig): void {
if (!layerConfig.source) layerConfig.source = {};
if (!layerConfig.source.featureInfo) layerConfig.source.featureInfo = { queryable: true };
- // Process undefined outfields or aliasFields ('' = false and !'' = true). Also, if en is undefined, then fr is also undefined.
- // when en and fr are undefined, we set both en and fr to the same value.
- if (!layerConfig.source.featureInfo.outfields?.en || !layerConfig.source.featureInfo.aliasFields?.en) {
- const processOutField = !layerConfig.source.featureInfo.outfields?.en;
- const processAliasFields = !layerConfig.source.featureInfo.aliasFields?.en;
- if (processOutField) {
- layerConfig.source.featureInfo.outfields = { en: '' };
- layerConfig.source.featureInfo.fieldTypes = '';
- }
- if (processAliasFields) layerConfig.source.featureInfo.aliasFields = { en: '' };
-
- Object.keys(fields).forEach((fieldEntry) => {
- if (!fields[fieldEntry]) return;
- if (fields[fieldEntry].type === 'Geometry') return;
- if (processOutField) {
- layerConfig.source!.featureInfo!.outfields!.en = `${layerConfig.source!.featureInfo!.outfields!.en}${fieldEntry},`;
- let fieldType = 'string';
- if (fields[fieldEntry].type === 'date') fieldType = 'date';
- else if (['bigint', 'number'].includes(typeof fields[fieldEntry])) fieldType = 'number';
- layerConfig.source!.featureInfo!.fieldTypes = `${layerConfig.source!.featureInfo!.fieldTypes}${fieldType},`;
- }
- layerConfig.source!.featureInfo!.aliasFields!.en = `${layerConfig.source!.featureInfo!.aliasFields!.en}${fieldEntry},`;
+
+ // Process undefined outfields or aliasFields
+ if (!layerConfig.source.featureInfo.outfields?.length) {
+ if (!layerConfig.source.featureInfo.outfields) layerConfig.source.featureInfo.outfields = [];
+
+ Object.keys(fields).forEach((fieldEntryKey) => {
+ if (!fields[fieldEntryKey]) return;
+
+ const fieldEntry = fields[fieldEntryKey];
+ if (fieldEntry.type === 'Geometry') return;
+
+ let fieldType = 'string';
+ if (fieldEntry.type === 'date') fieldType = 'date';
+ else if (['bigint', 'number'].includes(typeof fieldEntry)) fieldType = 'number';
+
+ const newOutfield: TypeOutfields = {
+ name: fieldEntryKey,
+ alias: fieldEntryKey,
+ type: fieldType as 'string' | 'number' | 'date',
+ domain: null,
+ };
+ layerConfig.source!.featureInfo!.outfields!.push(newOutfield);
});
- layerConfig.source.featureInfo!.outfields!.en = layerConfig.source.featureInfo!.outfields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.fieldTypes = layerConfig.source.featureInfo!.fieldTypes?.slice(0, -1);
- layerConfig.source.featureInfo!.aliasFields!.en = layerConfig.source.featureInfo!.aliasFields?.en?.slice(0, -1);
- layerConfig.source!.featureInfo!.outfields!.fr = layerConfig.source!.featureInfo!.outfields?.en;
- layerConfig.source!.featureInfo!.aliasFields!.fr = layerConfig.source!.featureInfo!.aliasFields?.en;
- }
- if (!layerConfig.source.featureInfo.nameField) {
- const en =
- layerConfig.source.featureInfo!.outfields!.en?.split(',')[0] || layerConfig.source.featureInfo!.outfields!.fr?.split(',')[0];
- const fr = en;
- if (en) layerConfig.source.featureInfo.nameField = { en, fr };
}
+
+ layerConfig.source.featureInfo!.outfields.forEach((outfield) => {
+ if (!outfield.alias) outfield.alias = outfield.name;
+ });
+
+ // Set name field to first value
+ if (!layerConfig.source.featureInfo.nameField)
+ layerConfig.source.featureInfo.nameField = layerConfig.source.featureInfo!.outfields[0].name;
}
/** ***************************************************************************************************************************
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/ogc-feature.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/ogc-feature.ts
index dceaf767504..2b6df31f50c 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/ogc-feature.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/ogc-feature.ts
@@ -28,6 +28,7 @@ import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/v
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { getLocalizedValue } from '@/core/utils/utilities';
import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
+import { TypeOutfields } from '@/api/config/types/map-schema-types';
export interface TypeSourceOgcFeatureInitialConfig extends TypeVectorSourceInitialConfig {
format: 'featureAPI';
@@ -256,42 +257,39 @@ export class OgcFeature extends AbstractGeoViewVector {
static #processFeatureInfoConfig(fields: TypeJsonObject, layerConfig: VectorLayerEntryConfig): void {
if (!layerConfig.source) layerConfig.source = {};
if (!layerConfig.source.featureInfo) layerConfig.source.featureInfo = { queryable: true };
- // Process undefined outfields or aliasFields ('' = false and !'' = true). Also, if en is undefined, then fr is also undefined.
- // when en and fr are undefined, we set both en and fr to the same value.
- if (!layerConfig.source.featureInfo.outfields?.en || !layerConfig.source.featureInfo.aliasFields?.en) {
- const processOutField = !layerConfig.source.featureInfo.outfields?.en;
- const processAliasFields = !layerConfig.source.featureInfo.aliasFields?.en;
- if (processOutField) {
- layerConfig.source.featureInfo.outfields = { en: '' };
- layerConfig.source.featureInfo.fieldTypes = '';
- }
- if (processAliasFields) layerConfig.source.featureInfo.aliasFields = { en: '' };
- // TODO: check if this is a duplicate of getField function. Clean in other classes as well
- Object.keys(fields).forEach((fieldEntry) => {
- if (fields[fieldEntry].type === 'Geometry') return;
- if (processOutField) {
- layerConfig.source!.featureInfo!.outfields!.en = `${layerConfig.source!.featureInfo!.outfields!.en}${fieldEntry},`;
- let fieldType: 'string' | 'date' | 'number';
- if (fields[fieldEntry].type === 'date') fieldType = 'date';
- else if (['int', 'number'].includes(fields[fieldEntry].type as string)) fieldType = 'number';
- else fieldType = 'string';
- layerConfig.source!.featureInfo!.fieldTypes = `${layerConfig.source!.featureInfo!.fieldTypes}${fieldType},`;
- }
- layerConfig.source!.featureInfo!.aliasFields!.en = `${layerConfig.source!.featureInfo!.aliasFields!.en}${fieldEntry},`;
+ // Process undefined outfields or aliasFields
+ if (!layerConfig.source.featureInfo.outfields?.length) {
+ if (!layerConfig.source.featureInfo.outfields) layerConfig.source.featureInfo.outfields = [];
+
+ Object.keys(fields).forEach((fieldEntryKey) => {
+ if (fields[fieldEntryKey].type === 'Geometry') return;
+
+ if (!fields[fieldEntryKey]) return;
+ const fieldEntry = fields[fieldEntryKey];
+ if (fieldEntry.type === 'Geometry') return;
+
+ let fieldType = 'string';
+ if (fieldEntry.type === 'date') fieldType = 'date';
+ else if (['bigint', 'number'].includes(typeof fieldEntry)) fieldType = 'number';
+
+ const newOutfield: TypeOutfields = {
+ name: fieldEntryKey,
+ alias: fieldEntryKey,
+ type: fieldType as 'string' | 'number' | 'date',
+ domain: null,
+ };
+ layerConfig.source!.featureInfo!.outfields!.push(newOutfield);
});
- layerConfig.source.featureInfo!.outfields!.en = layerConfig.source.featureInfo!.outfields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.fieldTypes = layerConfig.source.featureInfo!.fieldTypes?.slice(0, -1);
- layerConfig.source.featureInfo!.aliasFields!.en = layerConfig.source.featureInfo!.aliasFields?.en?.slice(0, -1);
- layerConfig.source!.featureInfo!.outfields!.fr = layerConfig.source!.featureInfo!.outfields?.en;
- layerConfig.source!.featureInfo!.aliasFields!.fr = layerConfig.source!.featureInfo!.aliasFields?.en;
- }
- if (!layerConfig.source.featureInfo.nameField) {
- const en =
- layerConfig.source.featureInfo!.outfields!.en?.split(',')[0] || layerConfig.source.featureInfo!.outfields!.fr?.split(',')[0];
- const fr = en;
- if (en) layerConfig.source.featureInfo.nameField = { en, fr };
}
+
+ layerConfig.source.featureInfo!.outfields.forEach((outfield) => {
+ if (!outfield.alias) outfield.alias = outfield.name;
+ });
+
+ // Set name field to first value
+ if (!layerConfig.source.featureInfo.nameField)
+ layerConfig.source.featureInfo.nameField = layerConfig.source.featureInfo!.outfields[0].name;
}
/** ***************************************************************************************************************************
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/wfs.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/wfs.ts
index 2d8407fcc8b..8602c625701 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/wfs.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/wfs.ts
@@ -27,6 +27,7 @@ import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/v
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { validateExtentWhenDefined } from '@/geo/utils/utilities';
+import { TypeOutfields } from '@/api/config/types/map-schema-types';
export interface TypeSourceWFSVectorInitialConfig extends TypeVectorSourceInitialConfig {
format: 'WFS';
@@ -310,41 +311,33 @@ export class WFS extends AbstractGeoViewVector {
#processFeatureInfoConfig(fields: TypeJsonArray, layerConfig: VectorLayerEntryConfig): void {
if (!layerConfig.source) layerConfig.source = {};
if (!layerConfig.source.featureInfo) layerConfig.source.featureInfo = { queryable: true };
- // Process undefined outfields or aliasFields ('' = false and !'' = true). Also, if en is undefined, then fr is also undefined.
- // when en and fr are undefined, we set both en and fr to the same value.
- if (!layerConfig.source.featureInfo.outfields?.en || !layerConfig.source.featureInfo.aliasFields?.en) {
- const processOutField = !layerConfig.source.featureInfo.outfields?.en;
- const processAliasFields = !layerConfig.source.featureInfo.aliasFields?.en;
- if (processOutField) {
- layerConfig.source.featureInfo.outfields = { en: '' };
- layerConfig.source.featureInfo.fieldTypes = '';
- }
- if (processAliasFields) layerConfig.source.featureInfo.aliasFields = { en: '' };
+
+ // Process undefined outfields or aliasFields
+ if (!layerConfig.source.featureInfo.outfields?.length) {
+ if (!layerConfig.source.featureInfo.outfields) layerConfig.source.featureInfo.outfields = [];
+
fields.forEach((fieldEntry) => {
const fieldEntryType = (fieldEntry.type as string).split(':').slice(-1)[0];
if (fieldEntryType === 'Geometry') return;
- if (processOutField) {
- layerConfig.source!.featureInfo!.outfields!.en = `${layerConfig.source!.featureInfo!.outfields!.en}${fieldEntry.name},`;
- layerConfig.source!.featureInfo!.fieldTypes = `${layerConfig.source!.featureInfo!.fieldTypes}${this.getFieldType(
- fieldEntry.name as string,
- layerConfig
- )},`;
- }
- layerConfig.source!.featureInfo!.aliasFields!.en = `${layerConfig.source!.featureInfo!.aliasFields!.en}${fieldEntry.name},`;
+
+ const newOutfield: TypeOutfields = {
+ name: fieldEntry.name as string,
+ alias: fieldEntry.name as string,
+ type: this.getFieldType(fieldEntry.name as string, layerConfig),
+ domain: null,
+ };
+
+ layerConfig.source!.featureInfo!.outfields!.push(newOutfield);
});
- layerConfig.source.featureInfo!.outfields!.en = layerConfig.source.featureInfo!.outfields?.en?.slice(0, -1);
- layerConfig.source.featureInfo!.fieldTypes = layerConfig.source.featureInfo!.fieldTypes?.slice(0, -1);
- layerConfig.source.featureInfo!.aliasFields!.en = layerConfig.source.featureInfo!.aliasFields?.en?.slice(0, -1);
- layerConfig.source!.featureInfo!.outfields!.fr = layerConfig.source!.featureInfo!.outfields?.en;
- layerConfig.source!.featureInfo!.aliasFields!.fr = layerConfig.source!.featureInfo!.aliasFields?.en;
- }
- if (!layerConfig.source.featureInfo.nameField) {
- // INFO: WFS as geometry for first field, use second one
- const en =
- layerConfig.source.featureInfo!.outfields!.en?.split(',')[1] || layerConfig.source.featureInfo!.outfields!.fr?.split(',')[1];
- const fr = en;
- if (en) layerConfig.source.featureInfo.nameField = { en, fr };
}
+
+ layerConfig.source.featureInfo!.outfields.forEach((outfield) => {
+ if (!outfield.alias) outfield.alias = outfield.name;
+ });
+
+ // INFO: WFS as geometry for first field, set name field to second value
+ if (!layerConfig.source.featureInfo.nameField)
+ layerConfig.source.featureInfo.nameField = layerConfig.source.featureInfo!.outfields[1].name;
}
/** ***************************************************************************************************************************
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts b/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts
index 8ecc84af5c2..b51f89331a7 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts
@@ -7,9 +7,6 @@ import { Layer } from 'ol/layer';
import Source from 'ol/source/Source';
import { shared as iconImageCache } from 'ol/style/IconImageCache';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
-
-import { getLocalizedValue } from '@/core/utils/utilities';
import { TimeDimension, DateMgt, TypeDateFragments } from '@/core/utils/date-mgt';
import { logger } from '@/core/utils/logger';
import { AsyncSemaphore } from '@/core/utils/async-semaphore';
@@ -538,11 +535,7 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
});
};
- const featureInfo = layerConfig?.source?.featureInfo;
- const fieldTypes = featureInfo?.fieldTypes?.split(',') as ('string' | 'number' | 'date')[];
- // TODO: Refactor - Remove the 2 hardcoded 'en' here
- const outfields = getLocalizedValue(featureInfo?.outfields as TypeLocalizedString, 'en')?.split(',');
- const aliasFields = getLocalizedValue(featureInfo?.aliasFields as TypeLocalizedString, 'en')?.split(',');
+ const outfields = layerConfig?.source?.featureInfo?.outfields;
// Loop on the features to build the array holding the promises for their canvas
const promisedAllCanvasFound: Promise<{ feature: Feature; canvas: HTMLCanvasElement }>[] = [];
@@ -585,7 +578,6 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
let extent;
if (feature.getGeometry()) extent = feature.getGeometry()!.getExtent();
- // TODO: Refactor - Remove the hardcoded 'en' here
const featureInfoEntry: TypeFeatureInfoEntry = {
// feature key for building the data-grid
featureKey: featureKeyCounter++,
@@ -594,7 +586,7 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
geometry: feature,
featureIcon: canvas,
fieldInfo: {},
- nameField: getLocalizedValue(layerConfig?.source?.featureInfo?.nameField as TypeLocalizedString, 'en') || null,
+ nameField: layerConfig?.source?.featureInfo?.nameField || null,
};
const featureFields = feature.getKeys();
@@ -613,13 +605,14 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
}
const fieldType = dictFieldTypes[fieldName];
- if (outfields?.includes(fieldName)) {
- const fieldIndex = outfields.indexOf(fieldName);
+ if (outfields?.find((outfield) => outfield.name === fieldName)) {
+ const fieldEntry = outfields.find((outfield) => outfield.name === fieldName);
+
featureInfoEntry.fieldInfo[fieldName] = {
fieldKey: fieldKeyCounter++,
- value: this.getFieldValue(feature, fieldName, fieldTypes![fieldIndex]),
- dataType: fieldTypes![fieldIndex] as 'string' | 'date' | 'number',
- alias: aliasFields![fieldIndex],
+ value: this.getFieldValue(feature, fieldName, fieldEntry!.type as 'string' | 'number' | 'date'),
+ dataType: fieldEntry!.type,
+ alias: fieldEntry!.alias,
domain: fieldDomain,
};
} else if (!outfields) {
@@ -633,8 +626,10 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
}
}
});
+
queryResult.push(featureInfoEntry);
});
+
return queryResult;
} catch (error) {
// Log
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts
index b0550275de4..1e55d707c49 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts
@@ -645,10 +645,8 @@ export class GVEsriDynamic extends AbstractGVRaster {
* @private
*/
#formatFieldValue(fieldName: string, rawValue: string | number | Date, sourceFeatureInfo: TypeFeatureInfoLayerConfig): string {
- const fieldIndex = getLocalizedValue(sourceFeatureInfo.outfields, AppEventProcessor.getDisplayLanguage(this.getMapId()))
- ?.split(',')
- .indexOf(fieldName);
- const fieldType = sourceFeatureInfo.fieldTypes?.split(',')[fieldIndex!];
+ const fieldEntry = sourceFeatureInfo.outfields?.find((outfield) => outfield.name === fieldName);
+ const fieldType = fieldEntry?.type;
switch (fieldType) {
case 'date':
return `date '${rawValue}'`;
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts
index 62f8bc08a5c..1c2dd8a3ed4 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts
@@ -7,7 +7,6 @@ import { Pixel } from 'ol/pixel';
import { ImageWMS } from 'ol/source';
import { Extent } from 'ol/extent';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
import { Cast, TypeJsonArray, TypeJsonObject } from '@/core/types/global-types';
import { CONST_LAYER_TYPES, TypeWmsLegend, TypeWmsLegendStyle } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { xmlToJson, getLocalizedValue } from '@/core/utils/utilities';
@@ -408,16 +407,7 @@ export class GVWMS extends AbstractGVRaster {
layerConfig: OgcWmsLayerEntryConfig,
clickCoordinate: Coordinate
): TypeFeatureInfoEntry[] {
- const featureInfo = layerConfig?.source?.featureInfo;
- const outfields = getLocalizedValue(
- featureInfo?.outfields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- )?.split(',');
- const fieldTypes = featureInfo?.fieldTypes?.split(',');
- const aliasFields = getLocalizedValue(
- featureInfo?.aliasFields as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- )?.split(',');
+ const outfields = layerConfig?.source?.featureInfo?.outfields;
const queryResult: TypeFeatureInfoEntry[] = [];
let featureKeyCounter = 0;
@@ -465,20 +455,24 @@ export class GVWMS extends AbstractGVRaster {
else {
fieldKeyCounter = 0;
const fieldsToDelete = Object.keys(featureInfoEntry.fieldInfo).filter((fieldName) => {
- if (outfields?.includes(fieldName)) {
- const fieldIndex = outfields.indexOf(fieldName);
+ if (outfields.find((outfield) => outfield.name === fieldName)) {
+ const fieldIndex = outfields.findIndex((outfield) => outfield.name === fieldName);
featureInfoEntry.fieldInfo[fieldName]!.fieldKey = fieldKeyCounter++;
- featureInfoEntry.fieldInfo[fieldName]!.alias = aliasFields![fieldIndex];
- featureInfoEntry.fieldInfo[fieldName]!.dataType = fieldTypes![fieldIndex] as 'string' | 'date' | 'number';
+ featureInfoEntry.fieldInfo[fieldName]!.alias = outfields![fieldIndex].alias;
+ featureInfoEntry.fieldInfo[fieldName]!.dataType = outfields![fieldIndex].type;
return false; // keep this entry
}
+
return true; // delete this entry
});
+
fieldsToDelete.forEach((entryToDelete) => {
delete featureInfoEntry.fieldInfo[entryToDelete];
});
+
queryResult.push(featureInfoEntry);
}
+
return queryResult;
}
diff --git a/packages/geoview-core/src/geo/layer/layer-mockup.ts b/packages/geoview-core/src/geo/layer/layer-mockup.ts
index e61c02bfb06..5c1b5ec6d6c 100644
--- a/packages/geoview-core/src/geo/layer/layer-mockup.ts
+++ b/packages/geoview-core/src/geo/layer/layer-mockup.ts
@@ -208,54 +208,54 @@ export abstract class LayerMockup {
name: 'OBJECTID',
type: 'esriFieldTypeOID',
alias: 'OBJECTID',
- domain: null,
+ domain: [],
},
{
name: 'Shape',
type: 'esriFieldTypeGeometry',
alias: 'Shape',
- domain: null,
+ domain: [],
},
{
name: 'count',
type: 'esriFieldTypeInteger',
alias: 'Count',
- domain: null,
+ domain: [],
},
{
name: 'project_name',
type: 'esriFieldTypeString',
alias: 'Project Name / Nom du projet',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'province_en',
type: 'esriFieldTypeString',
alias: 'Province / Territory',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'province_fr',
type: 'esriFieldTypeString',
alias: 'Province / Territoire',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'commodity_group_en',
type: 'esriFieldTypeString',
alias: 'Commodity Group',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'commodity_group_fr',
type: 'esriFieldTypeString',
alias: 'Groupe de produits min�raux',
length: 48,
- domain: null,
+ domain: [],
},
],
geometryField: {
@@ -446,62 +446,62 @@ export abstract class LayerMockup {
name: 'Shape',
type: 'esriFieldTypeGeometry',
alias: 'Shape',
- domain: null,
+ domain: [],
},
{
name: 'operation_group_en',
type: 'esriFieldTypeString',
alias: 'Operation Group',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'province_en',
type: 'esriFieldTypeString',
alias: 'Province / Territory',
length: 36,
- domain: null,
+ domain: [],
},
{
name: 'operation_name_en',
type: 'esriFieldTypeString',
alias: 'Operation',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'operator_owners_en',
type: 'esriFieldTypeString',
alias: 'Operator / Owners',
length: 120,
- domain: null,
+ domain: [],
},
{
name: 'facilities_code_en_spelt',
type: 'esriFieldTypeString',
alias: 'Facility',
length: 64,
- domain: null,
+ domain: [],
},
{
name: 'commodity_group_en_spelt',
type: 'esriFieldTypeString',
alias: 'Commodity Group',
length: 48,
- domain: null,
+ domain: [],
},
{
name: 'commodity_en_spelt',
type: 'esriFieldTypeString',
alias: 'Commodity',
length: 96,
- domain: null,
+ domain: [],
},
{
name: 'OBJECTID',
type: 'esriFieldTypeOID',
alias: 'Unique identifier',
- domain: null,
+ domain: [],
},
],
geometryField: {
@@ -678,241 +678,241 @@ export abstract class LayerMockup {
type: 'esriFieldTypeString',
alias: 'Location',
length: 150,
- domain: null,
+ domain: [],
},
{
name: 'Province',
type: 'esriFieldTypeString',
alias: 'Province / Territory',
length: 30,
- domain: null,
+ domain: [],
},
{
name: 'Be7_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Beryllium-7; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Be7_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Beryllium-7; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Be7_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Beryllium-7; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Be7_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Beryllium-7; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'Pb210_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Lead-210; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Pb210_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Lead-210; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Pb210_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Lead-210; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Pb210_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Lead-210; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'Cs134_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-134; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs134_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-134; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs134_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-134; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs134_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Cesium-134; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'Cs137_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-137; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs137_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-137; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs137_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Cesium-137; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Cs137_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Cesium-137; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'I131_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Iodine-131; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'I131_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Iodine-131; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'I131_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Iodine-131; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'I131_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Iodine-131; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'U235_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-235; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U235_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-235; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U235_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-235; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U235_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Uranium-235; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'U238_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-238; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U238_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-238; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U238_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Uranium-238; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'U238_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Uranium-238; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'Th234_Med_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Thorium-234; Median (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Th234_Max_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Thorium-234; Maximum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Th234_Min_mBqM3',
type: 'esriFieldTypeDouble',
alias: 'Thorium-234; Minimum (mBq/m³)',
- domain: null,
+ domain: [],
},
{
name: 'Th234_Readings_Lectures',
type: 'esriFieldTypeString',
alias: 'Thorium-234; Number of Readings',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'StartDate_DateDebut',
type: 'esriFieldTypeString',
alias: 'Readings Start Date',
length: 30,
- domain: null,
+ domain: [],
},
{
name: 'EndDate_DateFin',
type: 'esriFieldTypeString',
alias: 'Readings End Date',
length: 30,
- domain: null,
+ domain: [],
},
{
name: 'OBJECTID',
type: 'esriFieldTypeOID',
alias: 'Unique Identifier',
- domain: null,
+ domain: [],
},
{
name: 'Graph_Graphique',
type: 'esriFieldTypeString',
alias: 'Graph',
length: 200,
- domain: null,
+ domain: [],
},
],
geometryField: {},
@@ -983,10 +983,27 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: true,
- nameField: { en: 'Province', fr: 'Province' },
- outfields: { en: 'Province,creationDate,myImages', fr: 'Province,creationDate,myImages' },
- fieldTypes: 'string,date',
- aliasFields: { en: 'Province,Creation Date,My Images', fr: 'Province,Date de création,Mes images' },
+ nameField: 'Province',
+ outfields: [
+ {
+ name: 'Province',
+ alias: 'Province',
+ type: 'string',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'date',
+ domain: [],
+ },
+ {
+ name: 'myImages',
+ alias: 'My Images',
+ type: 'url',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1053,10 +1070,27 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: false,
- nameField: { en: 'Road_Number', fr: 'Road_Number' },
- outfields: { en: 'Road_Number,Province,creationDate', fr: 'Road_Number,Province,creationDate' },
- fieldTypes: 'number,string,date',
- aliasFields: { en: 'Road Number,Province,Creation Date', fr: 'Numéro de route,Province,Date de création' },
+ nameField: 'Road_Number',
+ outfields: [
+ {
+ name: 'Road_Number',
+ alias: 'Road Number',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Province',
+ alias: 'Province',
+ type: 'string',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'date',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1081,10 +1115,27 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: true,
- nameField: { en: 'data', fr: 'data' },
- outfields: { en: 'data,label,creationDate', fr: 'data,label,creationDate' },
- fieldTypes: 'string,string,date',
- aliasFields: { en: 'data,label,Creation Date', fr: 'données,étiquette,Date de création' },
+ nameField: 'data',
+ outfields: [
+ {
+ name: 'data',
+ alias: 'data',
+ type: 'string',
+ domain: [],
+ },
+ {
+ name: 'label',
+ alias: 'label',
+ type: 'string',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'date',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1109,10 +1160,45 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: false,
- nameField: { en: 'Red', fr: 'Red' },
- outfields: { en: 'Red,Green,Blue,Yellow,Orange,creationDate', fr: 'Red,Green,Blue,Yellow,Orange,creationDate' },
- fieldTypes: 'number,number,number,number,number,date',
- aliasFields: { en: 'Red,Green,Blue,Yellow,Orange,Creation Date', fr: 'Rouge,Vert,Bleu,Jaune,Orange,Date de création' },
+ nameField: 'Red',
+ outfields: [
+ {
+ name: 'Red',
+ alias: 'Red',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Green',
+ alias: 'Green',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Blue',
+ alias: 'Blue',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Yellow',
+ alias: 'Yellow',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Orange',
+ alias: 'Orange',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'number',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1135,10 +1221,45 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: true,
- nameField: { en: 'Red', fr: 'Red' },
- outfields: { en: 'Red,Green,Blue,Yellow,Orange,creationDate', fr: 'Red,Green,Blue,Yellow,Orange,creationDate' },
- fieldTypes: 'number,number,number,number,number,date',
- aliasFields: { en: 'Red,Green,Blue,Yellow,Orange,Creation Date', fr: 'Rouge,Vert,Bleu,Jaune,Orange,Date de création' },
+ nameField: 'Red',
+ outfields: [
+ {
+ name: 'Red',
+ alias: 'Red',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Green',
+ alias: 'Green',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Blue',
+ alias: 'Blue',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Yellow',
+ alias: 'Yellow',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Orange',
+ alias: 'Orange',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'number',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1161,10 +1282,45 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: true,
- nameField: { en: 'Red', fr: 'Red' },
- outfields: { en: 'Red,Green,Blue,Yellow,Orange,creationDate', fr: 'Red,Green,Blue,Yellow,Orange,creationDate' },
- fieldTypes: 'number,number,number,number,number,date',
- aliasFields: { en: 'Red,Green,Blue,Yellow,Orange,Creation Date', fr: 'Rouge,Vert,Bleu,Jaune,Orange,Date de création' },
+ nameField: 'Red',
+ outfields: [
+ {
+ name: 'Red',
+ alias: 'Red',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Green',
+ alias: 'Green',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Blue',
+ alias: 'Blue',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Yellow',
+ alias: 'Yellow',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Orange',
+ alias: 'Orange',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'number',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -1187,10 +1343,45 @@ export abstract class LayerMockup {
source: {
featureInfo: {
queryable: false,
- nameField: { en: 'Red', fr: 'Red' },
- outfields: { en: 'Red,Green,Blue,Yellow,Orange,creationDate', fr: 'Red,Green,Blue,Yellow,Orange,creationDate' },
- fieldTypes: 'number,number,number,number,number,date',
- aliasFields: { en: 'Red,Green,Blue,Yellow,Orange,Creation Date', fr: 'Rouge,Vert,Bleu,Jaune,Orange,Date de création' },
+ nameField: 'Red',
+ outfields: [
+ {
+ name: 'Red',
+ alias: 'Red',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Green',
+ alias: 'Green',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Blue',
+ alias: 'Blue',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Yellow',
+ alias: 'Yellow',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'Orange',
+ alias: 'Orange',
+ type: 'number',
+ domain: [],
+ },
+ {
+ name: 'creationDate',
+ alias: 'Creation Date',
+ type: 'number',
+ domain: [],
+ },
+ ],
},
},
style: {
@@ -2072,151 +2263,151 @@ export abstract class LayerMockup {
type: 'esriFieldTypeString',
alias: 'Unique ID',
length: 2048,
- domain: null,
+ domain: [],
},
{
name: 'event_id',
type: 'esriFieldTypeString',
alias: 'Event ID',
length: 64,
- domain: null,
+ domain: [],
},
{
name: 'event_name',
type: 'esriFieldTypeString',
alias: 'Event name',
length: 100,
- domain: null,
+ domain: [],
},
{
name: 'year',
type: 'esriFieldTypeInteger',
alias: 'Year',
- domain: null,
+ domain: [],
},
{
name: 'start_date',
type: 'esriFieldTypeString',
alias: 'Start date',
length: 10,
- domain: null,
+ domain: [],
},
{
name: 'end_date',
type: 'esriFieldTypeString',
alias: 'End date',
length: 10,
- domain: null,
+ domain: [],
},
{
name: 'season',
type: 'esriFieldTypeString',
alias: 'Season',
length: 10,
- domain: null,
+ domain: [],
},
{
name: 'province_territory',
type: 'esriFieldTypeString',
alias: 'Province or territory',
length: 20,
- domain: null,
+ domain: [],
},
{
name: 'province_territory_description',
type: 'esriFieldTypeString',
alias: 'Province or territory description',
length: 100,
- domain: null,
+ domain: [],
},
{
name: 'flood_cause',
type: 'esriFieldTypeString',
alias: 'Flood cause',
length: 50,
- domain: null,
+ domain: [],
},
{
name: 'flood_cause_description',
type: 'esriFieldTypeString',
alias: 'Flood cause description',
length: 1000,
- domain: null,
+ domain: [],
},
{
name: 'death',
type: 'esriFieldTypeString',
alias: 'Death',
length: 10,
- domain: null,
+ domain: [],
},
{
name: 'evacuation',
type: 'esriFieldTypeString',
alias: 'Evacuation',
length: 10,
- domain: null,
+ domain: [],
},
{
name: 'event_summary',
type: 'esriFieldTypeString',
alias: 'Event summary',
length: 3000,
- domain: null,
+ domain: [],
},
{
name: 'source',
type: 'esriFieldTypeString',
alias: 'Source',
length: 100,
- domain: null,
+ domain: [],
},
{
name: 'source_description',
type: 'esriFieldTypeString',
alias: 'Source description',
length: 1000,
- domain: null,
+ domain: [],
},
{
name: 'precipitation_analysis_url',
type: 'esriFieldTypeString',
alias: 'Precipitation analysis',
length: 180,
- domain: null,
+ domain: [],
},
{
name: 'precipitation_animation_url',
type: 'esriFieldTypeString',
alias: 'Precipitation animation',
length: 181,
- domain: null,
+ domain: [],
},
{
name: 'precipitation_data_url',
type: 'esriFieldTypeString',
alias: 'Precipitation data',
length: 177,
- domain: null,
+ domain: [],
},
{
name: 'OBJECTID',
type: 'esriFieldTypeOID',
alias: 'OBJECTID',
- domain: null,
+ domain: [],
},
{
name: 'SHAPE',
type: 'esriFieldTypeGeometry',
alias: 'SHAPE',
- domain: null,
+ domain: [],
},
{
name: 'time_slider_date',
type: 'esriFieldTypeDate',
alias: 'Time slider date',
length: 8,
- domain: null,
+ domain: [],
},
],
geometryField: {
diff --git a/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts b/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts
index f3fa4195bbb..20499d3f0ea 100644
--- a/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts
+++ b/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts
@@ -12,7 +12,6 @@ import {
TypeFeatureInfoResultSet,
TypeFeatureInfoResultSetEntry,
} from '@/core/stores/store-interface-and-intial-values/feature-info-state';
-import { createLocalizedString } from '@/core/utils/utilities';
/**
* A Layer-set working with the LayerApi at handling a result set of registered layers and synchronizing
@@ -256,36 +255,30 @@ export class FeatureInfoLayerSet extends AbstractLayerSet {
// TODO Make sure this works with solution to #2259
// Set up feature info for layers that did not include it in the metadata
const layerEntryConfig = this.layerApi.getLayerEntryConfig(layerPath) as TypeLayerEntryConfig;
+
if (!layerEntryConfig.source) layerEntryConfig.source = {};
- if (!layerEntryConfig.source?.featureInfo) {
- layerEntryConfig.source!.featureInfo = { queryable: true };
+
+ if (!layerEntryConfig.source.featureInfo) {
+ layerEntryConfig.source.featureInfo = { queryable: true };
}
- const sourceFeatureInfo = layerEntryConfig.source!.featureInfo as TypeFeatureInfoLayerConfig;
+ const sourceFeatureInfo = layerEntryConfig.source!.featureInfo as TypeFeatureInfoLayerConfig;
if (!sourceFeatureInfo.outfields) {
- // If no outfields, use keys from field info
- const fieldInfoKeys = Object.keys(record.fieldInfo);
- sourceFeatureInfo.outfields = createLocalizedString(fieldInfoKeys.join(','));
-
- // Check field info for aliases
- const aliases: string[] = [];
- fieldInfoKeys.forEach((key) => {
- if (record.fieldInfo[key]?.alias) aliases.push(record.fieldInfo[key]!.alias);
- });
+ sourceFeatureInfo.outfields = [];
- const aliasString = aliases.join(',');
- if (!sourceFeatureInfo.aliasFields?.en?.split(',').length && aliasString.length === fieldInfoKeys.length)
- sourceFeatureInfo.aliasFields = createLocalizedString(aliasString);
- // If no aliases or they did not match, use outfields
- else if (!sourceFeatureInfo.aliasFields?.en?.split(',').length) sourceFeatureInfo.aliasFields = sourceFeatureInfo.outfields;
+ Object.keys(record.fieldInfo).forEach((fieldName) => {
+ const newOutfield = {
+ name: fieldName,
+ alias: record.fieldInfo[fieldName]?.alias || fieldName,
+ type: record.fieldInfo[fieldName]?.dataType || 'string',
+ domain: null,
+ };
- // Get data types if provided
- const dataTypes: ('string' | 'number' | 'date' | undefined)[] = fieldInfoKeys.map((key: string) => {
- if (record.fieldInfo[key]?.dataType) return record.fieldInfo[key]!.dataType;
- return undefined;
+ sourceFeatureInfo.outfields!.push(newOutfield);
});
- sourceFeatureInfo.fieldTypes = dataTypes.join(',');
}
+
+ if (!sourceFeatureInfo.nameField) sourceFeatureInfo.nameField = sourceFeatureInfo.outfields[0].name;
}
/**
diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts
index cc885a1f0df..8c54f2f1d26 100644
--- a/packages/geoview-core/src/geo/layer/layer.ts
+++ b/packages/geoview-core/src/geo/layer/layer.ts
@@ -1516,14 +1516,27 @@ export class LayerApi {
*
* @param {string} layerPath - The path of the layer.
* @param {string} fieldNames - The new field names to use, separated by commas.
- * @param {'aliasFields' | 'outfields'} fields - The fields to change.
+ * @param {'alias' | 'name'} fields - The fields to change.
*/
- redefineFeatureFields(layerPath: string, fieldNames: string, fields: 'aliasFields' | 'outfields'): void {
+ redefineFeatureFields(layerPath: string, fieldNames: string, fields: 'alias' | 'name'): void {
const layerConfig = this.#layerEntryConfigs[layerPath] as AbstractBaseLayerEntryConfig;
+
if (!layerConfig) logger.logError(`Unable to find layer ${layerPath}`);
- else if (layerConfig.source?.featureInfo && layerConfig.source.featureInfo.queryable !== false)
- layerConfig.source.featureInfo[fields] = createLocalizedString(fieldNames);
- else logger.logError(`${layerPath} is not queryable`);
+ else if (
+ layerConfig.source?.featureInfo &&
+ layerConfig.source.featureInfo.queryable !== false &&
+ layerConfig.source.featureInfo.outfields
+ ) {
+ // Convert the provided field names to an array so we can index
+ const fieldValues = fieldNames.split(',');
+ if (layerConfig.source.featureInfo.outfields.length === fieldValues.length)
+ // Override existing values in each outfield with provided field name
+ layerConfig.source.featureInfo.outfields?.forEach((outfield, index) => {
+ // eslint-disable-next-line no-param-reassign
+ outfield[fields] = fieldValues[index];
+ });
+ else logger.logError(`Number of provided names for layer ${layerPath} does not match number of fields`);
+ } else logger.logError(`${layerPath} is not queryable`);
}
/**
diff --git a/packages/geoview-core/src/geo/map/feature-highlight.ts b/packages/geoview-core/src/geo/map/feature-highlight.ts
index 0f97878fbb9..5fdd47f4945 100644
--- a/packages/geoview-core/src/geo/map/feature-highlight.ts
+++ b/packages/geoview-core/src/geo/map/feature-highlight.ts
@@ -14,6 +14,7 @@ import { logger } from '@/core/utils/logger';
import { MapViewer } from '@/geo/map/map-viewer';
import { TypeFeatureInfoEntry } from './map-schema-types';
import { PointMarkers } from '@/core/components/point-markers/point-markers';
+import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
/** *****************************************************************************************************************************
* A class to handle highlighting of features
@@ -33,7 +34,7 @@ export class FeatureHighlight {
pointMarkers: PointMarkers;
/** The fill for the highlight */
- #highlightColor = 'black';
+ #highlightColor: TypeHighlightColors = 'black';
/** The fill for the highlight */
#highlightFill = new Fill({ color: [0, 0, 0, 0.3] });
@@ -57,13 +58,13 @@ export class FeatureHighlight {
constructor(mapViewer: MapViewer) {
this.overlayLayer = new VectorLayer({ source: this.highlighSource, map: mapViewer.map });
this.pointMarkers = new PointMarkers(mapViewer, this);
- // if (this.#highlightColor !== undefined)
- // this.changeHighlightColor(MapEventProcessor.getMapHighlightColor(this.#mapId) as TypeHighlightColors);
+ if (MapEventProcessor.getFeatureHighlightColor(mapViewer.mapId) !== 'black')
+ this.changeHighlightColor(MapEventProcessor.getFeatureHighlightColor(mapViewer.mapId));
}
/**
* Changes the highlight color
- * @param {TypeHighlightColor} color - New color
+ * @param {TypeHighlightColors} color - New color
*/
changeHighlightColor(color: TypeHighlightColors): void {
this.#highlightColor = color;
diff --git a/packages/geoview-core/src/geo/map/map-schema-types.ts b/packages/geoview-core/src/geo/map/map-schema-types.ts
index 952abd663dd..821bb25dcad 100644
--- a/packages/geoview-core/src/geo/map/map-schema-types.ts
+++ b/packages/geoview-core/src/geo/map/map-schema-types.ts
@@ -26,6 +26,8 @@ import {
TypeMapCorePackages,
TypeExternalPackages,
TypeGlobalSettings,
+ TypeOutfields,
+ TypeOutfieldsType,
} from '@config/types/map-schema-types';
import { CONST_LAYER_TYPES, TypeGeoviewLayerType } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
@@ -68,22 +70,16 @@ export type TypeVectorSourceFormats =
| typeof CONST_LAYER_TYPES.GEOPACKAGE
| typeof CONST_LAYER_TYPES.CSV;
-// TODO: refactor - SWITCH to new format and fix old config and all viewer code to use new structure
export type TypeFeatureInfoLayerConfig = {
/** Allow querying. Default = false. */
queryable: boolean;
-
/**
* The display field (English/French) of the layer. If it is not present the viewer will make an attempt to find the first valid
* field.
*/
- nameField?: TypeLocalizedString;
+ nameField?: string;
/** A comma separated list of attribute names (English/French) that should be requested on query (all by default). */
- outfields?: TypeLocalizedString;
- /** A comma separated list of types. Type at index i is associated to the variable at index i. */
- fieldTypes?: string;
- /** A comma separated list of attribute names (English/French) that should be use for alias. If empty, no alias will be set */
- aliasFields?: TypeLocalizedString;
+ outfields?: TypeOutfields[];
};
export type TypeBaseSourceVectorInitialConfig = {
@@ -262,7 +258,7 @@ export type rangeDomainType = {
export type TypeFieldEntry = {
fieldKey: number;
value: unknown;
- dataType: 'string' | 'date' | 'number';
+ dataType: TypeOutfieldsType;
alias: string;
domain: null | codedValueType | rangeDomainType;
};