-
-The class can be instantiated using the constructor or the create method. At creation time, the constructor instantiates a `LayerSet` object which will send a `LAYER_SET.REQUEST_LAYER_INVENTORY` event using a `mapId/LayerSetId` handler in order to get the list of all the layerPaths existing on the map. Throughout its existence, the `LegendsLayerSet` instance listens, through its `LayerSet` property, to the `LAYER_SET.LAYER_REGISTRATION` events that are emitted when a layer is created/destroyed on the map or in response to the inventory request to update its `ResultSet` property. It also listens to the `GET_LEGENDS.LEGEND_INFO` event. This listener receives the legend information returned by the layer's `getLegend` call and store it in the `LayerSet`. If all the registered layers have their legend information, a `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is triggered with a `mapId/LayerSetId` handler.
-
-When the `LegendsLayerSet` is created, a `LAYER_SET.UPDATED` listener is attached to the instance to wait for `LayerSet` modifications. Then, a `GET_LEGENDS.QUERY_LEGEND` event will be emited to all undefined legend of the `LayerSet` to obtain the legends.
-
-The `LAYER_SET.UPDATED` listener will catch layer add/remove applied to the map. If a layer is added, a `GET_LEGENDS.QUERY_LEGEND` event will be emited for it and when all the registered layers have received their legend information, a `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is emited using the `mapId/LayerSetId` as handler. The `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is also emited when a layer is removed from the map to signal that a legend has been removed.
-
-To see how you can use the `FeatureInfoLayerSet`, you can analyse the code of the following files:
-- the constructor of the `DetailsAPI` class defined in [packages/geoview-core/src/core/components/details/details/details-api.ts](../../../../packages/geoview-core/src/core/components/details/details-api.ts#L25) and its `createDetails` function;
-__DEPRECATED__
-- the `GET_FEATURE_INFO.ALL_QUERIES_DONE` listener in the `DetailsItem` JSX.Element defined in [packages\geoview-details-panel\src\details-item.tsx](../../../../packages/geoview-details-panel/src/details-item.tsx#L43) and the `createDetails` API call near the end of the file;
-- the `GET_FEATURE_INFO.ALL_QUERIES_DONE` listener in the `DetailsItem` JSX.Element defined in [packages\geoview-footer-panel\src\details-item.tsx](../../../../packages/geoview-footer-panel/src/details-item.tsx#L40) and the `createDetails` API call near the end of the file.
-
-# LegendsLayerSet State Diagram
-
-The life cycle of the `LegendsLayerSet` starts with the creation of a `LayerSet` object. This means that all the state transitions explained in the [`LayerSet` state diagram](../LayerSet/LayerSet-event-managment.md#layerset-state-diagram) are performed at creation time. To summarize what happens at this time, we must consider two cases:
-
-- The `LegendsLayerSet` is instantiated before the associated map has created its layers and the layers will be added at the time of their creation.
-- The `LegendsLayerSet` is instantiated when the associated map already has layers enabled and these will be added as a result of the inventory request made by the `LegendsLayerSet` when it is created.
-
-All map layers added to the `LegendsLayerSet` will fetch their legend, but only when the `LegendsLayerSet` process has been triggered. As long as the `TRIGGER` event is not emitted, the collection of legends is not done.
-
-Let's follow the thread of events for the first case. We create a `LegendsLayerSet`. As a result, a `LayerSet` is instanciated to associate each layer path with its legend. The `REQUEST_LAYER_INVENTORY` event that is thrown at this point in time is done for nothing, because the map does not contain a layer. However, each time a layer is added to the map, a `LAYER_REGISTRATION` event is emited to add its layer path to the `LayerSet`. This action will trigger a `LAYER_SET.UPDATED` event to tell the `LegendsLayerSet` instance that its `LayerSet` has been modified. If the `LegendsLayerSet` has received its `TRIGGER` event, It will react to the Layer_set.updated and request the legend for the newly added layer path. It is the code of the layer path of the GeoView layer instance that will request the legend and when it is obtained, a `LEGEND_INFO` event will be emitted for the layer path of the map. This will update the `LayerSet` and if all legends are fetched, an `LEGEND_LAYERSET_UPDATED` event is emited to signal to all listening object that the legends has changed.
-
-The second case differs from the previous one only in the way the `REQUEST_LAYER_INVENTORY` event is handled. Since layers already exist on the map, they will identify themselves for registration. The rest of the logic is the same.
-
-
-
-
+# LegendsLayerSet Class
+
+The `LegendsLayerSet` class is used to create objects that will keep legends associated with layer paths. It uses internally an instance of the `LayerSet` class to keep track of the layers loaded on the map. The property list of the LayerSet remains synchronized with all layer paths on the map at all times. However, the `LayerSet` has a registration condition function that filter out XYZ layers since they do not have an associated legend. If you delete or add a layer to the map, the LayerSet will be updated accordingly. The values associated with layer paths are of one of the following types: `null`, `undefined` or `TypeLegend`. A `null`value means the `getLegend` call did not get the expected legend due to an error. The `undefined`value is used to identify the layer paths that need to return there legend. A value of `TypeLegend` is the layer path legend. The structure of `TypeLegend` is shown below:
+
+```js
+export type TypeLegend = {
+ layerPath: string,
+ layerName?: string,
+ type: TypeGeoviewLayerType,
+ styleConfig?: TypeStyleConfig,
+ legend: TypeVectorLayerStyles | HTMLCanvasElement | null,
+};
+```
+
+The `layerPath` parameter is used to link the legend to the layer entry configuration in the map. The `layerName` is a bilingual string for display information. The `type` tells us how to handle the legend. The `styleConfig` parameter contains the configuration settings that describe the style of the legend. This can be a simple, a unique value, or a class break configuration. Finally, we have the `legend`, whose null value indicates that it is impossible to get a legend for the layer. When the type is `ogcWms`, the legend is a `HTMLCanvasElement`. Otherwise, it is a `TypeVectorLayerStyles`.
+
+
+
+
+
+
+The class can be instantiated using the constructor or the create method. At creation time, the constructor instantiates a `LayerSet` object which will send a `LAYER_SET.REQUEST_LAYER_INVENTORY` event using a `mapId/LayerSetId` handler in order to get the list of all the layerPaths existing on the map. Throughout its existence, the `LegendsLayerSet` instance listens, through its `LayerSet` property, to the `LAYER_SET.LAYER_REGISTRATION` events that are emitted when a layer is created/destroyed on the map or in response to the inventory request to update its `ResultSet` property. It also listens to the `GET_LEGENDS.LEGEND_INFO` event. This listener receives the legend information returned by the layer's `getLegend` call and store it in the `LayerSet`. If all the registered layers have their legend information, a `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is triggered with a `mapId/LayerSetId` handler.
+
+When the `LegendsLayerSet` is created, a `LAYER_SET.UPDATED` listener is attached to the instance to wait for `LayerSet` modifications. Then, a `GET_LEGENDS.QUERY_LEGEND` event will be emited to all undefined legend of the `LayerSet` to obtain the legends.
+
+The `LAYER_SET.UPDATED` listener will catch layer add/remove applied to the map. If a layer is added, a `GET_LEGENDS.QUERY_LEGEND` event will be emited for it and when all the registered layers have received their legend information, a `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is emited using the `mapId/LayerSetId` as handler. The `GET_LEGENDS.LEGEND_LAYERSET_UPDATED` event is also emited when a layer is removed from the map to signal that a legend has been removed.
+
+To see how you can use the `FeatureInfoLayerSet`, you can analyse the code of the following files:
+
+- the constructor of the `DetailsAPI` class defined in [packages/geoview-core/src/core/components/details/details/details-api.ts](../../../../packages/geoview-core/src/core/components/details/details-api.ts#L25) and its `createDetails` function;
+ **DEPRECATED**
+- the `GET_FEATURE_INFO.ALL_QUERIES_DONE` listener in the `DetailsItem` JSX.Element defined in [packages\geoview-details-panel\src\details-item.tsx](../../../../packages/geoview-details-panel/src/details-item.tsx#L43) and the `createDetails` API call near the end of the file;
+- the `GET_FEATURE_INFO.ALL_QUERIES_DONE` listener in the `DetailsItem` JSX.Element defined in [packages\geoview-footer-panel\src\details-item.tsx](../../../../packages/geoview-footer-panel/src/details-item.tsx#L40) and the `createDetails` API call near the end of the file.
+
+# LegendsLayerSet State Diagram
+
+The life cycle of the `LegendsLayerSet` starts with the creation of a `LayerSet` object. This means that all the state transitions explained in the [`LayerSet` state diagram](../LayerSet/LayerSet-event-managment.md#layerset-state-diagram) are performed at creation time. To summarize what happens at this time, we must consider two cases:
+
+- The `LegendsLayerSet` is instantiated before the associated map has created its layers and the layers will be added at the time of their creation.
+- The `LegendsLayerSet` is instantiated when the associated map already has layers enabled and these will be added as a result of the inventory request made by the `LegendsLayerSet` when it is created.
+
+All map layers added to the `LegendsLayerSet` will fetch their legend, but only when the `LegendsLayerSet` process has been triggered. As long as the `TRIGGER` event is not emitted, the collection of legends is not done.
+
+Let's follow the thread of events for the first case. We create a `LegendsLayerSet`. As a result, a `LayerSet` is instanciated to associate each layer path with its legend. The `REQUEST_LAYER_INVENTORY` event that is thrown at this point in time is done for nothing, because the map does not contain a layer. However, each time a layer is added to the map, a `LAYER_REGISTRATION` event is emited to add its layer path to the `LayerSet`. This action will trigger a `LAYER_SET.UPDATED` event to tell the `LegendsLayerSet` instance that its `LayerSet` has been modified. If the `LegendsLayerSet` has received its `TRIGGER` event, It will react to the Layer_set.updated and request the legend for the newly added layer path. It is the code of the layer path of the GeoView layer instance that will request the legend and when it is obtained, a `LEGEND_INFO` event will be emitted for the layer path of the map. This will update the `LayerSet` and if all legends are fetched, an `LEGEND_LAYERSET_UPDATED` event is emited to signal to all listening object that the legends has changed.
+
+The second case differs from the previous one only in the way the `REQUEST_LAYER_INVENTORY` event is handled. Since layers already exist on the map, they will identify themselves for registration. The rest of the logic is the same.
+
+
+
+
+
diff --git a/docs/app/geoview-layer/add-layer-type.md b/docs/app/geoview-layer/add-layer-type.md
index d039e8aeb40..3ef6bdb3b0e 100644
--- a/docs/app/geoview-layer/add-layer-type.md
+++ b/docs/app/geoview-layer/add-layer-type.md
@@ -1,268 +1,263 @@
-# Add a New Layer Type
-
-There is many steps involed in adding a new layer type support to GeoView. This documentation file will explain step by step what needs to be done to accomplish this task.
-The GeoView layers are divided in 2 different categories _Raster_ and _Vector_. Both categories are manage by abstract classes ([abstract-geoview-raster](../../packages/geoview-core/src/geo/layer/geoview-layers/raster/abstract-geoview-raster.ts) and [abstract-geoview-vector](../../packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts)) to encapsulate their behaviours, These 2
-categories are also encapsulated in the parent abstract class: [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts).
-
-**TODO: create basic template flavor for creating a new layer type**
-
-### First, Create new layer class
-
-The first step when it is time to create a new layer type is to determine if it is a raster or a vector type of layer. This selection is driven by the type of OpenLayers sources you will use to
-instanciate the layer.
-
-For example, we are trying to add a new layer type based on a [static image source](https://openlayers.org/en/latest/apidoc/module-ol_source_ImageStatic-Static.html). When I read the OpenLayers
-documentation, I can see this source extend the [ImageSource](https://openlayers.org/en/latest/apidoc/module-ol_source_Image-ImageSource.html). If I continue my investigation I can see
-this class has raster type of source as subclasses. I now know my new layer type is **raster**.
-
-I can create my new class, inside the raster folder of the layer structure, [image-static.ts](../../packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts) by extending AbstractGeoViewRaster class
-
-```
-/** *****************************************************************************************************************************
- * A class to add image static layer.
- *
- * @exports
- * @class ImageStatic
- */
-// ******************************************************************************************************************************
-export class ImageStatic extends AbstractGeoViewRaster {
-```
-
-To make the link between my new class and the geoview layers hierarchy I need to do the following:
-
-- Inside [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts)
- - Add to **DEFAULT_LAYER_NAMES** _constant_
- - Add to **LayerTypeKey** _type_
- - Add to **TypeGeoviewLayerType** _type_
- - Add to **CONST_LAYER_TYPES** _constant_ based on `LayerTypeKey, TypeGeoviewLayerType`
-
-Go back to my new class... Geoview is developed in TypeScript and uses type guard functions to validate type in order to determine if the type ascention is valid.
-I uses existing functions in other raster class and adapted them to my own static image need.
-
-```
-export const layerConfigIsImageStatic = (verifyIfLayer: TypeGeoviewLayerConfig): verifyIfLayer is TypeImageStaticLayerConfig => {
- return verifyIfLayer?.geoviewLayerType === CONST_LAYER_TYPES.IMAGE_STATIC;
-};
-
-export const geoviewLayerIsImageStatic = (verifyIfGeoViewLayer: AbstractGeoViewLayer): verifyIfGeoViewLayer is ImageStatic => {
- return verifyIfGeoViewLayer?.type === CONST_LAYER_TYPES.IMAGE_STATIC;
-};
-
-export const geoviewEntryIsImageStatic = (verifyIfGeoViewEntry: TypeLayerEntryConfig): verifyIfGeoViewEntry is TypeImageStaticLayerEntryConfig => {
- return verifyIfGeoViewEntry?.geoviewRootLayer?.geoviewLayerType === CONST_LAYER_TYPES.IMAGE_STATIC;
-};
-```
-
-The first function verifies if my layer is type of `TypeImageStaticLayerConfig` and the last function verifies if my layer entry is type of `TypeImageStaticLayerEntryConfig`.
-These 2 types does not exist in my class yet so I have to create them.
-
-```
-export interface TypeImageStaticLayerEntryConfig extends Omit {
- source: TypeSourceImageStaticInitialConfig;
-}
-
-export interface TypeImageStaticLayerConfig extends Omit {
- geoviewLayerType: 'imageStatic';
- listOfLayerEntryConfig: TypeImageStaticLayerEntryConfig[];
-}
-```
-
-**TODO: should we reuse constant from abstract class instead of text?**
-
-The important variable inside these 2 interfaces is the type of source my new layer class will be using. In this cases, the type does not exist so I need to create it inside [map-schema-type](../../packages/geoview-core/src/geo/map/map-schema-types.ts). Because my new source is type of sourceImage, I will add it inside `TypeSourceImageInitialConfig`
-
-```
-/** ******************************************************************************************************************************
- * Initial settings for image sources.
- */
-export type TypeSourceImageInitialConfig =
- | TypeSourceImageWmsInitialConfig
- | TypeSourceImageEsriInitialConfig
- | TypeSourceImageStaticInitialConfig;
-```
-
-I will then create this new interface by extending the `TypeSourceImageInitialConfig` _type_
-
-```
-/** ******************************************************************************************************************************
- * Initial settings for static image sources.
- */
-export interface TypeSourceImageStaticInitialConfig extends TypeBaseSourceImageInitialConfig {
- /** Image extent */
- extent: Extent;
-}
-```
-
-For my [static image source](https://openlayers.org/en/latest/apidoc/module-ol_source_ImageStatic-Static.html), I need `projection` and `extent`. Because the projection property is already define
-in parent type, I only need to create my source with the extent property.
-
-For the moment, my class and my source type are define but I still have an error because I do not have implemented all needed fuctions define in my abstract classes.
-
-From [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts)
-
-```
-protected abstract fetchServiceMetadata(): Promise;
-protected abstract validateListOfLayerEntryConfig(listOfLayerEntryConfig: TypeListOfLayerEntryConfig): TypeListOfLayerEntryConfig;
-protected abstract processLayerMetadata(layerConfig: TypeLayerEntryConfig): Promise;
-protected abstract processOneLayerEntry(layerConfig: AbstractBaseLayerEntryConfig): Promise;
-protected abstract getFeatureInfoAtPixel(location: Pixel, layerPath: string): Promise;
-protected abstract getFeatureInfoAtCoordinate(location: Coordinate, layerPath: string): Promise;
-protected abstract getFeatureInfoAtLongLat(location: Coordinate, layerPath: string): Promise;
-protected abstract getFeatureInfoUsingBBox(location: Coordinate[], layerPath: string): Promise;
-protected abstract getFeatureInfoUsingPolygon(location: Coordinate[], layerPath: string): Promise;
-protected abstract getFieldDomain(fieldName: string, layerConfig: TypeLayerEntryConfig): null | codedValueType | rangeDomainType;
-protected abstract getFieldType(fieldName: string, layerConfig: TypeLayerEntryConfig): 'string' | 'date' | 'number';
-```
-
-Once done I have a valid new static image layer type!
-
-### Second, Add my new layer class to loading process
-
-Next step is to add my new class to the loading process inside the [layer.ts](../../packages/geoview-core/src/geo/layer/layer.ts) class. For this I need to
-import my new class and add it to the `EVENT_NAMES.LAYER.EVENT_ADD_LAYER` switch like this
-
-```
-import { ImageStatic, layerConfigIsImageStatic } from './geoview-layers/raster/image-static';
-...
- } else if (layerConfigIsImageStatic(layerConfig)) {
- const imageStatic = new ImageStatic(this.mapId, layerConfig);
- imageStatic.createGeoViewLayers().then(() => {
- this.addToMap(imageStatic);
- });
- } else if (layerConfigIsWFS(layerConfig)) {
-...
-```
-
-My new layer will not load yet because I have validation errors when GeoView tries to validate that the configuration for my new layer is valid. To solve this issue,
-I need to start ith our [schema.json](../../packages/geoview-core/schema.json) configuration file. Because we added a new type `TypeSourceImageInitialConfig` we need to
-add is corresponding definition in our schema.
-
-Add the new layer type
-
-```
-"TypeGeoviewLayerType": {
- "type": "string",
- "items": {
- "enum": ["esriDynamic", "esriFeature", "imageStatic", "GeoJSON", "geoCore", "GeoPackage", "xyzTiles", "ogcFeature", "ogcWfs", "ogcWms"]
- },
- "description": "Type of GeoView layer."
- },
-```
-
-Add the TypeSourceImageStaticInitialConfig section. This the expected configuration for the source of our new layer
-
-```
-"TypeSourceImageStaticInitialConfig": {
- "additionalProperties": false,
- "type": "object",
- "properties": {
- "dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne to it."
- },
- "crossOrigin": {
- "type": "string",
- "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer."
- },
- "projection": {
- "type": "integer",
- "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada."
- },
- "featureInfo": {
- "$ref": "#/definitions/TypeFeatureInfoLayerConfig"
- },
- "extent": {
- "type": "array",
- "minItems": 4,
- "maxItems": 4,
- "items": {
- "type": "number"
- },
- "description": "The extent of the static image. Called with [minX, minY, maxX, maxY] extent coordinates."
- }
- }
-},
-```
-
-To finish, add our new type to `TypeSourceImageInitialConfig` defninition
-
-```
-"TypeSourceImageInitialConfig": {
- "anyOf": [
- ...
- { "$ref": "#/definitions/TypeSourceImageStaticInitialConfig" }
- ]
-},
-```
-
-Finally we need to add configuration calidation our new layer type. All layer configuration are validate at load time. This is done with our
-[config-validation](../../packages/geoview-core/src/core/utils/config/config-validation.ts) class.
-
-Import the payload function from our layer class
-
-```
-import { geoviewEntryIsImageStatic } from '../../../geo/layer/geoview-layers/raster/image-static';
-```
-
-Then add extra validation
-
-```
-private doExtraValidation(listOfGeoviewLayerConfig?: TypeListOfGeoviewLayerConfig) {
-...
- case 'imageStatic':
- this.geoviewLayerIdIsMandatory(geoviewLayerConfig);
- this.processLayerEntryConfig(geoviewLayerConfig, geoviewLayerConfig, geoviewLayerConfig.listOfLayerEntryConfig);
- break;
-...
-}
-```
-
-Lastly create the layer entry config who will be use later in the loading process
-
-```
-private processLayerEntryConfig(rootLayerConfig: TypeGeoviewLayerConfig, parentLayerConfig: TypeGeoviewLayerConfig | TypeLayerGroupEntryConfig, listOfLayerEntryConfig: TypeListOfLayerEntryConfig) {
-...} else if (geoviewEntryIsImageStatic(layerConfig)) {
- // Value for layerConfig.entryType can only be raster
- if (!layerConfig.entryType) layerConfig.entryType = 'raster';
- if (!layerConfig.source.dataAccessPath) {
- throw new Error(
- `source.dataAccessPath on layer entry ${Layer.getLayerPath(layerConfig)} is mandatory for GeoView layer ${
- rootLayerConfig.geoviewLayerId
- } of type ${rootLayerConfig.geoviewLayerType}`
- );
- }
- } else if (geoviewEntryIsXYZTiles(layerConfig)) {...
-}
-```
-
-### Third, Create the layer configuration
-
-Now that everything is put in place I can create my configuration to add to one of my existing map
-
-```
-{
- 'geoviewLayerId': 'staticLYR10',
- 'geoviewLayerName': {
- 'en': 'Static Image'
- },
- 'geoviewLayerType': 'imageStatic',
- 'listOfLayerEntryConfig': [
- {
- 'layerId': 'thumbnail',
- 'layerName': { 'en': 'DataCube' },
- 'source': {
- 'dataAccessPath': {
- 'en': 'https://datacube-prod-data-public.s3.ca-central-1.amazonaws.com/store/imagery/aerial/napl/napl-ring-of-fire/napl-ring-of-fire-1954-08-07-60k-thumbnail.png',
- 'fr': 'https://datacube-prod-data-public.s3.ca-central-1.amazonaws.com/store/imagery/aerial/napl/napl-ring-of-fire/napl-ring-of-fire-1954-08-07-60k-thumbnail.png'
- },
- 'extent': [-87.77486341686723,
- 51.62285357468582,
- -84.57727128084842,
- 53.833354975551075
- ],
- 'projection': 4326
- }
- }
- ]
-}
-```
+# Add a New Layer Type
+
+There is many steps involed in adding a new layer type support to GeoView. This documentation file will explain step by step what needs to be done to accomplish this task.
+The GeoView layers are divided in 2 different categories _Raster_ and _Vector_. Both categories are manage by abstract classes ([abstract-geoview-raster](../../packages/geoview-core/src/geo/layer/geoview-layers/raster/abstract-geoview-raster.ts) and [abstract-geoview-vector](../../packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts)) to encapsulate their behaviours, These 2
+categories are also encapsulated in the parent abstract class: [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts).
+
+**TODO: create basic template flavor for creating a new layer type**
+
+### First, Create new layer class
+
+The first step when it is time to create a new layer type is to determine if it is a raster or a vector type of layer. This selection is driven by the type of OpenLayers sources you will use to
+instanciate the layer.
+
+For example, we are trying to add a new layer type based on a [static image source](https://openlayers.org/en/latest/apidoc/module-ol_source_ImageStatic-Static.html). When I read the OpenLayers
+documentation, I can see this source extend the [ImageSource](https://openlayers.org/en/latest/apidoc/module-ol_source_Image-ImageSource.html). If I continue my investigation I can see
+this class has raster type of source as subclasses. I now know my new layer type is **raster**.
+
+I can create my new class, inside the raster folder of the layer structure, [image-static.ts](../../packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts) by extending AbstractGeoViewRaster class
+
+```
+/** *****************************************************************************************************************************
+ * A class to add image static layer.
+ *
+ * @exports
+ * @class ImageStatic
+ */
+// ******************************************************************************************************************************
+export class ImageStatic extends AbstractGeoViewRaster {
+```
+
+To make the link between my new class and the geoview layers hierarchy I need to do the following:
+
+- Inside [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts)
+ - Add to **DEFAULT_LAYER_NAMES** _constant_
+ - Add to **LayerTypeKey** _type_
+ - Add to **TypeGeoviewLayerType** _type_
+ - Add to **CONST_LAYER_TYPES** _constant_ based on `LayerTypeKey, TypeGeoviewLayerType`
+
+Go back to my new class... Geoview is developed in TypeScript and uses type guard functions to validate type in order to determine if the type ascention is valid.
+I uses existing functions in other raster class and adapted them to my own static image need.
+
+```
+export const layerConfigIsImageStatic = (verifyIfLayer: TypeGeoviewLayerConfig): verifyIfLayer is TypeImageStaticLayerConfig => {
+ return verifyIfLayer?.geoviewLayerType === CONST_LAYER_TYPES.IMAGE_STATIC;
+};
+
+export const geoviewLayerIsImageStatic = (verifyIfGeoViewLayer: AbstractGeoViewLayer): verifyIfGeoViewLayer is ImageStatic => {
+ return verifyIfGeoViewLayer?.type === CONST_LAYER_TYPES.IMAGE_STATIC;
+};
+
+export const geoviewEntryIsImageStatic = (verifyIfGeoViewEntry: TypeLayerEntryConfig): verifyIfGeoViewEntry is TypeImageStaticLayerEntryConfig => {
+ return verifyIfGeoViewEntry?.geoviewRootLayer?.geoviewLayerType === CONST_LAYER_TYPES.IMAGE_STATIC;
+};
+```
+
+The first function verifies if my layer is type of `TypeImageStaticLayerConfig` and the last function verifies if my layer entry is type of `TypeImageStaticLayerEntryConfig`.
+These 2 types does not exist in my class yet so I have to create them.
+
+```
+export interface TypeImageStaticLayerEntryConfig extends Omit {
+ source: TypeSourceImageStaticInitialConfig;
+}
+
+export interface TypeImageStaticLayerConfig extends Omit {
+ geoviewLayerType: 'imageStatic';
+ listOfLayerEntryConfig: TypeImageStaticLayerEntryConfig[];
+}
+```
+
+**TODO: should we reuse constant from abstract class instead of text?**
+
+The important variable inside these 2 interfaces is the type of source my new layer class will be using. In this cases, the type does not exist so I need to create it inside [map-schema-type](../../packages/geoview-core/src/geo/map/map-schema-types.ts). Because my new source is type of sourceImage, I will add it inside `TypeSourceImageInitialConfig`
+
+```
+/** ******************************************************************************************************************************
+ * Initial settings for image sources.
+ */
+export type TypeSourceImageInitialConfig =
+ | TypeSourceImageWmsInitialConfig
+ | TypeSourceImageEsriInitialConfig
+ | TypeSourceImageStaticInitialConfig;
+```
+
+I will then create this new interface by extending the `TypeSourceImageInitialConfig` _type_
+
+```
+/** ******************************************************************************************************************************
+ * Initial settings for static image sources.
+ */
+export interface TypeSourceImageStaticInitialConfig extends TypeBaseSourceImageInitialConfig {
+ /** Image extent */
+ extent: Extent;
+}
+```
+
+For my [static image source](https://openlayers.org/en/latest/apidoc/module-ol_source_ImageStatic-Static.html), I need `projection` and `extent`. Because the projection property is already define
+in parent type, I only need to create my source with the extent property.
+
+For the moment, my class and my source type are define but I still have an error because I do not have implemented all needed fuctions define in my abstract classes.
+
+From [abstract-geoview-layers](../../packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts)
+
+```
+protected abstract fetchServiceMetadata(): Promise;
+protected abstract validateListOfLayerEntryConfig(listOfLayerEntryConfig: TypeListOfLayerEntryConfig): TypeListOfLayerEntryConfig;
+protected abstract processLayerMetadata(layerConfig: TypeLayerEntryConfig): Promise;
+protected abstract processOneLayerEntry(layerConfig: AbstractBaseLayerEntryConfig): Promise;
+protected abstract getFeatureInfoAtPixel(location: Pixel, layerPath: string): Promise;
+protected abstract getFeatureInfoAtCoordinate(location: Coordinate, layerPath: string): Promise;
+protected abstract getFeatureInfoAtLongLat(location: Coordinate, layerPath: string): Promise;
+protected abstract getFeatureInfoUsingBBox(location: Coordinate[], layerPath: string): Promise;
+protected abstract getFeatureInfoUsingPolygon(location: Coordinate[], layerPath: string): Promise;
+protected abstract getFieldDomain(fieldName: string, layerConfig: TypeLayerEntryConfig): null | codedValueType | rangeDomainType;
+protected abstract getFieldType(fieldName: string, layerConfig: TypeLayerEntryConfig): 'string' | 'date' | 'number';
+```
+
+Once done I have a valid new static image layer type!
+
+### Second, Add my new layer class to loading process
+
+Next step is to add my new class to the loading process inside the [layer.ts](../../packages/geoview-core/src/geo/layer/layer.ts) class. For this I need to
+import my new class and add it to the `EVENT_NAMES.LAYER.EVENT_ADD_LAYER` switch like this
+
+```
+import { ImageStatic, layerConfigIsImageStatic } from './geoview-layers/raster/image-static';
+...
+ } else if (layerConfigIsImageStatic(layerConfig)) {
+ const imageStatic = new ImageStatic(this.mapId, layerConfig);
+ imageStatic.createGeoViewLayers().then(() => {
+ this.addToMap(imageStatic);
+ });
+ } else if (layerConfigIsWFS(layerConfig)) {
+...
+```
+
+My new layer will not load yet because I have validation errors when GeoView tries to validate that the configuration for my new layer is valid. To solve this issue,
+I need to start ith our [schema.json](../../packages/geoview-core/schema.json) configuration file. Because we added a new type `TypeSourceImageInitialConfig` we need to
+add is corresponding definition in our schema.
+
+Add the new layer type
+
+```
+"TypeGeoviewLayerType": {
+ "type": "string",
+ "items": {
+ "enum": ["esriDynamic", "esriFeature", "imageStatic", "GeoJSON", "geoCore", "GeoPackage", "xyzTiles", "ogcFeature", "ogcWfs", "ogcWms"]
+ },
+ "description": "Type of GeoView layer."
+ },
+```
+
+Add the TypeSourceImageStaticInitialConfig section. This the expected configuration for the source of our new layer
+
+```
+"TypeSourceImageStaticInitialConfig": {
+ "additionalProperties": false,
+ "type": "object",
+ "properties": {
+ "dataAccessPath": {
+ "type": "string",
+ "description": "The path to reach the data to display. If not specified, metadatAccessPath will be assigne to it."
+ },
+ "crossOrigin": {
+ "type": "string",
+ "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer."
+ },
+ "projection": {
+ "type": "integer",
+ "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada."
+ },
+ "featureInfo": {
+ "$ref": "#/definitions/TypeFeatureInfoLayerConfig"
+ },
+ "extent": {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": {
+ "type": "number"
+ },
+ "description": "The extent of the static image. Called with [minX, minY, maxX, maxY] extent coordinates."
+ }
+ }
+},
+```
+
+To finish, add our new type to `TypeSourceImageInitialConfig` defninition
+
+```
+"TypeSourceImageInitialConfig": {
+ "anyOf": [
+ ...
+ { "$ref": "#/definitions/TypeSourceImageStaticInitialConfig" }
+ ]
+},
+```
+
+Finally we need to add configuration calidation our new layer type. All layer configuration are validate at load time. This is done with our
+[config-validation](../../packages/geoview-core/src/core/utils/config/config-validation.ts) class.
+
+Import the payload function from our layer class
+
+```
+import { geoviewEntryIsImageStatic } from '../../../geo/layer/geoview-layers/raster/image-static';
+```
+
+Then add extra validation
+
+```
+private doExtraValidation(listOfGeoviewLayerConfig?: TypeListOfGeoviewLayerConfig) {
+...
+ case 'imageStatic':
+ this.geoviewLayerIdIsMandatory(geoviewLayerConfig);
+ this.processLayerEntryConfig(geoviewLayerConfig, geoviewLayerConfig, geoviewLayerConfig.listOfLayerEntryConfig);
+ break;
+...
+}
+```
+
+Lastly create the layer entry config who will be use later in the loading process
+
+```
+private processLayerEntryConfig(rootLayerConfig: TypeGeoviewLayerConfig, parentLayerConfig: TypeGeoviewLayerConfig | TypeLayerGroupEntryConfig, listOfLayerEntryConfig: TypeListOfLayerEntryConfig) {
+...} else if (geoviewEntryIsImageStatic(layerConfig)) {
+ // Value for layerConfig.entryType can only be raster
+ if (!layerConfig.entryType) layerConfig.entryType = 'raster';
+ if (!layerConfig.source.dataAccessPath) {
+ throw new Error(
+ `source.dataAccessPath on layer entry ${Layer.getLayerPath(layerConfig)} is mandatory for GeoView layer ${
+ rootLayerConfig.geoviewLayerId
+ } of type ${rootLayerConfig.geoviewLayerType}`
+ );
+ }
+ } else if (geoviewEntryIsXYZTiles(layerConfig)) {...
+}
+```
+
+### Third, Create the layer configuration
+
+Now that everything is put in place I can create my configuration to add to one of my existing map
+
+```
+{
+ 'geoviewLayerId': 'staticLYR10',
+ 'geoviewLayerName': 'Static Image',
+ 'geoviewLayerType': 'imageStatic',
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': 'thumbnail',
+ 'layerName': 'DataCube',
+ 'source': {
+ 'dataAccessPath': 'https://datacube-prod-data-public.s3.ca-central-1.amazonaws.com/store/imagery/aerial/napl/napl-ring-of-fire/napl-ring-of-fire-1954-08-07-60k-thumbnail.png',,
+ 'extent': [-87.77486341686723,
+ 51.62285357468582,
+ -84.57727128084842,
+ 53.833354975551075
+ ],
+ 'projection': 4326
+ }
+ }
+ ]
+}
+```
diff --git a/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg b/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
index c8de6523d56..8cd738863bb 100644
--- a/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
+++ b/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
@@ -483,14 +483,14 @@
Huge dataset, here as an example for using different separator and projection
{
'geoviewLayerId': 'csvLYR3',
- 'geoviewLayerName': { 'en': 'BC Shoreline Classification' },
+ 'geoviewLayerName': 'BC Shoreline Classification',
'geoviewLayerType': 'CSV',
'listOfLayerEntryConfig': [
{
'layerId': 'ShorelineClassification_BC',
- 'layerName': { 'en': 'BC Shoreline Classification' },
+ 'layerName': 'BC Shoreline Classification',
'source': {
- 'dataAccessPath': { 'en': './datasets/csv-files/ShorelineClassification_BC.csv'},
+ 'dataAccessPath': './datasets/csv-files/ShorelineClassification_BC.csv',
'dataProjection': 'EPSG:3857',
'separator': ';'
}
diff --git a/packages/geoview-core/public/templates/layers/esri-dynamic.html b/packages/geoview-core/public/templates/layers/esri-dynamic.html
index d7cb982ae21..997d035c80e 100644
--- a/packages/geoview-core/public/templates/layers/esri-dynamic.html
+++ b/packages/geoview-core/public/templates/layers/esri-dynamic.html
@@ -77,8 +77,8 @@
1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config2. Date filtering using time zone changed and non ISO date format
'listOfGeoviewLayerConfig': [
{
'geoviewLayerId': 'historical-flood',
- 'geoviewLayerName': { 'en': 'Historical Flood Events (HFE)' },
+ 'geoviewLayerName': 'Historical Flood Events (HFE)',
'externalDateFormat': 'mm/dd/yyyy hh:mm:ss-05:00',
- 'metadataAccessPath': {
- 'en': 'https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/historical_flood_event_en/MapServer'
- },
+ 'metadataAccessPath': 'https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/historical_flood_event_en/MapServer',
'geoviewLayerType': 'esriDynamic',
'listOfLayerEntryConfig': [
{
@@ -557,10 +553,8 @@
1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Slider MUI Component
Accessing slider value from outside of the core viewer using api event liste
],
track: 'normal',
onChange: (dates) => {
- const field = cgpv.api.maps.UI1.layer.getGeoviewLayerHybrid('historical-flood/0').getTemporalDimension('historical-flood/0').field;
+ const field = cgpv.api.maps.UI1.layer
+ .getGeoviewLayerHybrid('historical-flood/0')
+ .getTemporalDimension('historical-flood/0').field;
cgpv.api.maps.UI1.layer
.getGeoviewLayerHybrid('historical-flood/0')
.applyViewFilter('historical-flood/0', `${field} >= date '${dates[0]}-01-01' and ${field} <= date '${dates[1]}-12-31'`);
diff --git a/packages/geoview-core/schema.json b/packages/geoview-core/schema.json
index 959c99496b8..d6002080c1d 100644
--- a/packages/geoview-core/schema.json
+++ b/packages/geoview-core/schema.json
@@ -7,21 +7,6 @@
"comments": "Configuration for GeoView core packages, each packages manages it own schema. It correspond to the TypeMapFeaturesInstance type.",
"additionalProperties": false,
"definitions": {
- "TypeLocalizedString": {
- "additionalProperties": false,
- "minProperties": 1,
- "type": "object",
- "properties": {
- "en": {
- "type": "string",
- "description": "The English version of the string."
- },
- "fr": {
- "type": "string",
- "description": "The French version of the string. "
- }
- }
- },
"TypeFeatureInfoLayerConfig": {
"additionalProperties": false,
"type": "object",
@@ -574,8 +559,8 @@
"type": "object",
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The path (English/French) to reach the data to display. If not specified, metadataAccessPath will be assigned to it."
+ "type": "string",
+ "description": "The path to reach the data to display. If not specified, metadataAccessPath will be assigned to it."
},
"postSettings": {
"type": "object",
@@ -614,7 +599,7 @@
"type": "object",
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne dto it."
},
"crossOrigin": {
@@ -658,7 +643,7 @@
"type": "object",
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne dto it."
},
"crossOrigin": {
@@ -688,7 +673,7 @@
"type": "object",
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne dto it."
},
"crossOrigin": {
@@ -721,7 +706,7 @@
"additionalProperties": false,
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne dto it."
},
"crossOrigin": {
@@ -804,8 +789,8 @@
"description": "The id of the layer to display on the map."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"layerFilter": {
"type": "string",
@@ -850,8 +835,8 @@
"description": "The id of the layer to display on the map."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"layerFilter": {
"type": "string",
@@ -883,7 +868,7 @@
"description": "Layer sources providing vector data divided into a tile grid.",
"properties": {
"dataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
+ "type": "string",
"description": "The path (English/French) to reach the data to display. If not specified, metadatAccessPath will be assigne dto it."
},
"format": {
@@ -921,8 +906,8 @@
"description": "The ending element of the layer configuration path."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"layerFilter": {
"type": "string",
@@ -966,8 +951,8 @@
"description": "The ending element of the layer configuration path."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"layerFilter": {
"type": "string",
@@ -1011,8 +996,8 @@
"description": "The ending element of the layer configuration path."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"layerFilter": {
"type": "string",
@@ -1056,8 +1041,8 @@
"description": "The ending element of the layer configuration path."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"initialSettings": {
"$ref": "#/definitions/TypeLayerInitialSettings",
@@ -1094,8 +1079,8 @@
"description": "The id of the layer to display on the map."
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"initialSettings": {
"$ref": "#/definitions/TypeLayerInitialSettings",
@@ -1136,8 +1121,8 @@
}
},
"layerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer group (English/French)."
+ "type": "string",
+ "description": "The display name of the layer group."
},
"initialSettings": {
"$ref": "#/definitions/TypeLayerInitialSettings",
@@ -1497,12 +1482,12 @@
"description": "The id of the layer for referencing within the viewer (does not relate directly to any external service). The id will have the language extension (id-'lang')."
},
"geoviewLayerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"metadataAccessPath": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The GeoView layer access path (English/French)."
+ "type": "string",
+ "description": "The GeoView layer access path."
},
"geoviewLayerType": {
"$ref": "#/definitions/TypeGeoviewLayerType",
@@ -1544,8 +1529,8 @@
"description": "Type of GeoCore layer."
},
"geoviewLayerName": {
- "$ref": "#/definitions/TypeLocalizedString",
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information."
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"initialSettings": {
"$ref": "#/definitions/TypeLayerInitialSettings",
diff --git a/packages/geoview-core/src/api/config/config-api.ts b/packages/geoview-core/src/api/config/config-api.ts
index 01a1d6e4676..799fd9b81f7 100644
--- a/packages/geoview-core/src/api/config/config-api.ts
+++ b/packages/geoview-core/src/api/config/config-api.ts
@@ -12,7 +12,7 @@ import {
} from '@config/types/map-schema-types';
import { MapConfigError } from '@config/types/classes/config-exceptions';
-import { createLocalizedString, generateId, isJsonString, removeCommentsFromJSON } from '@/core/utils/utilities';
+import { generateId, isJsonString, removeCommentsFromJSON } from '@/core/utils/utilities';
import { logger } from '@/core//utils/logger';
/**
@@ -494,9 +494,9 @@ export class ConfigApi {
// Create a GeoView Json configuration object.
geoviewLayerConfig = toJsonObject({
geoviewLayerId: generateId(),
- geoviewLayerName: { en: 'unknown', fr: 'inconnu' },
+ geoviewLayerName: language === 'en' ? 'unknown' : 'inconnue',
geoviewLayerType: layerType,
- metadataAccessPath: createLocalizedString(serviceAccessString),
+ metadataAccessPath: serviceAccessString,
listOfLayerEntryConfig: listOfLayerId.map((layerId) => {
return { layerId };
}),
diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts
index 9d114b2d986..af93c77e216 100644
--- a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts
@@ -5,7 +5,7 @@ import { EsriGroupLayerConfig } from '@config/types/classes/sub-layer-config/gro
import { GeoviewLayerConfigError, GeoviewLayerInvalidParameterError } from '@config/types/classes/config-exceptions';
import { EntryConfigBaseClass } from '@/api/config/types/classes/sub-layer-config/entry-config-base-class';
-import { createLocalizedString, getXMLHttpRequest } from '@/core/utils/utilities';
+import { getXMLHttpRequest } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
// ========================
@@ -110,7 +110,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
if (layerId !== (serviceMetadata.name as string)) throw new GeoviewLayerInvalidParameterError('LayerIdNotFound', [layerId]);
const layerConfig = toJsonObject({
layerId,
- layerName: createLocalizedString(layerId),
+ layerName: layerId,
});
return this.createLeafNode(layerConfig, this.getLanguage(), this, parentNode)!;
}
@@ -124,7 +124,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
if (layerFound && layerFound.type !== 'Group Layer') {
const layerConfig = toJsonObject({
layerId: layerFound.id.toString(),
- layerName: createLocalizedString(layerFound.name),
+ layerName: layerFound.name,
geometryType: AbstractGeoviewEsriLayerConfig.convertEsriGeometryTypeToOLGeometryType(layerFound.geometryType as string),
});
return this.createLeafNode(layerConfig, this.getLanguage(), this, parentNode)!;
@@ -150,7 +150,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
this.createLeafNode(
toJsonObject({
layerId: serviceMetadata.name,
- layerName: createLocalizedString(serviceMetadata.name)!,
+ layerName: serviceMetadata.name!,
}),
this.getLanguage(),
this
@@ -169,7 +169,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
this.createLeafNode(
toJsonObject({
layerId: layers[0].id.toString(),
- layerName: createLocalizedString(layers[0].name)!,
+ layerName: layers[0].name!,
geometryType: AbstractGeoviewEsriLayerConfig.convertEsriGeometryTypeToOLGeometryType(layers[0].geometryType as string),
}),
this.getLanguage(),
@@ -217,7 +217,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
accumulator.push(
toJsonObject({
layerId: layer.id.toString(),
- layerName: createLocalizedString(layer.name),
+ layerName: layer.name,
geometryType: AbstractGeoviewEsriLayerConfig.convertEsriGeometryTypeToOLGeometryType(layer.geometryType as string),
})
);
@@ -228,7 +228,7 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye
return toJsonObject({
layerId: parentId === -1 ? groupName : `${parentId}`,
- layerName: createLocalizedString(groupName),
+ layerName: groupName,
isLayerGroup: true,
listOfLayerEntryConfig,
});
diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts
index 33295f438ab..25d8e7bd90a 100644
--- a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts
@@ -3,12 +3,12 @@ import cloneDeep from 'lodash/cloneDeep';
import { Cast, TypeJsonObject, TypeJsonArray } from '@config/types/config-types';
import { TypeGeoviewLayerType, TypeDisplayLanguage } from '@config/types/map-schema-types';
-import { isvalidComparedToInputSchema, isvalidComparedToInternalSchema, normalizeLocalizedString } from '@config/utils';
+import { isvalidComparedToInputSchema, isvalidComparedToInternalSchema } from '@config/utils';
import { layerEntryIsGroupLayer } from '@config/types/type-guards';
import { EntryConfigBaseClass } from '@config/types/classes/sub-layer-config/entry-config-base-class';
import { ConfigError, GeoviewLayerConfigError } from '@config/types/classes/config-exceptions';
-import { createLocalizedString, generateId } from '@/core/utils/utilities';
+import { generateId } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
// ========================
@@ -105,9 +105,9 @@ export abstract class AbstractGeoviewLayerConfig {
// GV: GeoCore layers are processed by the configApi. GeoView layer instances do not recognize them as a valid geoView layer Type.
// GV: However, whe have the isGeocore flag to keep track of geocore layers that were converted to geoview layers.
this.isGeocore = (userGeoviewLayerConfig.isGeocore as boolean) || false;
- if (this.isGeocore) this.geoviewLayerName = userGeoviewLayerConfig.geoviewLayerName[this.#language] as string;
+ if (this.isGeocore) this.geoviewLayerName = userGeoviewLayerConfig.geoviewLayerName as string;
this.geoviewLayerId = (userGeoviewLayerConfig.geoviewLayerId || generateId()) as string;
- this.metadataAccessPath = normalizeLocalizedString(userGeoviewLayerConfig.metadataAccessPath)![this.#language]!;
+ this.metadataAccessPath = userGeoviewLayerConfig.metadataAccessPath as string;
// Validate the structure of the sublayer list and correct it if needed.
switch ((this.#userGeoviewLayerConfig?.listOfLayerEntryConfig as TypeJsonArray)?.length) {
@@ -123,7 +123,7 @@ export abstract class AbstractGeoviewLayerConfig {
(this.#userGeoviewLayerConfig.listOfLayerEntryConfig as TypeJsonArray) = [
Cast({
layerId: this.#userGeoviewLayerConfig.geoviewLayerId,
- layerName: { ...(this.#userGeoviewLayerConfig.geoviewLayerName as object) },
+ layerName: this.#userGeoviewLayerConfig.geoviewLayerName,
isLayerGroup: true,
listOfLayerEntryConfig: this.#userGeoviewLayerConfig.listOfLayerEntryConfig as TypeJsonArray,
}),
@@ -290,7 +290,7 @@ export abstract class AbstractGeoviewLayerConfig {
layerTreeFilter = [
Cast({
layerId: this.geoviewLayerId,
- layerName: createLocalizedString(this.geoviewLayerName),
+ layerName: this.geoviewLayerName,
isLayerGroup: true,
listOfLayerEntryConfig: layerTreeFilter,
}),
@@ -458,19 +458,17 @@ export abstract class AbstractGeoviewLayerConfig {
// configuration because we're modifying it and don't want it to leak back to the original object.
const geoviewLayerConfig = cloneDeep(userGeoviewLayerConfig || this.#userGeoviewLayerConfig);
- if (geoviewLayerConfig.geoviewLayerName) this.geoviewLayerName = geoviewLayerConfig.geoviewLayerName[this.#language] as string;
+ if (geoviewLayerConfig.geoviewLayerName) this.geoviewLayerName = geoviewLayerConfig.geoviewLayerName as string;
if (geoviewLayerConfig.serviceDateFormat) this.serviceDateFormat = geoviewLayerConfig.serviceDateFormat as string;
if (geoviewLayerConfig.externalDateFormat) this.externalDateFormat = geoviewLayerConfig.externalDateFormat as string;
const convertUserConfigToInternalConfig = (listOfLayerEntryConfig: TypeJsonArray): TypeJsonArray => {
return listOfLayerEntryConfig.map((sublayer): TypeJsonObject => {
- // We disable the eslint no-param-reassign because we want to keep the modifications made to the object passed as parameter.
- // eslint-disable-next-line no-param-reassign
- if (sublayer.layerName) sublayer.layerName = sublayer.layerName[this.#language];
if (sublayer.isLayerGroup) convertUserConfigToInternalConfig(sublayer.listOfLayerEntryConfig as TypeJsonArray);
return sublayer;
});
};
+
const internalConfig = convertUserConfigToInternalConfig(geoviewLayerConfig.listOfLayerEntryConfig as TypeJsonArray);
this.listOfLayerEntryConfig = mergeWith(this.listOfLayerEntryConfig, internalConfig, (target, newValue, key) => {
// Keep the listOfLayerEntryConfig as it is. Do not replace it with the user' array. Only the internal properties will be replaced.
diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/wms-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/wms-config.ts
index 85214d2e32c..acfc71d13e8 100644
--- a/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/wms-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/wms-config.ts
@@ -11,7 +11,7 @@ import { layerEntryIsGroupLayer } from '@config/types/type-guards';
import { GeoviewLayerConfigError, GeoviewLayerInvalidParameterError } from '@config/types/classes/config-exceptions';
import { logger } from '@/core/utils/logger';
-import { createLocalizedString, xmlToJson } from '@/core/utils/utilities';
+import { xmlToJson } from '@/core/utils/utilities';
export type TypeWmsLayerNode = WmsGroupLayerConfig | WmsLayerEntryConfig;
@@ -191,7 +191,7 @@ export class WmsLayerConfig extends AbstractGeoviewLayerConfig {
// Create a single layer using the metadata
const layerConfig = toJsonObject({
layerId: metadataLayer.Name,
- layerName: createLocalizedString(metadataLayer.Name),
+ layerName: metadataLayer.Name,
});
return [this.createLeafNode(layerConfig, this.getLanguage(), this)!];
}
@@ -222,7 +222,7 @@ export class WmsLayerConfig extends AbstractGeoviewLayerConfig {
// Create the layer using the metadata
const layerConfig = toJsonObject({
layerId,
- layerName: createLocalizedString(layerFound.Title),
+ layerName: layerFound.Title,
});
return this.createLeafNode(layerConfig, this.getLanguage(), this, parentNode)!;
}
@@ -247,7 +247,7 @@ export class WmsLayerConfig extends AbstractGeoviewLayerConfig {
accumulator.push(
toJsonObject({
layerId: layer.Name,
- layerName: createLocalizedString(layer.Name),
+ layerName: layer.Name,
})
);
}
@@ -256,7 +256,7 @@ export class WmsLayerConfig extends AbstractGeoviewLayerConfig {
return toJsonObject({
layerId: groupId,
- layerName: createLocalizedString(groupId),
+ layerName: groupId,
isLayerGroup: true,
listOfLayerEntryConfig,
});
@@ -265,7 +265,7 @@ export class WmsLayerConfig extends AbstractGeoviewLayerConfig {
/** ***************************************************************************************************************************
* This method reads the service metadata from a XML metadataAccessPath.
*
- * @param {string} metadataUrl The localized value of the metadataAccessPath
+ * @param {string} metadataUrl The metadataAccessPath
*
* @returns {Promise} A promise that the execution is completed.
* @private @async
diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts
index e050e29cdb8..81b74fd9c54 100644
--- a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts
@@ -10,7 +10,6 @@ import { GeoviewLayerConfigError, GeoviewLayerInvalidParameterError } from '@con
import { layerEntryIsGroupLayer } from '@config/types/type-guards';
import { mergeWith } from 'lodash';
import { logger } from '@/core/utils/logger';
-import { createLocalizedString } from '@/core/utils/utilities';
import { Cast } from '@/app';
export type TypeGeoJsonLayerNode = GeoJsonGroupLayerConfig | GeoJsonLayerEntryConfig;
@@ -56,7 +55,7 @@ export class GeoJsonLayerConfig extends AbstractGeoviewLayerConfig {
logger.logError('When a GeoJson metadataAccessPath ends with a layer file name, the listOfLayerEntryConfig must be empty.');
}
this.listOfLayerEntryConfig = [
- this.createLeafNode(toJsonObject({ layerId: lastPathItem, layerName: createLocalizedString(lastPathItem) }), language, this)!,
+ this.createLeafNode(toJsonObject({ layerId: lastPathItem, layerName: lastPathItem }), language, this)!,
];
}
}
@@ -163,12 +162,7 @@ export class GeoJsonLayerConfig extends AbstractGeoviewLayerConfig {
protected override createLayerEntryNode(layerId: string, parentNode: EntryConfigBaseClass | undefined): EntryConfigBaseClass {
// GV: To determine if service metadata exists, we must verify that the object is not empty.
if (Object.keys(this.getServiceMetadata()).length === 0)
- return this.createLeafNode(
- toJsonObject({ layerId, layerName: createLocalizedString(layerId) }),
- this.getLanguage(),
- this,
- parentNode
- )!;
+ return this.createLeafNode(toJsonObject({ layerId, layerName: layerId }), this.getLanguage(), this, parentNode)!;
// If we cannot find the layerId in the layer definitions, throw an error.
const layerFound = this.findLayerMetadataEntry(layerId);
@@ -177,7 +171,7 @@ export class GeoJsonLayerConfig extends AbstractGeoviewLayerConfig {
}
const layerConfig = mergeWith({}, layerFound, (destValue, sourceValue, key) => {
- if (key === 'layerName') return createLocalizedString(sourceValue);
+ if (key === 'layerName') return sourceValue;
return undefined;
});
@@ -203,7 +197,7 @@ export class GeoJsonLayerConfig extends AbstractGeoviewLayerConfig {
});
const layerConfig = mergeWith({}, layerTree, (destValue, sourceValue, key) => {
- if (key === 'layerName') return createLocalizedString(sourceValue);
+ if (key === 'layerName') return sourceValue;
return undefined;
}) as TypeJsonObject;
diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/wfs-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/wfs-config.ts
index ce2074a6713..267d92f7fbc 100644
--- a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/wfs-config.ts
+++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/wfs-config.ts
@@ -8,7 +8,7 @@ import { EntryConfigBaseClass } from '@config/types/classes/sub-layer-config/ent
import { GeoviewLayerConfigError, GeoviewLayerInvalidParameterError } from '@config/types/classes/config-exceptions';
import { logger } from '@/core/utils/logger';
-import { createLocalizedString, findPropertyNameByRegex, getXMLHttpRequest, xmlToJson } from '@/core/utils/utilities';
+import { findPropertyNameByRegex, getXMLHttpRequest, xmlToJson } from '@/core/utils/utilities';
export type TypeWfsLayerNode = WfsGroupLayerConfig | WfsLayerEntryConfig;
@@ -137,12 +137,12 @@ export class WfsLayerConfig extends AbstractGeoviewLayerConfig {
if (featureType.length > 1) {
const groupConfig = toJsonObject({
layerId: this.geoviewLayerId,
- layerName: { en: 'Layer Group', fr: 'Groupe de couches' },
+ layerName: this.getLanguage() === 'en' ? 'Layer Group' : 'Groupe de couches',
isLayerGroup: true,
listOfLayerEntryConfig: featureType.map((layerMetadata) => {
return toJsonObject({
layerId: layerMetadata.Name['#text'],
- layerName: createLocalizedString(layerMetadata.Title['#text']),
+ layerName: layerMetadata.Title['#text'],
});
}),
});
@@ -152,7 +152,7 @@ export class WfsLayerConfig extends AbstractGeoviewLayerConfig {
// Create a single layer using the metadata.
const layerConfig = toJsonObject({
layerId: featureType[0].Name['#text'],
- layerName: createLocalizedString(featureType[0].Title['#text']),
+ layerName: featureType[0].Title['#text'],
});
return [this.createLeafNode(layerConfig, this.getLanguage(), this)!];
}
@@ -177,7 +177,7 @@ export class WfsLayerConfig extends AbstractGeoviewLayerConfig {
// Create the layer using the metadata. WFS metadata has no layer group definition.
const layerConfig = toJsonObject({
layerId,
- layerName: createLocalizedString(layerFound.Title['#text']),
+ layerName: layerFound.Title['#text'],
});
return this.createLeafNode(layerConfig, this.getLanguage(), this, parentNode)!;
}
diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/entry-config-base-class.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/entry-config-base-class.ts
index 96c777b6a34..b030c816913 100644
--- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/entry-config-base-class.ts
+++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/entry-config-base-class.ts
@@ -105,7 +105,7 @@ export abstract class EntryConfigBaseClass {
this.#parentNode = parentNode;
this.layerId = layerConfig.layerId as string;
- this.layerName = (layerConfig?.layerName?.[this.#language] as string) || 'undefined';
+ this.layerName = (layerConfig?.layerName as string) || 'undefined';
this.entryType = this.getEntryType();
this.isLayerGroup = (layerConfig.isLayerGroup as boolean) || false;
diff --git a/packages/geoview-core/src/api/config/types/config-validation-schema.json b/packages/geoview-core/src/api/config/types/config-validation-schema.json
index 7f9ba66dc47..27c2ffda854 100644
--- a/packages/geoview-core/src/api/config/types/config-validation-schema.json
+++ b/packages/geoview-core/src/api/config/types/config-validation-schema.json
@@ -365,34 +365,16 @@
"type": "boolean"
},
"geoviewLayerName": {
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.",
- "oneOf": [
- {
- "description": "Used by the input schema.",
- "$ref": "#/definitions/TypeLocalizedString"
- },
- {
- "description": "Used by the internal schema.",
- "type": "string"
- }
- ]
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"isGeocore": {
"description": "A flag used to indicate that the layer is a GeoCore layer.",
"type": "boolean"
},
"metadataAccessPath": {
- "description": "The GeoView layer service access path (English/French).",
- "oneOf": [
- {
- "description": "Used by the input schema.",
- "$ref": "#/definitions/TypeLocalizedString"
- },
- {
- "description": "Used by the internal schema.",
- "type": "string"
- }
- ]
+ "type": "string",
+ "description": "The GeoView layer service access path."
},
"geoviewLayerType": {
"description": "Type of GeoView layer.",
@@ -435,7 +417,7 @@
"type": "string"
},
"metadataAccessPath": {
- "description": "The GeoView layer service access path (English/French).",
+ "description": "The GeoView layer service access path.",
"type": "string"
}
}
@@ -444,12 +426,12 @@
"description": "Use Input Schema",
"properties": {
"geoviewLayerName": {
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.",
- "$ref": "#/definitions/TypeLocalizedString"
+ "type": "string",
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"metadataAccessPath": {
- "description": "The GeoView layer service access path (English/French).",
- "$ref": "#/definitions/TypeLocalizedString"
+ "type": "string",
+ "description": "The GeoView layer service access path."
}
}
},
@@ -572,21 +554,6 @@
"description": "Display languages supported.",
"enum": ["en", "fr"]
},
- "TypeLocalizedString": {
- "additionalProperties": false,
- "minProperties": 1,
- "type": "object",
- "properties": {
- "en": {
- "description": "The English version of the string.",
- "type": "string"
- },
- "fr": {
- "description": "The French version of the string.",
- "type": "string"
- }
- }
- },
"TypeGeoviewLayerType": {
"description": "Type of GeoView layer.",
"type": "string",
@@ -914,17 +881,8 @@
"type": "boolean"
},
"layerName": {
- "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.",
- "oneOf": [
- {
- "description": "Used by the input schema.",
- "$ref": "#/definitions/TypeLocalizedString"
- },
- {
- "description": "Used by the internal schema.",
- "type": "string"
- }
- ]
+ "description": "The display name of the layer. If it is not present the viewer will make an attempt to scrape this information.",
+ "type": "string"
},
"attributions": {
"type": "array",
@@ -986,8 +944,8 @@
"description": "Use Input Schema",
"properties": {
"layerName": {
- "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.",
- "$ref": "#/definitions/TypeLocalizedString"
+ "type": "string",
+ "description": "Used by the input schema. The display name of the layer. If it is not present the viewer will make an attempt to scrape this information."
},
"entryType": {
"description": "Input schema does not allow the user to specify the entryType property.",
@@ -1597,7 +1555,7 @@
"type": "string"
},
"range": {
- "type":"array",
+ "type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
diff --git a/packages/geoview-core/src/api/config/types/map-schema-types.ts b/packages/geoview-core/src/api/config/types/map-schema-types.ts
index 657085e69f0..08f27848c2f 100644
--- a/packages/geoview-core/src/api/config/types/map-schema-types.ts
+++ b/packages/geoview-core/src/api/config/types/map-schema-types.ts
@@ -11,17 +11,6 @@ export type Extent = Array;
/** ISO 639-1 language code prefix. */
export type TypeDisplayLanguage = 'en' | 'fr';
-export type TypeLocalizedString = TypeLocalizedStringEnAndFr | TypeLocalizedStringFr | TypeLocalizedStringEn;
-
-/** Definition of a bilingual string, only English provided. */
-export type TypeLocalizedStringEn = Pick & Partial>;
-
-/** Definition of a bilingual string, only French provided. */
-export type TypeLocalizedStringFr = Pick & Partial>;
-
-/** Definition of a bilingual string, both English and French provided. */
-export type TypeLocalizedStringEnAndFr = Required>;
-
/** Definition of the post settings type needed when the GeoView GeoJSON layers need to use a POST instead of a GET. */
export type TypePostSettings = { header?: Record; data: unknown };
diff --git a/packages/geoview-core/src/api/config/utils.ts b/packages/geoview-core/src/api/config/utils.ts
index 12edc4199bd..abde860efec 100644
--- a/packages/geoview-core/src/api/config/utils.ts
+++ b/packages/geoview-core/src/api/config/utils.ts
@@ -3,10 +3,9 @@ import addErrors from 'ajv-errors';
import cloneDeep from 'lodash/cloneDeep';
import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LAYER_TYPES } from '@config/types/config-constants';
-import { TypeJsonObject } from '@config/types/config-types';
import schema from '@config/types/config-validation-schema.json';
import { MapFeatureConfig } from '@config/types/classes/map-feature-config';
-import { TypeGeoviewLayerType, TypeLayerEntryType, TypeLocalizedString } from '@config/types/map-schema-types';
+import { TypeGeoviewLayerType, TypeLayerEntryType } from '@config/types/map-schema-types';
import { EntryConfigBaseClass } from '@/api/config/types/classes/sub-layer-config/entry-config-base-class';
import { logger } from '@/core/utils/logger';
@@ -110,20 +109,3 @@ export function isvalidComparedToInternalSchema(schemaPath: string, targetObject
if (useInternalSchema) Object.assign(targetObjectToValidate, { useInternalSchema });
return isvalidComparedToInputSchema(schemaPath, targetObjectToValidate);
}
-
-/**
- * Normalize the localized string parameter. If a language is set and the other is not, the undefined language is set to
- * the value of the other.
- * @param {TypeLocalizedString | TypeJsonObject} localizedString The localized string to normalize.
- *
- * @returns {TypeLocalizedString | undefined} A normalized localized string.
- */
-export function normalizeLocalizedString(localizedString: TypeLocalizedString | TypeJsonObject): TypeLocalizedString | undefined {
- const returnValue = { en: localizedString?.en as string, fr: localizedString?.fr as string } as TypeLocalizedString;
- if (localizedString && (returnValue.en || returnValue.fr)) {
- if (!returnValue.fr) returnValue.fr = returnValue.en;
- if (!returnValue.en) returnValue.en = returnValue.fr;
- return returnValue;
- }
- return undefined;
-}
diff --git a/packages/geoview-core/src/api/config/uuid-config-reader.ts b/packages/geoview-core/src/api/config/uuid-config-reader.ts
index 3cd63d58cd4..2e50c04b183 100644
--- a/packages/geoview-core/src/api/config/uuid-config-reader.ts
+++ b/packages/geoview-core/src/api/config/uuid-config-reader.ts
@@ -2,7 +2,7 @@ import axios, { AxiosResponse } from 'axios';
import { TypeJsonObject, TypeJsonArray, toJsonObject } from '@config/types/config-types';
import { CV_CONST_LAYER_TYPES } from '@config/types/config-constants';
-import { createLocalizedString, deepMergeObjects } from '@/core/utils/utilities';
+import { deepMergeObjects } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
// The GeoChart Json object coming out of the GeoCore response
@@ -65,11 +65,12 @@ export class UUIDmapConfigReader {
const isFeature = (url as string).indexOf('FeatureServer') > -1;
+ // TODO: Simplify this wherever possible
if (layerType === CV_CONST_LAYER_TYPES.ESRI_DYNAMIC && !isFeature) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.ESRI_DYNAMIC,
isGeocore: true,
isTimeAware,
@@ -91,8 +92,8 @@ export class UUIDmapConfigReader {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(serviceUrl),
+ geoviewLayerName: name,
+ metadataAccessPath: serviceUrl,
geoviewLayerType: CV_CONST_LAYER_TYPES.ESRI_FEATURE,
isGeocore: true,
isTimeAware,
@@ -106,8 +107,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.ESRI_FEATURE) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.ESRI_FEATURE,
isGeocore: true,
isTimeAware,
@@ -123,8 +124,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.WMS) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.WMS,
isGeocore: true,
isTimeAware,
@@ -151,8 +152,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.WFS) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.WFS,
isGeocore: true,
isTimeAware,
@@ -172,8 +173,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.OGC_FEATURE) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.OGC_FEATURE,
isGeocore: true,
isTimeAware,
@@ -192,8 +193,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.GEOJSON) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.GEOJSON,
isGeocore: true,
isTimeAware,
@@ -212,8 +213,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.XYZ_TILES) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.XYZ_TILES,
isGeocore: true,
isTimeAware,
@@ -229,8 +230,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.VECTOR_TILES) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.VECTOR_TILES,
isGeocore: true,
isTimeAware,
@@ -241,7 +242,7 @@ export class UUIDmapConfigReader {
layerId: `${item.id}`,
tileGrid: item.tileGrid,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url,
},
});
}
@@ -250,8 +251,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.GEOPACKAGE) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.GEOPACKAGE,
isGeocore: true,
isTimeAware,
@@ -270,8 +271,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CV_CONST_LAYER_TYPES.IMAGE_STATIC) {
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.IMAGE_STATIC,
isTimeAware,
});
@@ -289,8 +290,8 @@ export class UUIDmapConfigReader {
// GV: but we need to create a layerEntryConfig in the list for the layer to be displayed.
const geoviewLayerConfig = toJsonObject({
geoviewLayerId: `${id}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name,
+ metadataAccessPath: url,
geoviewLayerType: CV_CONST_LAYER_TYPES.ESRI_IMAGE,
isGeocore: true,
isTimeAware,
diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts
index 17aa12e5467..4666b40043a 100644
--- a/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts
+++ b/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts
@@ -10,7 +10,6 @@ import {
} from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { ConfigBaseClass } from '@/core/utils/config/validation-classes/config-base-class';
import { ILayerState, TypeLegend, TypeLegendResultSetEntry } from '@/core/stores/store-interface-and-intial-values/layer-state';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { AbstractEventProcessor } from '@/api/event-processors/abstract-event-processor';
import {
@@ -20,7 +19,6 @@ import {
isUniqueValueStyleConfig,
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
-import { AppEventProcessor } from './app-event-processor';
import { MapEventProcessor } from './map-event-processor';
// GV Important: See notes in header of MapEventProcessor file for information on the paradigm to apply when working with UIEventProcessor vs UIState
@@ -272,9 +270,9 @@ export class LegendEventProcessor extends AbstractEventProcessor {
// Interpret the layer name the best we can
const layerName =
- getLocalizedValue(layer?.getLayerName(entryLayerPath), AppEventProcessor.getDisplayLanguage(mapId)) ||
- getLocalizedValue(layerConfig.layerName, AppEventProcessor.getDisplayLanguage(mapId)) ||
- getLocalizedValue(layerConfig.geoviewLayerConfig.geoviewLayerName, AppEventProcessor.getDisplayLanguage(mapId)) ||
+ layer?.getLayerName(entryLayerPath) ||
+ layerConfig.layerName ||
+ layerConfig.geoviewLayerConfig.geoviewLayerName ||
layerConfig.layerPath;
let entryIndex = existingEntries.findIndex((entry) => entry.layerPath === entryLayerPath);
diff --git a/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx b/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
index 60b6a72ecd1..e7a938a54d5 100644
--- a/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
+++ b/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
@@ -24,7 +24,6 @@ import { TypeWFSLayerConfig, WFS as WfsGeoviewClass } from '@/geo/layer/geoview-
import { TypeCSVLayerConfig, CSV as CsvGeoviewClass } from '@/geo/layer/geoview-layers/vector/csv';
import { Cast, TypeJsonArray, TypeJsonObject } from '@/core/types/global-types';
import { useGeoViewMapId } from '@/core/stores/geoview-store';
-import { createLocalizedString } from '@/core/utils/utilities';
import { useLayerStoreActions } from '@/core/stores/store-interface-and-intial-values/layer-state';
import { api } from '@/app';
import { logger } from '@/core/utils/logger';
@@ -215,7 +214,7 @@ export function AddNewLayer(): JSX.Element {
const wmsGeoviewLayerConfig = {
geoviewLayerType: WMS,
listOfLayerEntryConfig: [] as OgcWmsLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(accessPath),
+ metadataAccessPath: accessPath,
} as TypeWMSLayerConfig;
const wmsGeoviewLayerInstance = new WmsGeoviewClass(mapId, wmsGeoviewLayerConfig);
// Synchronize the geoviewLayerId.
@@ -248,7 +247,7 @@ export function AddNewLayer(): JSX.Element {
new OgcWmsLayerEntryConfig({
geoviewLayerConfig: wmsGeoviewLayerConfig,
layerId: childLayer.Name as string,
- layerName: createLocalizedString(childLayer.Title as string),
+ layerName: childLayer.Title as string,
} as OgcWmsLayerEntryConfig)
);
}
@@ -263,7 +262,7 @@ export function AddNewLayer(): JSX.Element {
}
if (layers.length === 1) {
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} else {
setLayerList(layers);
@@ -291,7 +290,7 @@ export function AddNewLayer(): JSX.Element {
const wfsGeoviewLayerConfig = {
geoviewLayerType: WFS,
listOfLayerEntryConfig: [] as WfsLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL),
+ metadataAccessPath: layerURL,
} as TypeWFSLayerConfig;
const wfsGeoviewLayerInstance = new WfsGeoviewClass(mapId, wfsGeoviewLayerConfig);
// Synchronize the geoviewLayerId.
@@ -306,12 +305,12 @@ export function AddNewLayer(): JSX.Element {
new WfsLayerEntryConfig({
geoviewLayerConfig: wfsGeoviewLayerConfig,
layerId: (aFeatureType.Name['#text'] as string).split(':')[1] as string,
- layerName: createLocalizedString(aFeatureType.Title['#text'] as string),
+ layerName: aFeatureType.Title['#text'] as string,
} as WfsLayerEntryConfig)
);
if (layers.length === 1) {
- setLayerName(layers[0].layerName!.en! as string);
+ setLayerName(layers[0].layerName as string);
setLayerEntries([layers[0]]);
} else {
setLayerList(layers);
@@ -334,7 +333,7 @@ export function AddNewLayer(): JSX.Element {
const ogcFeatureGeoviewLayerConfig = {
geoviewLayerType: OGC_FEATURE,
listOfLayerEntryConfig: [] as OgcFeatureLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL.split('collections')[0]),
+ metadataAccessPath: layerURL.split('collections')[0],
} as TypeOgcFeatureLayerConfig;
const ogcFeatureInstance = new OgcFeature(mapId, ogcFeatureGeoviewLayerConfig);
// Synchronize the geoviewLayerId.
@@ -359,7 +358,7 @@ export function AddNewLayer(): JSX.Element {
setLayerEntries([
new TypeOgcFeatureLayerEntryConfig({
layerId: ogcFeatureMetadata.id as string,
- layerName: createLocalizedString(ogcFeatureMetadata.title as string),
+ layerName: ogcFeatureMetadata.title as string,
} as TypeOgcFeatureLayerEntryConfig),
]);
setLayerName(ogcFeatureMetadata.title as string);
@@ -380,7 +379,7 @@ export function AddNewLayer(): JSX.Element {
new OgcFeatureLayerEntryConfig({
geoviewLayerConfig: ogcFeatureGeoviewLayerConfig,
layerId: aFeatureType.id as string,
- layerName: createLocalizedString(aFeatureType.title as string),
+ layerName: aFeatureType.title as string,
} as OgcFeatureLayerEntryConfig)
);
}
@@ -394,13 +393,13 @@ export function AddNewLayer(): JSX.Element {
new OgcFeatureLayerEntryConfig({
geoviewLayerConfig: ogcFeatureGeoviewLayerConfig,
layerId: aFeatureType.id as string,
- layerName: createLocalizedString(aFeatureType.title as string),
+ layerName: aFeatureType.title as string,
} as OgcFeatureLayerEntryConfig)
);
}
if (layers.length === 1) {
- setLayerName(layers[0].layerName!.en! as string);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} else {
setLayerList(layers);
@@ -426,7 +425,7 @@ export function AddNewLayer(): JSX.Element {
const layers = await geoCoreGeoviewLayerInstance.createLayersFromUUID(layerURL);
if (layers.length === 1) {
if (layers.length === 1) {
- setLayerName(layers[0].geoviewLayerName!.en! as string);
+ setLayerName(layers[0].geoviewLayerName!);
setLayerEntries(layers);
} else {
setLayerList(layers);
@@ -453,12 +452,12 @@ export function AddNewLayer(): JSX.Element {
? ({
geoviewLayerType: type,
listOfLayerEntryConfig: [] as EsriDynamicLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL),
+ metadataAccessPath: layerURL,
} as TypeEsriDynamicLayerConfig)
: ({
geoviewLayerType: type,
listOfLayerEntryConfig: [] as EsriFeatureLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL.substring(0, layerURL.lastIndexOf('/'))),
+ metadataAccessPath: layerURL.substring(0, layerURL.lastIndexOf('/')),
} as TypeEsriFeatureLayerConfig);
const esriGeoviewLayerInstance =
type === ESRI_DYNAMIC
@@ -481,7 +480,7 @@ export function AddNewLayer(): JSX.Element {
new EsriDynamicLayerEntryConfig({
geoviewLayerConfig: esriGeoviewLayerConfig,
layerId: aLayer.id as string,
- layerName: createLocalizedString(aLayer.name as string),
+ layerName: aLayer.name as string,
} as EsriDynamicLayerEntryConfig)
)
);
@@ -490,13 +489,13 @@ export function AddNewLayer(): JSX.Element {
new EsriFeatureLayerEntryConfig({
geoviewLayerConfig: esriGeoviewLayerConfig,
layerId: esriMetadata.layers[0].id as string,
- layerName: createLocalizedString(esriMetadata.layers[0].name as string),
+ layerName: esriMetadata.layers[0].name as string,
} as EsriFeatureLayerEntryConfig)
);
}
if (layers.length === 1) {
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName);
setLayerEntries([layers[0]]);
} else {
setLayerList(layers);
@@ -522,7 +521,7 @@ export function AddNewLayer(): JSX.Element {
const esriImageGeoviewLayerConfig = {
geoviewLayerType: ESRI_IMAGE,
listOfLayerEntryConfig: [] as EsriImageLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL),
+ metadataAccessPath: layerURL,
} as TypeEsriImageLayerConfig;
const esriImageGeoviewLayerInstance = new EsriImage(mapId, esriImageGeoviewLayerConfig);
// Synchronize the geoviewLayerId.
@@ -533,15 +532,13 @@ export function AddNewLayer(): JSX.Element {
new EsriImageLayerEntryConfig({
geoviewLayerConfig: esriImageGeoviewLayerConfig,
layerId: esriImageGeoviewLayerConfig.geoviewLayerId,
- layerName: createLocalizedString(
- typeof esriImageGeoviewLayerInstance.metadata?.name === 'string' ? esriImageGeoviewLayerInstance.metadata?.name : ''
- ),
+ layerName: typeof esriImageGeoviewLayerInstance.metadata?.name === 'string' ? esriImageGeoviewLayerInstance.metadata?.name : '',
source: {
- dataAccessPath: createLocalizedString(layerURL),
+ dataAccessPath: layerURL,
},
} as EsriImageLayerEntryConfig),
];
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} catch (err) {
emitErrorServer('ESRI Image');
@@ -578,13 +575,13 @@ export function AddNewLayer(): JSX.Element {
new XYZTilesLayerEntryConfig({
geoviewLayerConfig: xyzGeoviewLayerConfig,
layerId: xyzGeoviewLayerConfig.geoviewLayerId,
- layerName: createLocalizedString(''),
+ layerName: '',
source: {
- dataAccessPath: createLocalizedString(layerURL),
+ dataAccessPath: layerURL,
},
} as XYZTilesLayerEntryConfig),
];
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} catch (err) {
emitErrorServer('XYZ Tile');
@@ -615,14 +612,14 @@ export function AddNewLayer(): JSX.Element {
new CsvLayerEntryConfig({
geoviewLayerConfig: csvGeoviewLayerConfig,
layerId: csvGeoviewLayerConfig.geoviewLayerId,
- layerName: createLocalizedString(''),
+ layerName: '',
schemaTag: CONST_LAYER_TYPES.CSV,
source: {
- dataAccessPath: createLocalizedString(layerURL),
+ dataAccessPath: layerURL,
},
} as CsvLayerEntryConfig),
];
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} catch (err) {
emitErrorServer('CSV');
@@ -645,7 +642,7 @@ export function AddNewLayer(): JSX.Element {
const geojsonGeoviewLayerConfig = {
geoviewLayerType: GEOJSON,
listOfLayerEntryConfig: [] as GeoJSONLayerEntryConfig[],
- metadataAccessPath: createLocalizedString(layerURL),
+ metadataAccessPath: layerURL,
} as TypeGeoJSONLayerConfig;
const geojsonGeoviewLayerInstance = new GeoJSON(mapId, geojsonGeoviewLayerConfig);
// Synchronize the geoviewLayerId.
@@ -660,7 +657,7 @@ export function AddNewLayer(): JSX.Element {
ConfigValidation.validateListOfGeoviewLayerConfig(api.maps[mapId].getDisplayLanguage(), [geojsonGeoviewLayerConfig]);
const layers = geojsonGeoviewLayerConfig.listOfLayerEntryConfig;
if (layers.length === 1) {
- setLayerName(layers[0].layerName!.en! as string);
+ setLayerName(layers[0].layerName as string);
setLayerEntries([Cast(layers[0])]);
} else {
setLayerList(Cast(layers));
@@ -681,13 +678,13 @@ export function AddNewLayer(): JSX.Element {
new GeoJSONLayerEntryConfig({
geoviewLayerConfig: geojsonGeoviewLayerConfig,
layerId: geojsonGeoviewLayerConfig.geoviewLayerId,
- layerName: createLocalizedString(''),
+ layerName: '',
source: {
- dataAccessPath: createLocalizedString(layerURL),
+ dataAccessPath: layerURL,
},
} as GeoJSONLayerEntryConfig),
];
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
}
} catch (err) {
@@ -718,13 +715,13 @@ export function AddNewLayer(): JSX.Element {
new GeoPackageLayerEntryConfig({
geoviewLayerConfig: geoPackageGeoviewLayerConfig,
layerId: geoPackageGeoviewLayerConfig.geoviewLayerId,
- layerName: createLocalizedString(''),
+ layerName: '',
source: {
- dataAccessPath: createLocalizedString(layerURL),
+ dataAccessPath: layerURL,
},
} as GeoPackageLayerEntryConfig),
];
- setLayerName(layers[0].layerName!.en!);
+ setLayerName(layers[0].layerName!);
setLayerEntries([layers[0]]);
} catch (err) {
emitErrorServer('GeoPackage');
@@ -894,8 +891,8 @@ export function AddNewLayer(): JSX.Element {
geoviewLayerConfig.listOfLayerEntryConfig = layerEntries as TypeLayerEntryConfig[];
// TODO: Bug - Fix this layer naming not working, wasn't working before the refactor either, leaving it as-is
- geoviewLayerConfig.geoviewLayerName = createLocalizedString(layerName);
- if (layerType === XYZ_TILES) (layerEntries[0] as TypeLayerEntryConfig).layerName = createLocalizedString(layerName);
+ geoviewLayerConfig.geoviewLayerName = layerName;
+ if (layerType === XYZ_TILES) (layerEntries[0] as TypeLayerEntryConfig).layerName = layerName;
if (geoviewLayerConfig.listOfLayerEntryConfig.length === 1)
geoviewLayerConfig.listOfLayerEntryConfig[0].layerName = geoviewLayerConfig.geoviewLayerName;
@@ -992,13 +989,13 @@ export function AddNewLayer(): JSX.Element {
if (isMultiple()) {
if (!((newValue as TypeLayerEntryConfig[]).length === 0)) {
setLayerEntries(newValue as TypeLayerEntryConfig[]);
- setLayerName((newValue as TypeLayerEntryConfig[]).map((layerConfig) => layerConfig.layerName!.en).join(', '));
+ setLayerName((newValue as TypeLayerEntryConfig[]).map((layerConfig) => layerConfig.layerName).join(', '));
setStepButtonDisable(false);
}
} else {
setLayerEntries([newValue as TypeLayerEntryConfig]);
- setLayerName((newValue as TypeLayerEntryConfig).layerName!.en!);
+ setLayerName((newValue as TypeLayerEntryConfig).layerName!);
setStepButtonDisable(false);
}
@@ -1288,12 +1285,12 @@ export function AddNewLayer(): JSX.Element {
id="service-layer-label"
options={layerList as TypeLayerEntryConfig[]}
getOptionLabel={(option) =>
- `${(option as TypeLayerEntryConfig).layerName!.en} (${(option as TypeLayerEntryConfig).layerId})`
+ `${(option as TypeLayerEntryConfig).layerName} (${(option as TypeLayerEntryConfig).layerId})`
}
renderOption={(props, option, { selected }) => (
-
+
- {(option as TypeLayerEntryConfig).layerName!.en}
+ {(option as TypeLayerEntryConfig).layerName}
)}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1310,13 +1307,13 @@ export function AddNewLayer(): JSX.Element {
id="service-layer-label"
options={layerList as TypeGeoviewLayerConfig[]}
getOptionLabel={(option) =>
- `${(option as TypeGeoviewLayerConfig).geoviewLayerName!.en} (${(option as TypeGeoviewLayerConfig).geoviewLayerId})`
+ `${(option as TypeGeoviewLayerConfig).geoviewLayerName} (${(option as TypeGeoviewLayerConfig).geoviewLayerId})`
}
disableCloseOnSelect
renderOption={(props, option, { selected }) => (
-
+
- {(option as TypeGeoviewLayerConfig).geoviewLayerName!.en}
+ {(option as TypeGeoviewLayerConfig).geoviewLayerName}
)}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/packages/geoview-core/src/core/utils/config/config-validation.ts b/packages/geoview-core/src/core/utils/config/config-validation.ts
index a626b772f91..9c43715ecb3 100644
--- a/packages/geoview-core/src/core/utils/config/config-validation.ts
+++ b/packages/geoview-core/src/core/utils/config/config-validation.ts
@@ -7,8 +7,7 @@ import { AnyValidateFunction } from 'ajv/dist/types';
import defaultsDeep from 'lodash/defaultsDeep';
-import { TypeDisplayLanguage, TypeLocalizedString } from '@config/types/map-schema-types';
-// import { layerEntryIsGroupLayer } from '@config/types/type-guards';
+import { TypeDisplayLanguage } from '@config/types/map-schema-types';
import { geoviewEntryIsWMS } from '@/geo/layer/geoview-layers/raster/wms';
import { geoviewEntryIsImageStatic } from '@/geo/layer/geoview-layers/raster/image-static';
@@ -28,7 +27,7 @@ import {
mapConfigLayerEntryIsGeoCore,
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
-import { Cast, toJsonObject, TypeJsonObject } from '@/core/types/global-types';
+import { TypeJsonObject } from '@/core/types/global-types';
import { CONST_GEOVIEW_SCHEMA_BY_TYPE, CONST_LAYER_TYPES, TypeGeoviewLayerType } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { geoviewEntryIsEsriImage } from '@/geo/layer/geoview-layers/raster/esri-image';
import { logger } from '@/core/utils/logger';
@@ -191,7 +190,6 @@ export class ConfigValidation {
}
}
- ConfigValidation.#processLocalizedString([this.displayLanguage], listOfGeoviewLayerConfig);
ConfigValidation.#doExtraValidation(listOfGeoviewLayerConfig);
return listOfGeoviewLayerConfig;
@@ -203,9 +201,6 @@ export class ConfigValidation {
* validate.
*/
static validateListOfGeoviewLayerConfig(language: TypeDisplayLanguage, listOfGeoviewLayerConfig?: TypeGeoviewLayerConfig[]): void {
- // TODO: refactor - We will only support these 3 bilingual fields: geoviewLayerName, metadataAccessPath and layerName after the refactor.
- // TODO: New config validation classes should already support this.
- ConfigValidation.#processLocalizedString([language], listOfGeoviewLayerConfig);
ConfigValidation.#doExtraValidation(listOfGeoviewLayerConfig);
}
@@ -359,80 +354,4 @@ export class ConfigValidation {
);
});
}
-
- /** ***************************************************************************************************************************
- * Synchronize the English and French strings.
- * @param {TypeLocalizedString} localizedString - The localized string to synchronize the en and fr string.
- * @param {TypeDisplayLanguage} sourceKey - The source's key.
- * @param {TypeDisplayLanguage} destinationKey - The destination's key.
- * @private
- */
- static #synchronizeLocalizedString(
- localizedString: TypeLocalizedString,
- sourceKey: TypeDisplayLanguage,
- destinationKey: TypeDisplayLanguage
- ): void {
- localizedString[destinationKey] = localizedString[sourceKey];
- }
-
- /** ***************************************************************************************************************************
- * Adjust the map features configuration localized strings according to the supported languages array content.
- * @param {TypeListOfLocalizedLanguages} suportedLanguages - The list of supported languages.
- * @param {MapConfigLayerEntry[]} listOfMapConfigLayerEntry - The list of Map Config Layer Entry configuration to adjust according
- * to the supported languages array content.
- * @private
- */
- static #processLocalizedString(suportedLanguages: TypeDisplayLanguage[], listOfMapConfigLayerEntry?: MapConfigLayerEntry[]): void {
- if (suportedLanguages.includes('en') && suportedLanguages.includes('fr') && listOfMapConfigLayerEntry) {
- const validateLocalizedString = (config: TypeJsonObject): void => {
- if (typeof config === 'object') {
- Object.keys(config).forEach((key) => {
- if (!key.startsWith('_') && config[key] !== null && typeof config[key] === 'object') {
- if (config?.[key]?.en || config?.[key]?.fr) {
- // delete empty localized strings
- if (!config[key].en && !config[key].fr) delete config[key];
- else if (!config[key].en || !config[key].fr) {
- throw new Error('When you support both languages, you must set all en and fr properties of localized strings.');
- }
- }
- // Avoid the 'geoviewLayerConfig' and 'parentLayerConfig' properties because they loop on themself and cause a
- // stack overflow error.
- else if (!['geoviewLayerConfig', 'parentLayerConfig'].includes(key)) validateLocalizedString(config[key]);
- }
- });
- }
- };
- listOfMapConfigLayerEntry.forEach((geoviewLayerConfig) => validateLocalizedString(toJsonObject(geoviewLayerConfig)));
- return;
- }
-
- let sourceKey: TypeDisplayLanguage;
- let destinationKey: TypeDisplayLanguage;
- if (suportedLanguages.includes('en')) {
- sourceKey = 'en';
- destinationKey = 'fr';
- } else {
- sourceKey = 'fr';
- destinationKey = 'en';
- }
-
- if (listOfMapConfigLayerEntry) {
- const propagateLocalizedString = (config: TypeJsonObject): void => {
- if (typeof config === 'object') {
- Object.keys(config).forEach((key) => {
- if (!key.startsWith('_') && config[key] !== null && typeof config[key] === 'object') {
- // Leaving the commented line here in case a developer needs to quickly uncomment it again to troubleshoot
- // logger.logDebug(`Key=${key}`, config[key]);
- if (config?.[key]?.en || config?.[key]?.fr)
- ConfigValidation.#synchronizeLocalizedString(Cast(config[key]), sourceKey, destinationKey);
- // Avoid the 'geoviewLayerConfig' and 'parentLayerConfig' properties because they loop on themself and cause a
- // stack overflow error.
- else if (!['geoviewLayerConfig', 'parentLayerConfig'].includes(key)) propagateLocalizedString(config[key]);
- }
- });
- }
- };
- listOfMapConfigLayerEntry.forEach((geoviewLayerConfig) => propagateLocalizedString(toJsonObject(geoviewLayerConfig)));
- }
- }
}
diff --git a/packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts b/packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts
index 4c88314ba15..ca3c3d9b5ce 100644
--- a/packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts
+++ b/packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts
@@ -13,7 +13,7 @@ import { TypeGeoJSONLayerConfig } from '@/geo/layer/geoview-layers/vector/geojso
import { TypeGeoPackageLayerConfig } from '@/geo/layer/geoview-layers/vector/geopackage';
import { TypeXYZTilesConfig } from '@/geo/layer/geoview-layers/raster/xyz-tiles';
import { TypeVectorTilesConfig } from '@/geo/layer/geoview-layers/raster/vector-tiles';
-import { createLocalizedString, deepMergeObjects } from '@/core/utils/utilities';
+import { deepMergeObjects } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
import { WfsLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config';
import { OgcFeatureLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config';
@@ -99,8 +99,8 @@ export class UUIDmapConfigReader {
if (layerType === CONST_LAYER_TYPES.ESRI_DYNAMIC && !isFeature) {
const geoviewLayerConfig: TypeEsriDynamicLayerConfig = {
geoviewLayerId: idClean,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.ESRI_DYNAMIC,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -112,7 +112,7 @@ export class UUIDmapConfigReader {
entryType: CONST_LAYER_ENTRY_TYPES.RASTER_IMAGE,
layerId: `${item.index}`,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url,
},
};
@@ -135,8 +135,8 @@ export class UUIDmapConfigReader {
const geoviewLayerConfig: TypeEsriFeatureLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(serviceUrl),
+ geoviewLayerName: name as string,
+ metadataAccessPath: serviceUrl,
geoviewLayerType: CONST_LAYER_TYPES.ESRI_FEATURE,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -149,7 +149,7 @@ export class UUIDmapConfigReader {
layerId,
source: {
format: 'EsriJSON',
- dataAccessPath: createLocalizedString(serviceUrl),
+ dataAccessPath: serviceUrl,
},
} as EsriFeatureLayerEntryConfig),
];
@@ -157,8 +157,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.ESRI_FEATURE) {
const geoviewLayerConfig: TypeEsriFeatureLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.ESRI_FEATURE,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -171,7 +171,7 @@ export class UUIDmapConfigReader {
layerId: `${item.index}`,
source: {
format: 'EsriJSON',
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as EsriFeatureLayerEntryConfig);
return esriFeatureLayerEntryConfig;
@@ -180,8 +180,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.WMS) {
const geoviewLayerConfig: TypeWMSLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.WMS,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -193,7 +193,7 @@ export class UUIDmapConfigReader {
entryType: CONST_LAYER_ENTRY_TYPES.RASTER_IMAGE,
layerId: `${item.id}`,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url,
serverType: (serverType === undefined ? 'mapserver' : serverType) as TypeOfServer,
},
};
@@ -211,8 +211,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.WFS) {
const geoviewLayerConfig: TypeWFSLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.WFS,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -226,7 +226,7 @@ export class UUIDmapConfigReader {
source: {
format: 'WFS',
strategy: 'all',
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as WfsLayerEntryConfig);
return wfsLayerEntryConfig;
@@ -235,8 +235,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.OGC_FEATURE) {
const geoviewLayerConfig: TypeOgcFeatureLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.OGC_FEATURE,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -249,7 +249,7 @@ export class UUIDmapConfigReader {
layerId: `${item.id}`,
source: {
format: 'featureAPI',
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as OgcFeatureLayerEntryConfig);
return ogcFeatureLayerEntryConfig;
@@ -258,8 +258,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.GEOJSON) {
const geoviewLayerConfig: TypeGeoJSONLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.GEOJSON,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -272,7 +272,7 @@ export class UUIDmapConfigReader {
layerId: `${item.id}`,
source: {
format: 'GeoJSON',
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as GeoJSONLayerEntryConfig);
return geoJSONLayerEntryConfig;
@@ -281,8 +281,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.XYZ_TILES) {
const geoviewLayerConfig: TypeXYZTilesConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.XYZ_TILES,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -294,7 +294,7 @@ export class UUIDmapConfigReader {
entryType: CONST_LAYER_ENTRY_TYPES.RASTER_TILE,
layerId: `${item.id}`,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as XYZTilesLayerEntryConfig);
return xyzTilesLayerEntryConfig;
@@ -303,8 +303,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.VECTOR_TILES) {
const geoviewLayerConfig: TypeVectorTilesConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.VECTOR_TILES,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -316,7 +316,7 @@ export class UUIDmapConfigReader {
layerId: `${item.id}`,
tileGrid: item.tileGrid as unknown as TypeTileGrid,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as VectorTilesLayerEntryConfig);
return vectorTilesLayerEntryConfig;
@@ -325,7 +325,7 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.GEOPACKAGE) {
const geoviewLayerConfig: TypeGeoPackageLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
+ geoviewLayerName: name as string,
geoviewLayerType: CONST_LAYER_TYPES.GEOPACKAGE,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -338,7 +338,7 @@ export class UUIDmapConfigReader {
layerId: `${item.id}`,
source: {
format: 'GeoPackage',
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as GeoPackageLayerEntryConfig);
return geoPackageLayerEntryConfig;
@@ -347,8 +347,8 @@ export class UUIDmapConfigReader {
} else if (layerType === CONST_LAYER_TYPES.IMAGE_STATIC) {
const geoviewLayerConfig: TypeImageStaticLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.IMAGE_STATIC,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
@@ -360,7 +360,7 @@ export class UUIDmapConfigReader {
entryType: CONST_LAYER_ENTRY_TYPES.RASTER_IMAGE,
layerId: `${item.id}`,
source: {
- dataAccessPath: createLocalizedString(url),
+ dataAccessPath: url as string,
},
} as ImageStaticLayerEntryConfig);
return imageStaticLayerEntryConfig;
@@ -372,8 +372,8 @@ export class UUIDmapConfigReader {
// GV: but we need to create a layerEntryConfig in the list for the layer to be displayed.
const geoviewLayerConfig: TypeEsriImageLayerConfig = {
geoviewLayerId: `${idClean}`,
- geoviewLayerName: createLocalizedString(name),
- metadataAccessPath: createLocalizedString(url),
+ geoviewLayerName: name as string,
+ metadataAccessPath: url as string,
geoviewLayerType: CONST_LAYER_TYPES.ESRI_IMAGE,
isTimeAware: isTimeAware as boolean,
listOfLayerEntryConfig: [],
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/config-base-class.ts b/packages/geoview-core/src/core/utils/config/validation-classes/config-base-class.ts
index 3446e555547..b570ef3e581 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/config-base-class.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/config-base-class.ts
@@ -1,4 +1,3 @@
-import { TypeLocalizedString } from '@config/types/map-schema-types';
import EventHelper, { EventDelegateBase } from '@/api/events/event-helper';
import { TypeGeoviewLayerType } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import {
@@ -35,7 +34,7 @@ export abstract class ConfigBaseClass {
layerIdExtension?: string;
/** The display name of the layer (English/French). */
- layerName?: TypeLocalizedString;
+ layerName?: string;
/** Tag used to link the entry to a specific schema. This element is part of the schema. */
schemaTag?: TypeGeoviewLayerType;
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config.ts
index 333f317a37f..8cebd5d98cf 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config.ts
@@ -27,6 +27,6 @@ export class EsriDynamicLayerEntryConfig extends AbstractBaseLayerEntryConfig {
Object.assign(this, layerConfig);
// if layerConfig.source.dataAccessPath is undefined, we assign the metadataAccessPath of the GeoView layer to it.
if (!this.source) this.source = {};
- if (!this.source.dataAccessPath) this.source.dataAccessPath = { ...this.geoviewLayerConfig.metadataAccessPath! };
+ if (!this.source.dataAccessPath) this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
}
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config.ts
index 0eb3688a928..5d9711838a7 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config.ts
@@ -31,6 +31,6 @@ export class EsriImageLayerEntryConfig extends AbstractBaseLayerEntryConfig {
}
// if layerConfig.source.dataAccessPath is undefined, we assign the metadataAccessPath of the GeoView layer to it.
if (!this.source) this.source = {};
- if (!this.source.dataAccessPath) this.source.dataAccessPath = { ...this.geoviewLayerConfig.metadataAccessPath! };
+ if (!this.source.dataAccessPath) this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
}
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config.ts
index 6f3975e3c6f..b29c257b6e4 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config.ts
@@ -1,7 +1,6 @@
import { CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { CONST_LAYER_ENTRY_TYPES, TypeSourceImageWmsInitialConfig } from '@/geo/map/map-schema-types';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
-import { createLocalizedString } from '@/core/utils/utilities';
/** ******************************************************************************************************************************
* Type used to define a GeoView image layer to display on the map.
@@ -34,13 +33,11 @@ export class OgcWmsLayerEntryConfig extends AbstractBaseLayerEntryConfig {
// set to '' and will be filled in the fetchServiceMetadata method of the class WMS. So, we begin with the assumption
// that both en and fr end with ".xml". Be aware that in metadataAccessPath, one language can ends with ".xml" and the
// other not.
- this.source.dataAccessPath = createLocalizedString('');
+ this.source.dataAccessPath = '';
// When the dataAccessPath is undefined and the metadataAccessPath does not end with ".xml", the dataAccessPath is set
// to the same value of the corresponding metadataAccessPath.
- if (this.geoviewLayerConfig.metadataAccessPath!.en!.slice(-4).toLowerCase() !== '.xml')
- this.source.dataAccessPath.en = this.geoviewLayerConfig.metadataAccessPath!.en;
- if (this.geoviewLayerConfig.metadataAccessPath!.fr!.slice(-4).toLowerCase() !== '.xml')
- this.source.dataAccessPath.fr = this.geoviewLayerConfig.metadataAccessPath!.fr;
+ if (this.geoviewLayerConfig.metadataAccessPath!.slice(-4).toLowerCase() !== '.xml')
+ this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
}
// Default value for layerConfig.source.serverType is 'mapserver'.
if (!this.source.serverType) this.source.serverType = 'mapserver';
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/csv-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/csv-layer-entry-config.ts
index 807f6d9126d..028ac4df2bc 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/csv-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/csv-layer-entry-config.ts
@@ -31,21 +31,17 @@ export class CsvLayerEntryConfig extends VectorLayerEntryConfig {
if (!this.source.format) this.source.format = 'CSV';
if (!this.source.separator) this.source.separator = ',';
if (!this.source.dataAccessPath) {
- let { en, fr } = this.geoviewLayerConfig.metadataAccessPath!;
- en = en!.split('/').length > 1 ? en!.split('/').slice(0, -1).join('/') : './';
- fr = fr!.split('/').length > 1 ? fr!.split('/').slice(0, -1).join('/') : './';
- this.source.dataAccessPath = { en, fr };
+ let accessPath = this.geoviewLayerConfig.metadataAccessPath!;
+ accessPath = accessPath!.split('/').length > 1 ? accessPath!.split('/').slice(0, -1).join('/') : './';
+ this.source.dataAccessPath = accessPath;
}
if (
- !(this.source.dataAccessPath!.en?.startsWith('blob') && !this.source.dataAccessPath!.en?.endsWith('/')) &&
- !this.source.dataAccessPath!.en?.toUpperCase().endsWith('.CSV')
+ !(this.source.dataAccessPath!.startsWith('blob') && !this.source.dataAccessPath!.endsWith('/')) &&
+ !this.source.dataAccessPath!.toUpperCase().endsWith('.CSV')
) {
- this.source.dataAccessPath!.en = this.source.dataAccessPath!.en!.endsWith('/')
- ? `${this.source.dataAccessPath!.en}${this.layerId}`
- : `${this.source.dataAccessPath!.en}/${this.layerId}`;
- this.source.dataAccessPath!.fr = this.source.dataAccessPath!.fr!.endsWith('/')
- ? `${this.source.dataAccessPath!.fr}${this.layerId}`
- : `${this.source.dataAccessPath!.fr}/${this.layerId}`;
+ this.source.dataAccessPath! = this.source.dataAccessPath!.endsWith('/')
+ ? `${this.source.dataAccessPath!}${this.layerId}`
+ : `${this.source.dataAccessPath!}/${this.layerId}`;
}
if (!this.source.dataProjection) this.source.dataProjection = Projection.PROJECTION_NAMES.LNGLAT;
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config.ts
index 8edadb3a234..096bcf09e70 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config.ts
@@ -20,6 +20,6 @@ export class EsriFeatureLayerEntryConfig extends VectorLayerEntryConfig {
// Value for this.source.format can only be EsriJSON.
if (!this.source) this.source = { format: 'EsriJSON' };
if (!this.source.format) this.source.format = 'EsriJSON';
- if (!this.source.dataAccessPath) this.source.dataAccessPath = { ...this.geoviewLayerConfig.metadataAccessPath! };
+ if (!this.source.dataAccessPath) this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
}
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geojson-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geojson-layer-entry-config.ts
index 7b20423d94c..29883ab9a2d 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geojson-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geojson-layer-entry-config.ts
@@ -27,24 +27,20 @@ export class GeoJSONLayerEntryConfig extends VectorLayerEntryConfig {
// if this.source.dataAccessPath is undefined, we assign the metadataAccessPath of the GeoView layer to it
// and place the layerId at the end of it.
if (!this.source.dataAccessPath) {
- let { en, fr } = this.geoviewLayerConfig.metadataAccessPath!;
+ let accessPath = this.geoviewLayerConfig.metadataAccessPath!;
// Remove the metadata file name and keep only the path to the directory where the metadata resides
- en = en!.split('/').length > 1 ? en!.split('/').slice(0, -1).join('/') : './';
- fr = fr!.split('/').length > 1 ? fr!.split('/').slice(0, -1).join('/') : './';
- this.source.dataAccessPath = { en, fr };
+ accessPath = accessPath!.split('/').length > 1 ? accessPath!.split('/').slice(0, -1).join('/') : './';
+ this.source.dataAccessPath = accessPath;
}
if (
- !(this.source.dataAccessPath!.en?.startsWith('blob') && !this.source.dataAccessPath!.en?.endsWith('/')) &&
- !this.source.dataAccessPath!.en?.toUpperCase().endsWith('.JSON') &&
- !this.source.dataAccessPath!.en?.toUpperCase().endsWith('.GEOJSON') &&
- !this.source.dataAccessPath!.en?.toUpperCase().endsWith('=JSON')
+ !(this.source.dataAccessPath!.startsWith('blob') && !this.source.dataAccessPath!.endsWith('/')) &&
+ !this.source.dataAccessPath!.toUpperCase().endsWith('.JSON') &&
+ !this.source.dataAccessPath!.toUpperCase().endsWith('.GEOJSON') &&
+ !this.source.dataAccessPath!.toUpperCase().endsWith('=JSON')
) {
- this.source.dataAccessPath!.en = this.source.dataAccessPath!.en!.endsWith('/')
- ? `${this.source.dataAccessPath!.en}${this.layerId}`
- : `${this.source.dataAccessPath!.en}/${this.layerId}`;
- this.source.dataAccessPath!.fr = this.source.dataAccessPath!.fr!.endsWith('/')
- ? `${this.source.dataAccessPath!.fr}${this.layerId}`
- : `${this.source.dataAccessPath!.fr}/${this.layerId}`;
+ this.source.dataAccessPath! = this.source.dataAccessPath!.endsWith('/')
+ ? `${this.source.dataAccessPath!}${this.layerId}`
+ : `${this.source.dataAccessPath!}/${this.layerId}`;
}
if (!this.source.dataProjection) this.source.dataProjection = Projection.PROJECTION_NAMES.LNGLAT;
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geopackage-layer-config-entry.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geopackage-layer-config-entry.ts
index af6a43b960d..d87a4277d77 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geopackage-layer-config-entry.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/geopackage-layer-config-entry.ts
@@ -21,21 +21,17 @@ export class GeoPackageLayerEntryConfig extends VectorLayerEntryConfig {
if (!this.source) this.source = { format: 'GeoPackage' };
if (!this.source.format) this.source.format = 'GeoPackage';
if (!this.source.dataAccessPath) {
- let { en, fr } = this.geoviewLayerConfig.metadataAccessPath!;
- en = en!.split('/').length > 1 ? en!.split('/').slice(0, -1).join('/') : './';
- fr = fr!.split('/').length > 1 ? fr!.split('/').slice(0, -1).join('/') : './';
- this.source.dataAccessPath = { en, fr };
+ let accessPath = this.geoviewLayerConfig.metadataAccessPath!;
+ accessPath = accessPath!.split('/').length > 1 ? accessPath!.split('/').slice(0, -1).join('/') : './';
+ this.source.dataAccessPath = accessPath;
}
if (
- !(this.source.dataAccessPath!.en?.startsWith('blob') && !this.source.dataAccessPath!.en?.endsWith('/')) &&
- !this.source.dataAccessPath!.en?.toLowerCase().endsWith('.gpkg')
+ !(this.source.dataAccessPath!.startsWith('blob') && !this.source.dataAccessPath!.endsWith('/')) &&
+ !this.source.dataAccessPath!.toLowerCase().endsWith('.gpkg')
) {
- this.source.dataAccessPath!.en = this.source.dataAccessPath!.en!.endsWith('/')
- ? `${this.source.dataAccessPath!.en}${this.layerId}`
- : `${this.source.dataAccessPath!.en}/${this.layerId}`;
- this.source.dataAccessPath!.fr = this.source.dataAccessPath!.fr!.endsWith('/')
- ? `${this.source.dataAccessPath!.fr}${this.layerId}`
- : `${this.source.dataAccessPath!.fr}/${this.layerId}`;
+ this.source.dataAccessPath = this.source.dataAccessPath!.endsWith('/')
+ ? `${this.source.dataAccessPath!}${this.layerId}`
+ : `${this.source.dataAccessPath!}/${this.layerId}`;
}
if (!this?.source?.dataProjection) this.source.dataProjection = Projection.PROJECTION_NAMES.LNGLAT;
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config.ts
index 30ed65fc6ec..2ccf141aea6 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config.ts
@@ -17,7 +17,7 @@ export class OgcFeatureLayerEntryConfig extends VectorLayerEntryConfig {
// Value for this.source.format can only be featureAPI.
if (!this.source) this.source = { format: 'featureAPI' };
if (!this?.source?.format) this.source.format = 'featureAPI';
- if (!this.source.dataAccessPath) this.source.dataAccessPath = { ...this.geoviewLayerConfig.metadataAccessPath! };
+ if (!this.source.dataAccessPath) this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
if (!this.source.dataProjection) this.source.dataProjection = Projection.PROJECTION_NAMES.LNGLAT;
}
}
diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config.ts
index 55e5c43477d..897d8578bdb 100644
--- a/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config.ts
+++ b/packages/geoview-core/src/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config.ts
@@ -17,7 +17,7 @@ export class WfsLayerEntryConfig extends VectorLayerEntryConfig {
// Value for this.source.format can only be WFS.
if (!this.source) this.source = { format: 'WFS' };
if (!this.source.format) this.source.format = 'WFS';
- if (!this.source.dataAccessPath) this.source.dataAccessPath = { ...this.geoviewLayerConfig.metadataAccessPath! };
+ if (!this.source.dataAccessPath) this.source.dataAccessPath = this.geoviewLayerConfig.metadataAccessPath;
if (!this.source.dataProjection) this.source.dataProjection = Projection.PROJECTION_NAMES.LNGLAT;
}
}
diff --git a/packages/geoview-core/src/core/utils/utilities.ts b/packages/geoview-core/src/core/utils/utilities.ts
index 731d34eac8e..507ac6d97ca 100644
--- a/packages/geoview-core/src/core/utils/utilities.ts
+++ b/packages/geoview-core/src/core/utils/utilities.ts
@@ -4,34 +4,12 @@ import i18n from 'i18next';
import sanitizeHtml from 'sanitize-html';
-import { TypeDisplayLanguage, TypeLocalizedString } from '@config/types/map-schema-types';
+import { TypeDisplayLanguage } from '@config/types/map-schema-types';
import { Cast, TypeJsonArray, TypeJsonObject, TypeJsonValue } from '@/core/types/global-types';
import { logger } from '@/core/utils/logger';
import { TypeGuideObject } from '../stores/store-interface-and-intial-values/app-state';
-/**
- * Create a localized string and set its "en" and "fr" properties to the same value.
- * @param {string | TypeJsonObject} value The value to assign to the en and fr properties.
- *
- * @returns {TypeLocalizedString} The localized (en/fr) object
- */
-export function createLocalizedString(value: string | TypeJsonObject): TypeLocalizedString {
- return { en: value as string, fr: value as string };
-}
-
-/**
- * Get the string associated to the current display language for localized object type.
- *
- * @param {TypeLocalizedString} localizedString the localized string to process.
- *
- * @returns {string} The string value according to the map display language,
- */
-export function getLocalizedValue(localizedString: TypeLocalizedString | undefined, language: TypeDisplayLanguage): string | undefined {
- if (localizedString) return localizedString[language];
- return undefined;
-}
-
/**
* Return proper language Geoview localized values from map i18n instance
*
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 e47dcd432c2..c41bdee8136 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,9 +11,9 @@ import Feature from 'ol/Feature';
import Source from 'ol/source/Source';
import { shared as iconImageCache } from 'ol/style/IconImageCache';
-import { TypeLocalizedString, TypeOutfieldsType } from '@config/types/map-schema-types';
+import { TypeOutfieldsType } from '@config/types/map-schema-types';
-import { generateId, getXMLHttpRequest, createLocalizedString, getLocalizedValue, whenThisThen } from '@/core/utils/utilities';
+import { generateId, getXMLHttpRequest, whenThisThen } from '@/core/utils/utilities';
import { TypeJsonObject, toJsonObject } from '@/core/types/global-types';
import { TimeDimension, TypeDateFragments, DateMgt } from '@/core/utils/date-mgt';
import { logger } from '@/core/utils/logger';
@@ -24,7 +24,6 @@ import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/v
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { GroupLayerEntryConfig } from '@/core/utils/config/validation-classes/group-layer-entry-config';
import EventHelper, { EventDelegateBase } from '@/api/events/event-helper';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { LegendEventProcessor } from '@/api/event-processors/event-processor-children/legend-event-processor';
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
import {
@@ -96,10 +95,10 @@ export abstract class AbstractGeoViewLayer {
/** The GeoView layer name. The value of this attribute is extracted from the mapLayerConfig parameter. If its value is
* undefined, a default value is generated.
*/
- geoviewLayerName: TypeLocalizedString = createLocalizedString('');
+ geoviewLayerName: string = '';
/** The GeoView layer metadataAccessPath. The name attribute is optional */
- metadataAccessPath: TypeLocalizedString = createLocalizedString('');
+ metadataAccessPath: string = '';
/**
* An array of layer settings. In the schema, this attribute is optional. However, we define it as mandatory and if the
@@ -120,7 +119,7 @@ export abstract class AbstractGeoViewLayer {
metadata: TypeJsonObject | null = null;
/** Layer name */
- #layerName: Record = {};
+ #layerName: Record = {};
/** Layer metadata */
#layerMetadata: Record = {};
@@ -187,14 +186,8 @@ export abstract class AbstractGeoViewLayer {
this.mapId = mapId;
this.type = type;
this.geoviewLayerId = geoviewLayerConfig.geoviewLayerId || generateId('');
- this.geoviewLayerName.en = geoviewLayerConfig?.geoviewLayerName?.en
- ? geoviewLayerConfig.geoviewLayerName.en
- : DEFAULT_LAYER_NAMES[type];
- this.geoviewLayerName.fr = geoviewLayerConfig?.geoviewLayerName?.fr
- ? geoviewLayerConfig.geoviewLayerName.fr
- : DEFAULT_LAYER_NAMES[type];
- if (geoviewLayerConfig.metadataAccessPath?.en) this.metadataAccessPath.en = geoviewLayerConfig.metadataAccessPath.en.trim();
- if (geoviewLayerConfig.metadataAccessPath?.fr) this.metadataAccessPath.fr = geoviewLayerConfig.metadataAccessPath.fr.trim();
+ this.geoviewLayerName = geoviewLayerConfig?.geoviewLayerName ? geoviewLayerConfig.geoviewLayerName : DEFAULT_LAYER_NAMES[type];
+ if (geoviewLayerConfig.metadataAccessPath) this.metadataAccessPath = geoviewLayerConfig.metadataAccessPath.trim();
this.initialSettings = geoviewLayerConfig.initialSettings;
this.serverDateFragmentsOrder = geoviewLayerConfig.serviceDateFormat
? DateMgt.getDateFragmentsOrder(geoviewLayerConfig.serviceDateFormat)
@@ -275,9 +268,9 @@ export abstract class AbstractGeoViewLayer {
/** ***************************************************************************************************************************
* Gets the Geoview layer name.
- * @returns {TypeLocalizedString | undefined} The geoview layer name
+ * @returns {string | undefined} The geoview layer name
*/
- getGeoviewLayerName(): TypeLocalizedString | undefined {
+ getGeoviewLayerName(): string | undefined {
return this.geoviewLayerName;
}
@@ -292,9 +285,9 @@ export abstract class AbstractGeoViewLayer {
/** ***************************************************************************************************************************
* Gets the layer name.
- * @returns {TypeLocalizedString | undefined} The geoview layer name
+ * @returns {string | undefined} The geoview layer name
*/
- getLayerName(layerPath: string): TypeLocalizedString | undefined {
+ getLayerName(layerPath: string): string | undefined {
// If a new layer name is set
if (this.#layerName[layerPath]) return this.#layerName[layerPath];
// TODO: Refactor - Temporary patch until configs refactoring is done, the style should have been set already
@@ -305,9 +298,9 @@ export abstract class AbstractGeoViewLayer {
/** ***************************************************************************************************************************
* Sets the layer name.
* @param {string} layerPath The layer path.
- * @param {TypeLocalizedString} name The layer name.
+ * @param {string} name The layer name.
*/
- setLayerName(layerPath: string, name: TypeLocalizedString | undefined): void {
+ setLayerName(layerPath: string, name: string | undefined): void {
this.#layerName[layerPath] = name;
this.#emitLayerNameChanged({ layerPath, layerName: name });
}
@@ -492,10 +485,9 @@ export abstract class AbstractGeoViewLayer {
* @returns {Promise} A promise that the execution is completed.
*/
protected async fetchServiceMetadata(): Promise {
- const metadataUrl = getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
- if (metadataUrl) {
+ if (this.metadataAccessPath) {
try {
- const metadataString = await getXMLHttpRequest(`${metadataUrl}?f=json`);
+ const metadataString = await getXMLHttpRequest(`${this.metadataAccessPath}?f=json`);
if (metadataString === '{}') this.metadata = null;
else {
this.metadata = toJsonObject(JSON.parse(metadataString));
@@ -1074,11 +1066,11 @@ export abstract class AbstractGeoViewLayer {
* @param {string} fieldName field name for which we want to get the type.
* @param {TypeLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// Added eslint-disable here, because we do want to override this method in children and keep 'this'.
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
- protected getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
+ protected getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
// Log
logger.logWarning(`getFieldType is not implemented for ${fieldName} - ${layerConfig}`);
return 'string';
@@ -2005,7 +1997,7 @@ type LayerNameChangedDelegate = EventDelegateBase} A promise that the execution is completed.
*/
export async function commonfetchServiceMetadata(layer: EsriDynamic | EsriFeature): Promise {
- const metadataUrl = getLocalizedValue(layer.metadataAccessPath, AppEventProcessor.getDisplayLanguage(layer.mapId));
+ const metadataUrl = layer.metadataAccessPath;
if (metadataUrl) {
try {
const metadataString = await getXMLHttpRequest(`${metadataUrl}?f=json`);
@@ -127,15 +126,8 @@ export function commonValidateListOfLayerEntryConfig(
switchToGroupLayer.entryType = CONST_LAYER_ENTRY_TYPES.GROUP;
// Only switch the layer name by the metadata if there were none pre-set (config wins over metadata rule?)
- if (!switchToGroupLayer.layerName) {
- switchToGroupLayer.layerName = {
- en: layer.metadata!.layers[esriIndex].name as string,
- fr: layer.metadata!.layers[esriIndex].name as string,
- };
- } else {
- if (!switchToGroupLayer.layerName.en) switchToGroupLayer.layerName.en = layer.metadata!.layers[esriIndex].name as string;
- if (!switchToGroupLayer.layerName.fr) switchToGroupLayer.layerName.fr = layer.metadata!.layers[esriIndex].name as string;
- }
+ if (!switchToGroupLayer.layerName) switchToGroupLayer.layerName = layer.metadata!.layers[esriIndex].name as string;
+
switchToGroupLayer.isMetadataLayerGroup = true;
switchToGroupLayer.listOfLayerEntryConfig = newListOfLayerEntryConfig;
@@ -162,10 +154,7 @@ export function commonValidateListOfLayerEntryConfig(
// TO.DOCONT: with the correct values directly? Especially now that we copy the config to prevent leaking.
subLayerEntryConfig.parentLayerConfig = groupLayerConfig;
subLayerEntryConfig.layerId = `${layerId}`;
- subLayerEntryConfig.layerName = {
- en: (layer.metadata!.layers as TypeJsonArray).filter((item) => item.id === layerId)[0].name as string,
- fr: (layer.metadata!.layers as TypeJsonArray).filter((item) => item.id === layerId)[0].name as string,
- };
+ subLayerEntryConfig.layerName = (layer.metadata!.layers as TypeJsonArray).filter((item) => item.id === layerId)[0].name as string;
newListOfLayerEntryConfig.push(subLayerEntryConfig);
// FIXME: Temporary patch to keep the behavior until those layer classes don't exist
@@ -182,11 +171,7 @@ export function commonValidateListOfLayerEntryConfig(
return;
}
- if (!layerConfig.layerName)
- layerConfig.layerName = {
- en: layer.metadata!.layers[esriIndex].name as string,
- fr: layer.metadata!.layers[esriIndex].name as string,
- };
+ if (!layerConfig.layerName) layerConfig.layerName = layer.metadata!.layers[esriIndex].name as string;
});
}
@@ -197,13 +182,13 @@ export function commonValidateListOfLayerEntryConfig(
* @param {string} fieldName field name for which we want to get the domain.
* @param {AbstractBaseLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
export function commonGetFieldType(
layer: EsriDynamic | EsriFeature | EsriImage,
fieldName: string,
layerConfig: AbstractBaseLayerEntryConfig
-): 'string' | 'date' | 'number' {
+): TypeOutfieldsType {
const esriFieldDefinitions = layer.getLayerMetadata(layerConfig.layerPath).fields as TypeJsonArray;
const fieldDefinition = esriFieldDefinitions.find((metadataEntry) => metadataEntry.name === fieldName);
if (!fieldDefinition) return 'string';
@@ -375,7 +360,7 @@ export async function commonProcessLayerMetadata<
if (layerEntryIsGroupLayer(layerConfig) && !layerConfig.isMetadataLayerGroup) return layerConfig;
const { layerPath } = layerConfig;
- let queryUrl = getLocalizedValue(layer.metadataAccessPath, AppEventProcessor.getDisplayLanguage(layer.mapId));
+ let queryUrl = layer.metadataAccessPath;
if (queryUrl) {
if (layerConfig.geoviewLayerConfig.geoviewLayerType !== CONST_LAYER_TYPES.ESRI_IMAGE)
queryUrl = queryUrl.endsWith('/') ? `${queryUrl}${layerConfig.layerId}` : `${queryUrl}/${layerConfig.layerId}`;
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 a53c64aa5ff..1dc158bd4c5 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
@@ -13,7 +13,6 @@ import Feature from 'ol/Feature';
import Geometry from 'ol/geom/Geometry';
import { GeometryApi } from '@/geo/layer/geometry/geometry';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { AbstractGeoViewRaster } from '@/geo/layer/geoview-layers/raster/abstract-geoview-raster';
import { validateExtent, getMinOrMaxExtents } from '@/geo/utils/utilities';
@@ -46,8 +45,8 @@ import {
commonProcessTemporalDimension,
commonValidateListOfLayerEntryConfig,
} from '@/geo/layer/geoview-layers/esri-layer-common';
-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 { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
type TypeFieldOfTheSameValue = { value: string | number | Date; nbOccurence: number };
type TypeQueryTree = { fieldValue: string | number | Date; nextField: TypeQueryTree }[];
@@ -187,10 +186,10 @@ export class EsriDynamic extends AbstractGeoViewRaster {
* @param {string} fieldName field name for which we want to get the type.
* @param {AbstractBaseLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in config?)
- protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
return commonGetFieldType(this, fieldName, layerConfig);
}
@@ -271,7 +270,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
const sourceOptions: SourceOptions = {};
sourceOptions.attributions = [(this.metadata?.copyrightText ? this.metadata?.copyrightText : '') as string];
- sourceOptions.url = getLocalizedValue(layerConfig.source.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ sourceOptions.url = layerConfig.source.dataAccessPath!;
sourceOptions.params = { LAYERS: `show:${layerConfig.layerId}` };
if (layerConfig.source.transparent) sourceOptions.params.transparent = layerConfig.source.transparent!;
if (layerConfig.source.format) sourceOptions.params.format = layerConfig.source.format!;
@@ -342,7 +341,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
const [geometryType] = layerConfig.getTypeGeometries();
// Fetch the features
- let urlRoot = layerConfig.geoviewLayerConfig.metadataAccessPath![AppEventProcessor.getDisplayLanguage(this.mapId)]!;
+ let urlRoot = layerConfig.geoviewLayerConfig.metadataAccessPath!;
if (!urlRoot.endsWith('/')) urlRoot += '/';
// TODO: we put false so on heavy geometry, dynamic layer can load datatable. If not the fetch fails.
const url = `${urlRoot}${layerConfig.layerId}/query?where=1=1&outFields=*&f=json&returnGeometry=false`;
@@ -505,7 +504,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
// If not queryable
if (!layerConfig.source?.featureInfo?.queryable) return [];
- let identifyUrl = getLocalizedValue(layerConfig.source?.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ let identifyUrl = layerConfig.source?.dataAccessPath;
if (!identifyUrl) return [];
identifyUrl = identifyUrl.endsWith('/') ? identifyUrl : `${identifyUrl}/`;
@@ -1013,7 +1012,7 @@ export class EsriDynamic extends AbstractGeoViewRaster {
override async getExtentFromFeatures(layerPath: string, objectIds: string[]): Promise {
// Get url for service from layer entry config
const layerEntryConfig = this.getLayerConfig(layerPath)! as EsriDynamicLayerEntryConfig;
- let baseUrl = getLocalizedValue(layerEntryConfig.source.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ let baseUrl = layerEntryConfig.source.dataAccessPath;
const idString = objectIds.join('%2C');
if (baseUrl) {
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts
index e158d52e2b5..62152c4f87c 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts
@@ -5,7 +5,6 @@ import { Options as ImageOptions } from 'ol/layer/BaseImage';
import { Image as ImageLayer } from 'ol/layer';
import { Extent } from 'ol/extent';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { DateMgt } from '@/core/utils/date-mgt';
import { TypeJsonObject } from '@/core/types/global-types';
import { logger } from '@/core/utils/logger';
@@ -32,10 +31,10 @@ import {
commonProcessLayerMetadata,
commonProcessTemporalDimension,
} from '@/geo/layer/geoview-layers/esri-layer-common';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { validateExtent } from '@/geo/utils/utilities';
import { getLegendStyles } from '@/geo/utils/renderer/geoview-renderer';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
export interface TypeEsriImageLayerConfig extends TypeGeoviewLayerConfig {
geoviewLayerType: typeof CONST_LAYER_TYPES.ESRI_IMAGE;
@@ -137,10 +136,7 @@ export class EsriImage extends AbstractGeoViewRaster {
try {
const layerConfig = this.getLayerConfig(layerPath) as EsriImageLayerEntryConfig | undefined | null;
if (!layerConfig) return null;
- const legendUrl = `${getLocalizedValue(
- layerConfig.geoviewLayerConfig.metadataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )}/legend?f=json`;
+ const legendUrl = `${layerConfig.geoviewLayerConfig.metadataAccessPath}/legend?f=json`;
const response = await fetch(legendUrl);
const legendJson: TypeEsriImageLayerLegend = await response.json();
let legendInfo;
@@ -231,10 +227,10 @@ export class EsriImage extends AbstractGeoViewRaster {
* @param {string} fieldName field name for which we want to get the type.
* @param {TypeLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in layers)
- protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
// TODO: Refactor - Layers refactoring. Is this function really valid for an esri-image? Remove?
return commonGetFieldType(this, fieldName, layerConfig);
}
@@ -316,7 +312,7 @@ export class EsriImage extends AbstractGeoViewRaster {
const sourceOptions: SourceOptions = {};
sourceOptions.attributions = [(this.metadata!.copyrightText ? this.metadata!.copyrightText : '') as string];
- sourceOptions.url = getLocalizedValue(layerConfig.source.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ sourceOptions.url = layerConfig.source.dataAccessPath!;
sourceOptions.params = { LAYERS: `show:${layerConfig.layerId}` };
if (layerConfig.source.transparent) sourceOptions.params.transparent = layerConfig.source.transparent!;
if (layerConfig.source.format) sourceOptions.params.format = layerConfig.source.format!;
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts
index be240d1e810..2c66ce5871b 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/image-static.ts
@@ -10,10 +10,9 @@ import { Cast, TypeJsonObject } from '@/core/types/global-types';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { AbstractGeoViewRaster } from '@/geo/layer/geoview-layers/raster/abstract-geoview-raster';
import { TypeLayerEntryConfig, TypeGeoviewLayerConfig, layerEntryIsGroupLayer } from '@/geo/map/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
+
import { logger } from '@/core/utils/logger';
import { ImageStaticLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/image-static-layer-entry-config';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { loadImage } from '@/geo/utils/renderer/geoview-renderer';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
@@ -107,7 +106,7 @@ export class ImageStatic extends AbstractGeoViewRaster {
* @private
*/
// GV Layers Refactoring - Obsolete (in layers)
- #getLegendImage(layerConfig: ImageStaticLayerEntryConfig): Promise {
+ static #getLegendImage(layerConfig: ImageStaticLayerEntryConfig): Promise {
const promisedImage = new Promise((resolve) => {
const readImage = (blob: Blob): Promise =>
// eslint-disable-next-line @typescript-eslint/no-shadow
@@ -118,10 +117,7 @@ export class ImageStatic extends AbstractGeoViewRaster {
reader.readAsDataURL(blob);
});
- let legendUrl: string | undefined = getLocalizedValue(
- layerConfig.source.dataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- );
+ let legendUrl: string | undefined = layerConfig.source.dataAccessPath;
if (legendUrl) {
legendUrl = legendUrl.toLowerCase().startsWith('http:') ? `https${legendUrl.slice(4)}` : legendUrl;
@@ -151,7 +147,7 @@ export class ImageStatic extends AbstractGeoViewRaster {
const layerConfig = this.getLayerConfig(layerPath) as ImageStaticLayerEntryConfig | undefined | null;
if (!layerConfig) return null;
- const legendImage = await this.#getLegendImage(layerConfig!);
+ const legendImage = await ImageStatic.#getLegendImage(layerConfig!);
if (!legendImage) {
const legend: TypeLegend = {
type: CONST_LAYER_TYPES.IMAGE_STATIC,
@@ -253,7 +249,7 @@ export class ImageStatic extends AbstractGeoViewRaster {
if (!layerConfig?.source?.extent) throw new Error('Parameter extent is not defined in source element of layerConfig.');
const sourceOptions: SourceOptions = {
- url: getLocalizedValue(layerConfig.source.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId)) || '',
+ url: layerConfig.source.dataAccessPath || '',
imageExtent: layerConfig.source.extent,
};
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 c3122955da6..b79fabd7ef7 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
@@ -9,7 +9,6 @@ import { Extent } from 'ol/extent';
import { applyStyle } from 'ol-mapbox-style';
import { MVT } from 'ol/format';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { AbstractGeoViewRaster } from '@/geo/layer/geoview-layers/raster/abstract-geoview-raster';
import {
@@ -18,15 +17,15 @@ import {
TypeGeoviewLayerConfig,
TypeTileGrid,
layerEntryIsGroupLayer,
+ TypeFeatureInfoLayerConfig,
} from '@/geo/map/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
-import { Cast, TypeJsonObject } from '@/core/types/global-types';
+import { TypeJsonObject } from '@/core/types/global-types';
import { validateExtentWhenDefined } from '@/geo/utils/utilities';
import { api } from '@/app';
import { VectorTilesLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/vector-tiles-layer-entry-config';
import { logger } from '@/core/utils/logger';
-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 { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
// TODO: Implement method to validate Vector Tiles service
// TODO: Add more customization (minZoom, maxZoom, TMS)
@@ -115,20 +114,14 @@ export class VectorTiles extends AbstractGeoViewRaster {
* @param {string} fieldName field name for which we want to get the type.
* @param {TypeLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} 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(
- Cast(fieldDefinitions.outfields),
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )
- ?.split(',')
- .indexOf(fieldName);
- if (!fieldIndex || fieldIndex === -1) return 'string';
- return (fieldDefinitions.fieldTypes as string).split(',')[fieldIndex!] as 'string' | 'date' | 'number';
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
+ const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo as unknown as TypeFeatureInfoLayerConfig;
+ const outFieldEntry = fieldDefinitions.outfields?.find((fieldDefinition) => fieldDefinition.name === fieldName);
+ return outFieldEntry?.type || 'string';
}
/** ***************************************************************************************************************************
@@ -176,7 +169,7 @@ export class VectorTiles extends AbstractGeoViewRaster {
if (!(layerConfig instanceof VectorTilesLayerEntryConfig)) throw new Error('Invalid layer configuration type provided');
const sourceOptions: SourceOptions = {
- url: getLocalizedValue(layerConfig.source.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId)),
+ url: layerConfig.source.dataAccessPath,
};
if (
@@ -252,13 +245,9 @@ export class VectorTiles extends AbstractGeoViewRaster {
const resolutions = sourceOptions.tileGrid.getResolutions();
if (this.metadata?.defaultStyles)
- applyStyle(
- olLayer,
- `${getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId))}${
- this.metadata.defaultStyles
- }/root.json`,
- { resolutions: resolutions?.length ? resolutions : [] }
- ).catch((error) => {
+ applyStyle(olLayer, `${this.metadataAccessPath}${this.metadata.defaultStyles}/root.json`, {
+ resolutions: resolutions?.length ? resolutions : [],
+ }).catch((error) => {
// Log
logger.logPromiseFailed('applyStyle in processOneLayerEntry in VectorTiles', error);
});
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 1520ec6ecd8..80e78be8460 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
@@ -30,7 +30,7 @@ import {
layerEntryIsGroupLayer,
TypeFeatureInfoEntry,
} from '@/geo/map/map-schema-types';
-import { xmlToJson, getLocalizedValue } from '@/core/utils/utilities';
+import { xmlToJson } from '@/core/utils/utilities';
import { DateMgt } from '@/core/utils/date-mgt';
import { getExtentIntersection, validateExtent, validateExtentWhenDefined } from '@/geo/utils/utilities';
import { api } from '@/app';
@@ -40,7 +40,6 @@ import { OgcWmsLayerEntryConfig } from '@/core/utils/config/validation-classes/r
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { GroupLayerEntryConfig } from '@/core/utils/config/validation-classes/group-layer-entry-config';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { loadImage } from '@/geo/utils/renderer/geoview-renderer';
export interface TypeWMSLayerConfig extends Omit {
@@ -117,7 +116,7 @@ export class WMS extends AbstractGeoViewRaster {
*/
// GV Layers Refactoring - Obsolete (in config)
protected override async fetchServiceMetadata(): Promise {
- const metadataUrl = getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ const metadataUrl = this.metadataAccessPath;
if (metadataUrl) {
const metadataAccessPathIsXmlFile = metadataUrl.slice(-4).toLowerCase() === '.xml';
if (metadataAccessPathIsXmlFile) {
@@ -210,7 +209,7 @@ export class WMS extends AbstractGeoViewRaster {
/** ***************************************************************************************************************************
* This method reads the service metadata from a XML metadataAccessPath.
*
- * @param {string} metadataUrl The localized value of the metadataAccessPath
+ * @param {string} metadataUrl The metadataAccessPath
*
* @returns {Promise} A promise that the execution is completed.
* @private
@@ -225,15 +224,13 @@ export class WMS extends AbstractGeoViewRaster {
if (this.metadata) {
this.#processMetadataInheritance();
const metadataAccessPath = this.metadata?.Capability.Request.GetMap.DCPType[0].HTTP.Get.OnlineResource as string;
- this.metadataAccessPath.en = metadataAccessPath;
- this.metadataAccessPath.fr = metadataAccessPath;
+ this.metadataAccessPath = metadataAccessPath;
const dataAccessPath = this.metadata?.Capability.Request.GetMap.DCPType[0].HTTP.Get.OnlineResource as string;
const setDataAccessPath = (listOfLayerEntryConfig: TypeLayerEntryConfig[]): void => {
listOfLayerEntryConfig.forEach((layerConfig) => {
if (layerEntryIsGroupLayer(layerConfig)) setDataAccessPath(layerConfig.listOfLayerEntryConfig);
else {
- layerConfig.source!.dataAccessPath!.en = dataAccessPath;
- layerConfig.source!.dataAccessPath!.fr = dataAccessPath;
+ layerConfig.source!.dataAccessPath = dataAccessPath;
}
});
};
@@ -420,11 +417,7 @@ export class WMS extends AbstractGeoViewRaster {
return;
}
- if (!layerConfig.layerName)
- layerConfig.layerName = {
- en: layerFound.Title as string,
- fr: layerFound.Title as string,
- };
+ if (!layerConfig.layerName) layerConfig.layerName = layerFound.Title as string;
}
});
}
@@ -450,10 +443,7 @@ export class WMS extends AbstractGeoViewRaster {
const subLayerEntryConfig: TypeLayerEntryConfig = cloneDeep(layerConfig);
subLayerEntryConfig.parentLayerConfig = Cast(layerConfig);
subLayerEntryConfig.layerId = subLayer.Name as string;
- subLayerEntryConfig.layerName = {
- en: subLayer.Title as string,
- fr: subLayer.Title as string,
- };
+ subLayerEntryConfig.layerName = subLayer.Title as string;
newListOfLayerEntryConfig.push(subLayerEntryConfig);
// FIXME: Temporary patch to keep the behavior until those layer classes don't exist
@@ -462,10 +452,7 @@ export class WMS extends AbstractGeoViewRaster {
const switchToGroupLayer = Cast(layerConfig);
switchToGroupLayer.entryType = CONST_LAYER_ENTRY_TYPES.GROUP;
- switchToGroupLayer.layerName = {
- en: layer.Title as string,
- fr: layer.Title as string,
- };
+ switchToGroupLayer.layerName = layer.Title as string;
switchToGroupLayer.isMetadataLayerGroup = true;
switchToGroupLayer.listOfLayerEntryConfig = newListOfLayerEntryConfig;
this.validateListOfLayerEntryConfig(newListOfLayerEntryConfig);
@@ -517,7 +504,7 @@ export class WMS extends AbstractGeoViewRaster {
if (geoviewEntryIsWMS(layerConfig)) {
const layerCapabilities = this.#getLayerMetadataEntry(layerConfig.layerId);
if (layerCapabilities) {
- const dataAccessPath = getLocalizedValue(layerConfig.source.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId))!;
+ const dataAccessPath = layerConfig.source.dataAccessPath!;
let styleToUse = '';
if (Array.isArray(layerConfig.source?.style) && layerConfig.source?.style) {
@@ -852,10 +839,7 @@ export class WMS extends AbstractGeoViewRaster {
const legendUrlFromCapabilities = this.#getLegendUrlFromCapabilities(layerConfig, chosenStyle);
if (legendUrlFromCapabilities) queryUrl = legendUrlFromCapabilities.OnlineResource as string;
else if (Object.keys(this.metadata?.Capability.Request || {}).includes('GetLegendGraphic'))
- queryUrl = `${getLocalizedValue(
- this.metadataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )!}service=WMS&version=1.3.0&request=GetLegendGraphic&FORMAT=image/png&layer=${layerConfig.layerId}`;
+ queryUrl = `${this.metadataAccessPath}service=WMS&version=1.3.0&request=GetLegendGraphic&FORMAT=image/png&layer=${layerConfig.layerId}`;
if (queryUrl) {
queryUrl = queryUrl.toLowerCase().startsWith('http:') ? `https${queryUrl.slice(4)}` : queryUrl;
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/xyz-tiles.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/xyz-tiles.ts
index 00fa968f07c..34577272554 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/xyz-tiles.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/xyz-tiles.ts
@@ -7,8 +7,6 @@ import { Extent } from 'ol/extent';
import defaultsDeep from 'lodash/defaultsDeep';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
-
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { AbstractGeoViewRaster } from '@/geo/layer/geoview-layers/raster/abstract-geoview-raster';
import {
@@ -16,13 +14,13 @@ import {
TypeSourceTileInitialConfig,
TypeGeoviewLayerConfig,
layerEntryIsGroupLayer,
+ TypeFeatureInfoLayerConfig,
} from '@/geo/map/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { Cast, toJsonObject } from '@/core/types/global-types';
import { validateExtentWhenDefined } from '@/geo/utils/utilities';
import { XYZTilesLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/xyz-layer-entry-config';
-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 { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
// ? Do we keep this TODO ? Dynamic parameters can be placed on the dataAccessPath and initial settings can be used on xyz-tiles.
// TODO: Implement method to validate XYZ tile service
@@ -107,19 +105,13 @@ export class XYZTiles extends AbstractGeoViewRaster {
* @param {string} fieldName field name for which we want to get the type.
* @param {TypeLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in layers)
- protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
- const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo;
- const fieldIndex = getLocalizedValue(
- Cast(fieldDefinitions.outfields),
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )
- ?.split(',')
- .indexOf(fieldName);
- if (!fieldIndex || fieldIndex === -1) return 'string';
- return (fieldDefinitions.fieldTypes as string).split(',')[fieldIndex!] as 'string' | 'date' | 'number';
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
+ const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo as unknown as TypeFeatureInfoLayerConfig;
+ const outFieldEntry = fieldDefinitions.outfields?.find((fieldDefinition) => fieldDefinition.name === fieldName);
+ return outFieldEntry?.type || 'string';
}
/** ***************************************************************************************************************************
@@ -191,7 +183,7 @@ export class XYZTiles extends AbstractGeoViewRaster {
if (!(layerConfig instanceof XYZTilesLayerEntryConfig)) throw new Error('Invalid layer configuration type provided');
const sourceOptions: SourceOptions = {
- url: getLocalizedValue(layerConfig.source.dataAccessPath as TypeLocalizedString, AppEventProcessor.getDisplayLanguage(this.mapId)),
+ url: layerConfig.source.dataAccessPath,
};
if (layerConfig.source.crossOrigin) {
sourceOptions.crossOrigin = layerConfig.source.crossOrigin;
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 76925624559..99d2ed42898 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,20 +17,22 @@ import { ProjectionLike } from 'ol/proj';
import { Point } from 'ol/geom';
import { getUid } from 'ol/util';
-import { TypeLocalizedString, TypeOutfields } from '@config/types/map-schema-types';
+import { TypeOutfields, TypeOutfieldsType } from '@config/types/map-schema-types';
import { api } from '@/app';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
-import { TypeBaseSourceVectorInitialConfig, TypeFeatureInfoEntry, TypeLayerEntryConfig } from '@/geo/map/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
+import {
+ TypeBaseSourceVectorInitialConfig,
+ TypeFeatureInfoEntry,
+ TypeFeatureInfoLayerConfig,
+ TypeLayerEntryConfig,
+} from '@/geo/map/map-schema-types';
import { DateMgt } from '@/core/utils/date-mgt';
import { NodeType } from '@/geo/utils/renderer/geoview-renderer-types';
import { VECTOR_LAYER } from '@/core/utils/constant';
import { logger } from '@/core/utils/logger';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
-import { Cast } from '@/core/types/global-types';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { analyzeLayerFilter } from '@/geo/utils/renderer/geoview-renderer';
import { AbstractGVVector } from '../../gv-layers/vector/abstract-gv-vector';
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
@@ -94,19 +96,13 @@ export abstract class AbstractGeoViewVector extends AbstractGeoViewLayer {
* @param {string} fieldName field name for which we want to get the type.
* @param {AbstractBaseLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in layers)
- protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
- const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo;
- const fieldIndex = getLocalizedValue(
- Cast(fieldDefinitions.outfields),
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )
- ?.split(',')
- .indexOf(fieldName);
- if (!fieldIndex || fieldIndex === -1) return 'string';
- return (fieldDefinitions.fieldTypes as string).split(',')[fieldIndex!] as 'string' | 'date' | 'number';
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
+ const fieldDefinitions = this.getLayerMetadata(layerConfig.layerPath).source.featureInfo as unknown as TypeFeatureInfoLayerConfig;
+ const outFieldEntry = fieldDefinitions.outfields?.find((fieldDefinition) => fieldDefinition.name === fieldName);
+ return outFieldEntry?.type || 'string';
}
/** ***************************************************************************************************************************
@@ -337,11 +333,8 @@ export abstract class AbstractGeoViewVector extends AbstractGeoViewLayer {
*/
// GV Layers Refactoring - Obsolete (this is bridging between config and layers, okay)
protected createVectorLayer(layerConfig: VectorLayerEntryConfig, vectorSource: VectorSource): VectorLayer {
- // TODO: remove link to language, layer should be created in one language and recreated if needed to change
- const language = AppEventProcessor.getDisplayLanguage(this.mapId);
-
// Get the style label
- const label = getLocalizedValue(layerConfig.layerName, language) || layerConfig.layerId;
+ const label = layerConfig.layerName || layerConfig.layerId;
// GV Time to request an OpenLayers layer!
const requestResult = this.emitLayerRequesting({ config: layerConfig, source: vectorSource });
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts
index 6d69e0d5639..c70c26790c0 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts
@@ -18,11 +18,9 @@ import {
TypeBaseSourceVectorInitialConfig,
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { CsvLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/csv-layer-entry-config';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
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';
// GV: CONFIG EXTRACTION
// GV: This section of code was extracted and copied to the geoview config section
@@ -173,7 +171,7 @@ export class CSV extends AbstractGeoViewVector {
readOptions: ReadOptions = {}
): VectorSource {
readOptions.dataProjection = (layerConfig.source as TypeBaseSourceVectorInitialConfig).dataProjection;
- sourceOptions.url = getLocalizedValue(layerConfig.source!.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ sourceOptions.url = layerConfig.source!.dataAccessPath;
sourceOptions.format = new FormatGeoJSON();
const vectorSource = super.createVectorSource(layerConfig, sourceOptions, readOptions);
return vectorSource;
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/esri-feature.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/esri-feature.ts
index 5b8504c3bfb..a84d51b7a66 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/esri-feature.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/esri-feature.ts
@@ -4,7 +4,6 @@ import { EsriJSON } from 'ol/format';
import { ReadOptions } from 'ol/format/Feature';
import Feature from 'ol/Feature';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { AbstractGeoViewVector } from './abstract-geoview-vector';
import { TypeJsonObject } from '@/core/types/global-types';
import { EsriFeatureLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config';
@@ -28,7 +27,7 @@ import {
commonProcessTemporalDimension,
commonValidateListOfLayerEntryConfig,
} from '@/geo/layer/geoview-layers/esri-layer-common';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
export interface TypeSourceEsriFeatureInitialConfig extends Omit {
format: 'EsriJSON';
@@ -148,10 +147,10 @@ export class EsriFeature extends AbstractGeoViewVector {
* @param {string} fieldName field name for which we want to get the type.
* @param {TypeLayerEntryConfig} layerConfig layer configuration.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
// GV Layers Refactoring - Obsolete (in layers)
- protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string, layerConfig: AbstractBaseLayerEntryConfig): TypeOutfieldsType {
return commonGetFieldType(this, fieldName, layerConfig);
}
@@ -233,7 +232,7 @@ export class EsriFeature extends AbstractGeoViewVector {
// eslint-disable-next-line no-var
var vectorSource: VectorSource;
// eslint-disable-next-line no-param-reassign
- sourceOptions.url = getLocalizedValue(layerConfig.source!.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ sourceOptions.url = layerConfig.source!.dataAccessPath!;
// eslint-disable-next-line no-param-reassign
sourceOptions.url = `${sourceOptions.url}/${layerConfig.layerId}/query?f=json&where=1%3D1&returnCountOnly=true`;
// eslint-disable-next-line no-param-reassign
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts
index 410e245fe9f..af18328f163 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts
@@ -8,8 +8,6 @@ import Feature from 'ol/Feature';
import defaultsDeep from 'lodash/defaultsDeep';
-import { TypeLocalizedString } from '@config/types/map-schema-types';
-
import VectorLayer from 'ol/layer/Vector';
import { GeoJSONObject } from 'ol/format/GeoJSON';
import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
@@ -23,12 +21,10 @@ import {
} from '@/geo/map/map-schema-types';
import { validateExtentWhenDefined } from '@/geo/utils/utilities';
import { Cast, TypeJsonObject } from '@/core/types/global-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
import { GeoJSONLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/geojson-layer-entry-config';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
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 { Projection } from '@/geo/utils/projection';
import { LegendEventProcessor } from '@/api/event-processors/event-processor-children/legend-event-processor';
import { DataTableEventProcessor } from '@/api/event-processors/event-processor-children/data-table-event-processor';
@@ -201,26 +197,13 @@ export class GeoJSON extends AbstractGeoViewVector {
// layerId ending, chances are that it was set by the config-validation because of an empty dataAcessPath value in the config.
// This situation means that we want to use the dataAccessPath found in the metadata if it is set, otherwise we will keep the
// config dataAccessPath value.
- let metadataAccessPathRoot = getLocalizedValue(
- layerConfig.geoviewLayerConfig?.metadataAccessPath as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- );
+ let metadataAccessPathRoot = layerConfig.geoviewLayerConfig?.metadataAccessPath;
if (metadataAccessPathRoot) {
metadataAccessPathRoot =
metadataAccessPathRoot.split('/').length > 1 ? metadataAccessPathRoot.split('/').slice(0, -1).join('/') : './';
const metadataAccessPathRootPlusLayerId = `${metadataAccessPathRoot}/${layerConfig.layerId}`;
- if (
- metadataAccessPathRootPlusLayerId ===
- getLocalizedValue(
- layerConfig.source?.dataAccessPath as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- ) &&
- getLocalizedValue(
- layerMetadataFound.source?.dataAccessPath as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- )
- ) {
- layerConfig.source!.dataAccessPath = { ...layerMetadataFound.source!.dataAccessPath } as TypeLocalizedString;
+ if (metadataAccessPathRootPlusLayerId === layerConfig.source?.dataAccessPath && layerMetadataFound.source?.dataAccessPath) {
+ layerConfig.source!.dataAccessPath = layerMetadataFound.source!.dataAccessPath;
}
}
}
@@ -250,10 +233,7 @@ export class GeoJSON extends AbstractGeoViewVector {
readOptions: ReadOptions = {}
): VectorSource {
readOptions.dataProjection = (layerConfig.source as TypeBaseSourceVectorInitialConfig).dataProjection;
- sourceOptions.url = getLocalizedValue(
- layerConfig.source!.dataAccessPath! as TypeLocalizedString,
- AppEventProcessor.getDisplayLanguage(this.mapId)
- );
+ sourceOptions.url = layerConfig.source!.dataAccessPath!;
sourceOptions.format = new FormatGeoJSON();
const vectorSource = super.createVectorSource(layerConfig, sourceOptions, readOptions);
return vectorSource;
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 8b0017e22cd..0ec4062c848 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
@@ -26,12 +26,10 @@ import {
CONST_LAYER_ENTRY_TYPES,
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { GeoPackageLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/geopackage-layer-config-entry';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
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';
@@ -280,7 +278,7 @@ export class GeoPackage extends AbstractGeoViewVector {
readOptions: ReadOptions = {}
): Promise<[LayerData[], SldsInterface]> {
const promisedGeopackageData = new Promise<[LayerData[], SldsInterface]>((resolve) => {
- const url = getLocalizedValue(layerConfig.source!.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ const url = layerConfig.source!.dataAccessPath!;
const attributions = this.getAttributions();
if (attributions.length > 0) sourceOptions.attributions = attributions;
const layersInfo: LayerData[] = [];
@@ -607,7 +605,7 @@ export class GeoPackage extends AbstractGeoViewVector {
// "Clone" the config, patch until that layer type logic is rebuilt
const newLayerEntryConfig = new GeoPackageLayerEntryConfig(layerConfig as GeoPackageLayerEntryConfig);
newLayerEntryConfig.layerId = layers[i].name;
- newLayerEntryConfig.layerName = createLocalizedString(layers[i].name);
+ newLayerEntryConfig.layerName = layers[i].name;
newLayerEntryConfig.entryType = CONST_LAYER_ENTRY_TYPES.VECTOR;
newLayerEntryConfig.parentLayerConfig = Cast(layerConfig);
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 2b6df31f50c..2020f6156a2 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
@@ -26,8 +26,6 @@ import { logger } from '@/core/utils/logger';
import { OgcFeatureLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
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 {
@@ -132,7 +130,7 @@ export class OgcFeature extends AbstractGeoViewVector {
// GV Layers Refactoring - Obsolete (in config?)
protected override fetchServiceMetadata(): Promise {
const promisedExecution = new Promise((resolve) => {
- const metadataUrl = getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ const metadataUrl = this.metadataAccessPath;
if (metadataUrl) {
const queryUrl = metadataUrl.endsWith('/') ? `${metadataUrl}collections?f=json` : `${metadataUrl}/collections?f=json`;
axios
@@ -190,11 +188,7 @@ export class OgcFeature extends AbstractGeoViewVector {
return;
}
- if (foundCollection.description)
- layerConfig.layerName = {
- en: foundCollection.description as string,
- fr: foundCollection.description as string,
- };
+ if (foundCollection.description) layerConfig.layerName = foundCollection.description as string;
layerConfig.initialSettings.extent = validateExtentWhenDefined(layerConfig.initialSettings.extent);
@@ -228,7 +222,7 @@ export class OgcFeature extends AbstractGeoViewVector {
if (!(layerConfig instanceof VectorLayerEntryConfig)) throw new Error('Invalid layer configuration type provided');
try {
- const metadataUrl = getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ const metadataUrl = this.metadataAccessPath;
if (metadataUrl) {
const queryUrl = metadataUrl.endsWith('/')
? `${metadataUrl}collections/${layerConfig.layerId}/queryables?f=json`
@@ -308,7 +302,7 @@ export class OgcFeature extends AbstractGeoViewVector {
readOptions: ReadOptions = {}
): VectorSource {
readOptions.dataProjection = (layerConfig.source as TypeBaseSourceVectorInitialConfig).dataProjection;
- sourceOptions.url = getLocalizedValue(layerConfig.source!.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ sourceOptions.url = layerConfig.source!.dataAccessPath!;
sourceOptions.url = `${sourceOptions.url}/collections/${layerConfig.layerId}/items?f=json`;
sourceOptions.format = new FormatGeoJSON();
const vectorSource = super.createVectorSource(layerConfig, sourceOptions, readOptions);
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 8602c625701..b0586335576 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
@@ -20,12 +20,11 @@ import {
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
-import { getLocalizedValue, getXMLHttpRequest, xmlToJson, findPropertyNameByRegex } from '@/core/utils/utilities';
+import { getXMLHttpRequest, xmlToJson, findPropertyNameByRegex } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
import { WfsLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
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';
@@ -127,7 +126,7 @@ export class WFS extends AbstractGeoViewVector {
// GV Layers Refactoring - Obsolete (in config?)
protected override fetchServiceMetadata(): Promise {
const promisedExecution = new Promise((resolve) => {
- let metadataUrl = getLocalizedValue(this.metadataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId)) as string;
+ let metadataUrl = this.metadataAccessPath;
// check if url contains metadata parameters for the getCapabilities request and reformat the urls
const getCapabilitiesUrl =
@@ -153,7 +152,7 @@ export class WFS extends AbstractGeoViewVector {
})
.catch((reason) => {
this.setAllLayerStatusTo('error', this.listOfLayerEntryConfig, 'Unable to read metadata');
- logger.logError('Unableto fetch metadata', this.metadataAccessPath, reason);
+ logger.logError('Unable to fetch metadata', this.metadataAccessPath, reason);
resolve();
});
} else {
@@ -239,7 +238,7 @@ export class WFS extends AbstractGeoViewVector {
if (!(layerConfig instanceof VectorLayerEntryConfig)) throw new Error('Invalid layer configuration type provided');
try {
- let queryUrl = getLocalizedValue(layerConfig.source!.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.mapId));
+ let queryUrl = layerConfig.source!.dataAccessPath;
// check if url contains metadata parameters for the getCapabilities request and reformat the urls
queryUrl = queryUrl!.indexOf('?') > -1 ? queryUrl!.substring(0, queryUrl!.indexOf('?')) : queryUrl;
@@ -359,7 +358,7 @@ export class WFS extends AbstractGeoViewVector {
sourceOptions.url = (extent): string => {
// check if url contains metadata parameters for the getCapabilities request and reformat the urls
- let sourceUrl = getLocalizedValue(layerConfig.source!.dataAccessPath!, AppEventProcessor.getDisplayLanguage(this.mapId));
+ let sourceUrl = layerConfig.source!.dataAccessPath!;
sourceUrl = sourceUrl!.indexOf('?') > -1 ? sourceUrl!.substring(0, sourceUrl!.indexOf('?')) : sourceUrl;
// GV: Use processUrlParameters('GetFeature') method of GeoView layer config to get the sourceUrl and append &typeName= to it.
sourceUrl = `${sourceUrl}?service=WFS&request=getFeature&version=${this.#version}`;
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/abstract-base-layer.ts b/packages/geoview-core/src/geo/layer/gv-layers/abstract-base-layer.ts
index 14e7281b810..65081e6489b 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/abstract-base-layer.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/abstract-base-layer.ts
@@ -1,6 +1,6 @@
import BaseLayer from 'ol/layer/Base';
-import { Extent, TypeLocalizedString } from '@/api/config/types/map-schema-types';
+import { Extent } from '@/api/config/types/map-schema-types';
import EventHelper, { EventDelegateBase } from '@/api/events/event-helper';
import { ConfigBaseClass } from '@/core/utils/config/validation-classes/config-base-class';
import { TypeLayerStatus } from '@/geo/map/map-schema-types';
@@ -20,7 +20,7 @@ export abstract class AbstractBaseLayer {
protected olLayer!: BaseLayer;
// The layer name
- #layerName: TypeLocalizedString | undefined;
+ #layerName: string | undefined;
// Keep all callback delegates references
#onLayerNameChangedHandlers: LayerNameChangedDelegate[] = [];
@@ -90,9 +90,9 @@ export abstract class AbstractBaseLayer {
/**
* Gets the geoview layer name.
- * @returns {TypeLocalizedString | undefined} The layer name
+ * @returns {string | undefined} The layer name
*/
- getGeoviewLayerName(): TypeLocalizedString | undefined {
+ getGeoviewLayerName(): string | undefined {
return this.#layerConfig.geoviewLayerConfig.geoviewLayerName;
}
@@ -112,16 +112,16 @@ export abstract class AbstractBaseLayer {
* @returns The layer name
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
- getLayerName(layerPath: string): TypeLocalizedString | undefined {
+ getLayerName(layerPath: string): string | undefined {
// TODO: Refactor - After layers refactoring, remove the layerPath parameter here (gotta keep it in the signature for now for the layers-set active switch)
return this.#layerName;
}
/**
* Sets the layer name
- * @param {TypeLocalizedString | undefined} name - The layer name
+ * @param {string | undefined} name - The layer name
*/
- setLayerName(layerPath: string, name: TypeLocalizedString | undefined): void {
+ setLayerName(layerPath: string, name: string | undefined): void {
// TODO: Refactor - After layers refactoring, remove the layerPath parameter here (gotta keep it in the signature for now for the layers-set active switch)
this.#layerName = name;
this.#emitLayerNameChanged({ layerPath, layerName: name });
@@ -316,7 +316,7 @@ export abstract class AbstractBaseLayer {
*/
export type LayerNameChangedEvent = {
// The new layer name.
- layerName?: TypeLocalizedString;
+ layerName?: string;
// TODO: Refactor - Layers refactoring. Remove the layerPath parameter once hybrid work is done
// The layer path.
layerPath: string;
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 b51f89331a7..c047d4405f4 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
@@ -32,6 +32,7 @@ import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/laye
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
import { MapViewer } from '@/geo/map/map-viewer';
import { AbstractBaseLayer } from './abstract-base-layer';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Abstract Geoview Layer managing an OpenLayer layer.
@@ -387,9 +388,9 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
* Overridable function to return the type of the specified field from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
*
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected getFieldType(fieldName: string): TypeOutfieldsType {
// Log
logger.logWarning(`getFieldType is not implemented for ${fieldName} on layer path ${this.getLayerPath()}`);
return 'string';
@@ -479,10 +480,10 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
* 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 {TypeOutfieldsType} 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') {
@@ -567,7 +568,7 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
// 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' } = {};
+ const dictFieldTypes: { [fieldName: string]: TypeOutfieldsType } = {};
// Loop on the promised feature infos
let featureKeyCounter = 0;
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 92fe0bbcf9c..0bf60a27acf 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
@@ -9,10 +9,8 @@ import Feature from 'ol/Feature';
import Geometry from 'ol/geom/Geometry';
import { GeometryApi } from '@/geo/layer/geometry/geometry';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { validateExtent, getMinOrMaxExtents } from '@/geo/utils/utilities';
import { Projection } from '@/geo/utils/projection';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { logger } from '@/core/utils/logger';
import { DateMgt } from '@/core/utils/date-mgt';
import { EsriDynamicLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config';
@@ -29,6 +27,7 @@ import {
} from '@/geo/map/map-schema-types';
import { esriGetFieldType, esriGetFieldDomain } from '../utils';
import { AbstractGVRaster } from './abstract-gv-raster';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
type TypeFieldOfTheSameValue = { value: string | number | Date; nbOccurence: number };
type TypeQueryTree = { fieldValue: string | number | Date; nextField: TypeQueryTree }[];
@@ -98,9 +97,9 @@ export class GVEsriDynamic extends AbstractGVRaster {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// Redirect
return esriGetFieldType(this.getLayerConfig(), fieldName);
}
@@ -129,7 +128,7 @@ export class GVEsriDynamic extends AbstractGVRaster {
const [geometryType] = layerConfig.getTypeGeometries();
// Fetch the features
- let urlRoot = layerConfig.geoviewLayerConfig.metadataAccessPath![AppEventProcessor.getDisplayLanguage(this.getMapId())]!;
+ let urlRoot = layerConfig.geoviewLayerConfig.metadataAccessPath!;
if (!urlRoot.endsWith('/')) urlRoot += '/';
// TODO: we put false so on heavy geometry, dynamic layer can load datatable. If not the featch fails.
const url = `${urlRoot}${layerConfig.layerId}/query?where=1=1&outFields=*&f=json&returnGeometry=false`;
@@ -275,7 +274,7 @@ export class GVEsriDynamic extends AbstractGVRaster {
// If not queryable
if (!layerConfig.source?.featureInfo?.queryable) return [];
- let identifyUrl = getLocalizedValue(layerConfig.source?.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.getMapId()));
+ let identifyUrl = layerConfig.source?.dataAccessPath;
if (!identifyUrl) return [];
identifyUrl = identifyUrl.endsWith('/') ? identifyUrl : `${identifyUrl}/`;
@@ -757,7 +756,7 @@ export class GVEsriDynamic extends AbstractGVRaster {
override async getExtentFromFeatures(layerPath: string, objectIds: string[]): Promise {
// Get url for service from layer entry config
const layerEntryConfig = this.getLayerConfig();
- let baseUrl = getLocalizedValue(layerEntryConfig.source.dataAccessPath, AppEventProcessor.getDisplayLanguage(this.getMapId()));
+ let baseUrl = layerEntryConfig.source.dataAccessPath;
const idString = objectIds.join('%2C');
if (baseUrl) {
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts
index b00c296ff70..a7c00b9007d 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts
@@ -3,7 +3,6 @@ import { Options as ImageOptions } from 'ol/layer/BaseImage';
import { Image as ImageLayer } from 'ol/layer';
import { Extent } from 'ol/extent';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { DateMgt } from '@/core/utils/date-mgt';
import { logger } from '@/core/utils/logger';
import { EsriImageLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config';
@@ -16,11 +15,11 @@ import {
rangeDomainType,
} from '@/geo/map/map-schema-types';
import { esriGetFieldType, esriGetFieldDomain } from '../utils';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { validateExtent } from '@/geo/utils/utilities';
import { getLegendStyles } from '@/geo/utils/renderer/geoview-renderer';
import { AbstractGVRaster } from './abstract-gv-raster';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages an Esri Image layer.
@@ -81,9 +80,9 @@ export class GVEsriImage extends AbstractGVRaster {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// TODO: Refactor - Layers refactoring. Is this function really valid for an esri-image? Remove?
// Redirect
return esriGetFieldType(this.getLayerConfig(), fieldName);
@@ -107,10 +106,7 @@ export class GVEsriImage extends AbstractGVRaster {
const layerConfig = this.getLayerConfig();
try {
if (!layerConfig) return null;
- const legendUrl = `${getLocalizedValue(
- layerConfig.geoviewLayerConfig.metadataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- )}/legend?f=json`;
+ const legendUrl = `${layerConfig.geoviewLayerConfig.metadataAccessPath}/legend?f=json`;
const response = await fetch(legendUrl);
const legendJson: TypeEsriImageLayerLegend = await response.json();
let legendInfo;
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-image-static.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-image-static.ts
index e21e2cfe34a..897a23c52cc 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-image-static.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-image-static.ts
@@ -6,10 +6,8 @@ import axios from 'axios';
import { Cast, TypeJsonObject } from '@/core/types/global-types';
import { CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
import { ImageStaticLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/image-static-layer-entry-config';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { loadImage } from '@/geo/utils/renderer/geoview-renderer';
import { AbstractGVRaster } from './abstract-gv-raster';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
@@ -73,7 +71,7 @@ export class GVImageStatic extends AbstractGVRaster {
* @returns {blob} A promise of an image blob
* @private
*/
- #getLegendImage(layerConfig: ImageStaticLayerEntryConfig): Promise {
+ static #getLegendImage(layerConfig: ImageStaticLayerEntryConfig): Promise {
const promisedImage = new Promise((resolve) => {
const readImage = (blob: Blob): Promise =>
// eslint-disable-next-line @typescript-eslint/no-shadow
@@ -84,10 +82,7 @@ export class GVImageStatic extends AbstractGVRaster {
reader.readAsDataURL(blob);
});
- let legendUrl: string | undefined = getLocalizedValue(
- layerConfig.source.dataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- );
+ let legendUrl: string | undefined = layerConfig.source.dataAccessPath;
if (legendUrl) {
legendUrl = legendUrl.toLowerCase().startsWith('http:') ? `https${legendUrl.slice(4)}` : legendUrl;
@@ -110,7 +105,7 @@ export class GVImageStatic extends AbstractGVRaster {
override async getLegend(): Promise {
const layerConfig = this.getLayerConfig();
try {
- const legendImage = await this.#getLegendImage(layerConfig!);
+ const legendImage = await GVImageStatic.#getLegendImage(layerConfig!);
if (!legendImage) {
const legend: TypeLegend = {
type: CONST_LAYER_TYPES.IMAGE_STATIC,
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 ec26a3e296f..447f57baaaf 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
@@ -9,13 +9,12 @@ import { Extent } from 'ol/extent';
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';
+import { xmlToJson } from '@/core/utils/utilities';
import { DateMgt } from '@/core/utils/date-mgt';
import { getExtentIntersection, validateExtentWhenDefined } from '@/geo/utils/utilities';
import { logger } from '@/core/utils/logger';
import { OgcWmsLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config';
import { TypeFeatureInfoEntry } from '@/geo/map/map-schema-types';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { loadImage } from '@/geo/utils/renderer/geoview-renderer';
import { AbstractGVRaster } from './abstract-gv-raster';
import { TypeLegend } from '@/core/stores/store-interface-and-intial-values/layer-state';
@@ -327,10 +326,8 @@ export class GVWMS extends AbstractGVRaster {
const legendUrlFromCapabilities = this.#getLegendUrlFromCapabilities(layerConfig, chosenStyle);
if (legendUrlFromCapabilities) queryUrl = legendUrlFromCapabilities.OnlineResource as string;
else if (Object.keys(this.getLayerConfig().getServiceMetadata()?.Capability?.Request || {}).includes('GetLegendGraphic'))
- queryUrl = `${getLocalizedValue(
- this.getLayerConfig().geoviewLayerConfig.metadataAccessPath,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- )!}service=WMS&version=1.3.0&request=GetLegendGraphic&FORMAT=image/png&layer=${layerConfig.layerId}`;
+ queryUrl = `${this.getLayerConfig().geoviewLayerConfig
+ .metadataAccessPath!}service=WMS&version=1.3.0&request=GetLegendGraphic&FORMAT=image/png&layer=${layerConfig.layerId}`;
if (queryUrl) {
queryUrl = queryUrl.toLowerCase().startsWith('http:') ? `https${queryUrl.slice(4)}` : queryUrl;
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/tile/gv-xyz-tiles.ts b/packages/geoview-core/src/geo/layer/gv-layers/tile/gv-xyz-tiles.ts
index 823d4f8131e..89fdc9508ef 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/tile/gv-xyz-tiles.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/tile/gv-xyz-tiles.ts
@@ -3,11 +3,11 @@ import { Options as TileOptions } from 'ol/layer/BaseTile';
import XYZ from 'ol/source/XYZ';
import { Extent } from 'ol/extent';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { XYZTilesLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/xyz-layer-entry-config';
import { AbstractGVTile } from './abstract-gv-tile';
import { featureInfoGetFieldType } from '../utils';
import { validateExtent } from '@/geo/utils/utilities';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages a Tile layer.
@@ -65,11 +65,11 @@ export class GVXYZTiles extends AbstractGVTile {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// Redirect
- return featureInfoGetFieldType(this.getLayerConfig(), fieldName, AppEventProcessor.getDisplayLanguage(this.getMapId()));
+ return featureInfoGetFieldType(this.getLayerConfig(), fieldName);
}
/**
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/utils.ts b/packages/geoview-core/src/geo/layer/gv-layers/utils.ts
index 82235deecff..be05fb60ebf 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/utils.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/utils.ts
@@ -6,9 +6,9 @@ import {
codedValueType,
rangeDomainType,
TypeFieldEntry,
+ TypeFeatureInfoLayerConfig,
} from '@/geo/map/map-schema-types';
-import { TypeDisplayLanguage, TypeLocalizedString } from '@/api/config/types/map-schema-types';
-import { getLocalizedValue } from '@/core/utils/utilities';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { EsriDynamicLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/esri-dynamic-layer-entry-config';
import { EsriFeatureLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/esri-feature-layer-entry-config';
@@ -18,29 +18,24 @@ import { EsriImageLayerEntryConfig } from '@/core/utils/config/validation-classe
* Returns the type of the specified field.
* @param {AbstractBaseLayerEntryConfig} layerConfig The layer config
* @param {string} fieldName field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
-export function featureInfoGetFieldType(
- layerConfig: AbstractBaseLayerEntryConfig,
- fieldName: string,
- language: TypeDisplayLanguage
-): 'string' | 'date' | 'number' {
- const fieldDefinitions = layerConfig.getLayerMetadata()!.source.featureInfo;
- const fieldIndex = getLocalizedValue(Cast(fieldDefinitions.outfields), language)?.split(',').indexOf(fieldName);
- if (!fieldIndex || fieldIndex === -1) return 'string';
- return (fieldDefinitions.fieldTypes as string).split(',')[fieldIndex!] as 'string' | 'date' | 'number';
+export function featureInfoGetFieldType(layerConfig: AbstractBaseLayerEntryConfig, fieldName: string): TypeOutfieldsType {
+ const fieldDefinitions = layerConfig.getLayerMetadata()?.source.featureInfo as unknown as TypeFeatureInfoLayerConfig;
+ const outFieldEntry = fieldDefinitions.outfields?.find((fieldDefinition) => fieldDefinition.name === fieldName);
+ return outFieldEntry?.type || 'string';
}
/**
* Returns the type of the specified field.
* @param {EsriDynamicLayerEntryConfig | EsriFeatureLayerEntryConfig | EsriImageLayerEntryConfig} layerConfig The ESRI layer config
* @param {string} fieldName field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
export function esriGetFieldType(
layerConfig: EsriDynamicLayerEntryConfig | EsriFeatureLayerEntryConfig | EsriImageLayerEntryConfig,
fieldName: string
-): 'string' | 'date' | 'number' {
+): TypeOutfieldsType {
const esriFieldDefinitions = layerConfig.getLayerMetadata()?.fields as TypeJsonArray;
const fieldDefinition = esriFieldDefinitions.find((metadataEntry) => metadataEntry.name === fieldName);
if (!fieldDefinition) return 'string';
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts
index ae87356e7f7..93aae8d9437 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts
@@ -12,7 +12,6 @@ import { ProjectionLike } from 'ol/proj';
import { DateMgt } from '@/core/utils/date-mgt';
import { FilterNodeArrayType, NodeType } from '@/geo/utils/renderer/geoview-renderer-types';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { logger } from '@/core/utils/logger';
import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config';
import { TypeFeatureInfoEntry } from '@/geo/map/map-schema-types';
@@ -20,8 +19,8 @@ import { analyzeLayerFilter, getAndCreateFeatureStyle } from '@/geo/utils/render
import { featureInfoGetFieldType } from '../utils';
import { AbstractGVLayer } from '../abstract-gv-layer';
import { AbstractGeoViewLayer } from '../../geoview-layers/abstract-geoview-layers';
-import { getLocalizedValue } from '@/core/utils/utilities';
import { getMinOrMaxExtents } from '@/geo/utils/utilities';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Abstract Geoview Layer managing an OpenLayer vector type layer.
@@ -36,11 +35,8 @@ export abstract class AbstractGVVector extends AbstractGVLayer {
protected constructor(mapId: string, olSource: VectorSource, layerConfig: VectorLayerEntryConfig) {
super(mapId, olSource, layerConfig);
- // TODO: remove link to language, layer should be created in one language and recreated if needed to change
- const language = AppEventProcessor.getDisplayLanguage(mapId);
-
// Get the style label in case we need it later
- const label = getLocalizedValue(layerConfig.layerName, language) || layerConfig.layerId;
+ const label = layerConfig.layerName || layerConfig.layerId;
// Create the vector layer options.
const layerOptions: VectorLayerOptions = {
@@ -99,12 +95,11 @@ export abstract class AbstractGVVector extends AbstractGVLayer {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @param {AbstractBaseLayerEntryConfig} layerConfig - The layer configuration.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// Redirect
- return featureInfoGetFieldType(this.getLayerConfig(), fieldName, AppEventProcessor.getDisplayLanguage(this.getMapId()));
+ return featureInfoGetFieldType(this.getLayerConfig(), fieldName);
}
/**
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-esri-feature.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-esri-feature.ts
index 92ad3509336..fac831cf400 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-esri-feature.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-esri-feature.ts
@@ -4,6 +4,7 @@ import { EsriFeatureLayerEntryConfig } from '@/core/utils/config/validation-clas
import { codedValueType, rangeDomainType } from '@/geo/map/map-schema-types';
import { esriGetFieldType, esriGetFieldDomain } from '../utils';
import { AbstractGVVector } from './abstract-gv-vector';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages an Esri Feature layer.
@@ -34,9 +35,9 @@ export class GVEsriFeature extends AbstractGVVector {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// Redirect
return esriGetFieldType(this.getLayerConfig(), fieldName);
}
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-ogc-feature.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-ogc-feature.ts
index deb5bd3cc6c..8e32af28ca4 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-ogc-feature.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-ogc-feature.ts
@@ -1,6 +1,7 @@
import VectorSource from 'ol/source/Vector';
import { AbstractGVVector } from './abstract-gv-vector';
import { OgcFeatureLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/ogc-layer-entry-config';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages an OGC-Feature layer.
@@ -33,9 +34,9 @@ export class GVOGCFeature extends AbstractGVVector {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
const fieldDefinitions = this.getLayerConfig().getLayerMetadata()!;
const fieldEntryType = (fieldDefinitions[fieldName].type as string).split(':').slice(-1)[0] as string;
if (fieldEntryType === 'date') return 'date';
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-vector-tiles.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-vector-tiles.ts
index c5b198bf6e2..fb418da78a1 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-vector-tiles.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-vector-tiles.ts
@@ -2,10 +2,10 @@ import VectorTileLayer from 'ol/layer/VectorTile';
import { Options as TileOptions } from 'ol/layer/BaseTile';
import { VectorTile } from 'ol/source';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { VectorTilesLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/vector-tiles-layer-entry-config';
import { featureInfoGetFieldType } from '../utils';
import { AbstractGVVectorTile } from './abstract-gv-vector-tile';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages a Vector Tiles layer.
@@ -45,10 +45,10 @@ export class GVVectorTiles extends AbstractGVVectorTile {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
// Redirect
- return featureInfoGetFieldType(this.getLayerConfig(), fieldName, AppEventProcessor.getDisplayLanguage(this.getMapId()));
+ return featureInfoGetFieldType(this.getLayerConfig(), fieldName);
}
}
diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-wfs.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-wfs.ts
index 1c699e48603..e5f0ce6dea0 100644
--- a/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-wfs.ts
+++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/gv-wfs.ts
@@ -2,6 +2,7 @@ import { Vector as VectorSource } from 'ol/source';
import { TypeJsonArray } from '@/core/types/global-types';
import { AbstractGVVector } from './abstract-gv-vector';
import { WfsLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-validation-classes/wfs-layer-entry-config';
+import { TypeOutfieldsType } from '@/api/config/types/map-schema-types';
/**
* Manages a WFS layer.
@@ -34,9 +35,9 @@ export class GVWFS extends AbstractGVVector {
/**
* Overrides the return of the field type from the metadata. If the type can not be found, return 'string'.
* @param {string} fieldName - The field name for which we want to get the type.
- * @returns {'string' | 'date' | 'number'} The type of the field.
+ * @returns {TypeOutfieldsType} The type of the field.
*/
- protected override getFieldType(fieldName: string): 'string' | 'date' | 'number' {
+ protected override getFieldType(fieldName: string): TypeOutfieldsType {
const fieldDefinitions = this.getLayerConfig().getLayerMetadata() as TypeJsonArray;
const fieldDefinition = fieldDefinitions.find((metadataEntry) => metadataEntry.name === fieldName);
if (!fieldDefinition) return 'string';
diff --git a/packages/geoview-core/src/geo/layer/layer-mockup.ts b/packages/geoview-core/src/geo/layer/layer-mockup.ts
index 5c1b5ec6d6c..c95a39990e6 100644
--- a/packages/geoview-core/src/geo/layer/layer-mockup.ts
+++ b/packages/geoview-core/src/geo/layer/layer-mockup.ts
@@ -35,8 +35,8 @@ export abstract class LayerMockup {
return {
geoviewLayerId: 'esriTop100',
geoviewLayerType: 'esriFeature',
- geoviewLayerName: { en: 'My custom default label for creation' },
- metadataAccessPath: { en: 'https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/900A_and_top_100_en/MapServer' },
+ geoviewLayerName: 'My custom default label for creation',
+ metadataAccessPath: 'https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/900A_and_top_100_en/MapServer',
serviceDateFormat: 'DD/MM/YYYY HH:MM:SSZ',
externalDateFormat: 'DD/MM/YYYY HH:MM:SSZ',
listOfLayerEntryConfig: [
@@ -979,7 +979,7 @@ export abstract class LayerMockup {
static configPolygonsMetadata(): TypeJsonObject {
return {
layerId: 'polygons.json',
- layerName: { en: 'Polygons' },
+ layerName: 'Polygons',
source: {
featureInfo: {
queryable: true,
@@ -1066,7 +1066,7 @@ export abstract class LayerMockup {
static configLinesMetadata(): TypeJsonObject {
return {
layerId: 'lines.json',
- layerName: { en: 'Lines' },
+ layerName: 'Lines',
source: {
featureInfo: {
queryable: false,
@@ -1111,7 +1111,7 @@ export abstract class LayerMockup {
static configIconPointsMetadata(): TypeJsonObject {
return {
layerId: 'icon_points.json',
- layerName: { en: 'Icons' },
+ layerName: 'Icons',
source: {
featureInfo: {
queryable: true,
@@ -1156,7 +1156,7 @@ export abstract class LayerMockup {
static configPointsMetadata(): TypeJsonObject {
return {
layerId: 'points.json',
- layerName: { en: 'Points' },
+ layerName: 'Points',
source: {
featureInfo: {
queryable: false,
@@ -1217,7 +1217,7 @@ export abstract class LayerMockup {
static configPoints1Metadata(): TypeJsonObject {
return {
layerId: 'points_1.json',
- layerName: { en: 'Points_1' },
+ layerName: 'Points_1',
source: {
featureInfo: {
queryable: true,
@@ -1278,7 +1278,7 @@ export abstract class LayerMockup {
static configPoints2Metadata(): TypeJsonObject {
return {
layerId: 'points_2.json',
- layerName: { en: 'Points_1' },
+ layerName: 'Points_1',
source: {
featureInfo: {
queryable: true,
@@ -1339,7 +1339,7 @@ export abstract class LayerMockup {
static configPoints3Metadata(): TypeJsonObject {
return {
layerId: 'points_3.json',
- layerName: { en: 'Points_1' },
+ layerName: 'Points_1',
source: {
featureInfo: {
queryable: false,
diff --git a/packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts b/packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts
index 8dcccd024ea..0b9e30c1237 100644
--- a/packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts
+++ b/packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts
@@ -12,10 +12,9 @@ import {
import { TypeAllFeatureInfoResultSetEntry } from '@/core/stores/store-interface-and-intial-values/data-table-state';
import { TypeFeatureInfoResultSetEntry, TypeHoverResultSetEntry } from '@/core/stores/store-interface-and-intial-values/feature-info-state';
import { AbstractGeoViewLayer, LayerNameChangedEvent } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
-import { generateId, getLocalizedValue, whenThisThen } from '@/core/utils/utilities';
+import { generateId, whenThisThen } from '@/core/utils/utilities';
import { ConfigBaseClass, LayerStatusChangedEvent } from '@/core/utils/config/validation-classes/config-base-class';
import { LayerApi } from '@/geo/layer/layer';
-import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor';
import { AbstractGVLayer } from '../gv-layers/abstract-gv-layer';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';
import { EsriDynamic } from '../geoview-layers/raster/esri-dynamic';
@@ -183,7 +182,7 @@ export abstract class AbstractLayerSet {
this.resultSet[layerConfig.layerPath] = {
layerPath: layerConfig.layerPath,
layerStatus: layerConfig.layerStatus,
- layerName: getLocalizedValue(layerConfig.layerName, AppEventProcessor.getDisplayLanguage(this.getMapId()))!,
+ layerName: layerConfig.layerName!,
};
// Register the layer status changed handler
@@ -247,7 +246,7 @@ export abstract class AbstractLayerSet {
// TODO: Refactor - Layers refactoring. Remove the layerPath parameter once hybrid work is done
// Get layer name
- const layerName = getLocalizedValue(layer.getLayerName(layerPath), AppEventProcessor.getDisplayLanguage(this.getMapId()))!;
+ const layerName = layer.getLayerName(layerPath)!;
// If not there (wasn't pre-registered via a config-registration)
if (!(layerPath in this.resultSet)) {
@@ -344,10 +343,7 @@ export abstract class AbstractLayerSet {
// If the layer path exists for the layer name that changed
if (this.resultSet[layerNameEvent.layerPath]) {
// Call the overridable function to process a layer name change
- this.onProcessNameChanged(
- layerNameEvent.layerPath,
- getLocalizedValue(layerNameEvent.layerName, AppEventProcessor.getDisplayLanguage(this.getMapId()))!
- );
+ this.onProcessNameChanged(layerNameEvent.layerPath, layerNameEvent.layerName!);
// Propagate to the store
this.onPropagateToStore(this.resultSet[layerNameEvent.layerPath], 'layerName');
@@ -372,10 +368,7 @@ export abstract class AbstractLayerSet {
// Update the name with a possibly updated layerName during layer status progression
// (depending on how this translates in the new layers process, might not need this anymore)
- this.resultSet[layerConfig.layerPath].layerName = getLocalizedValue(
- layerConfig.layerName || layerConfig.geoviewLayerConfig.geoviewLayerName,
- AppEventProcessor.getDisplayLanguage(this.getMapId())
- )!;
+ this.resultSet[layerConfig.layerPath].layerName = layerConfig.layerName || layerConfig.geoviewLayerConfig.geoviewLayerName!;
}
/**
diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts
index 173021d044d..e690bf452c3 100644
--- a/packages/geoview-core/src/geo/layer/layer.ts
+++ b/packages/geoview-core/src/geo/layer/layer.ts
@@ -13,7 +13,7 @@ import { FeatureHighlight } from '@/geo/map/feature-highlight';
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
import { ConfigValidation } from '@/core/utils/config/config-validation';
-import { createLocalizedString, generateId, whenThisThen } from '@/core/utils/utilities';
+import { generateId, whenThisThen } from '@/core/utils/utilities';
import { ConfigBaseClass } from '@/core/utils/config/validation-classes/config-base-class';
import { logger } from '@/core/utils/logger';
import { AbstractGeoViewLayer, LayerCreationEvent, LayerRequestingEvent } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
@@ -1514,7 +1514,7 @@ export class LayerApi {
// If found
if (layer) {
// Set the layer name on the layer
- layer.setLayerName(layerPath, createLocalizedString(name));
+ layer.setLayerName(layerPath, name);
} else {
logger.logError(`Unable to find layer ${layerPath}`);
}
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 821bb25dcad..4f646b0292b 100644
--- a/packages/geoview-core/src/geo/map/map-schema-types.ts
+++ b/packages/geoview-core/src/geo/map/map-schema-types.ts
@@ -13,7 +13,6 @@ import {
TypeOverlayObjects,
TypeValidMapProjectionCodes,
TypeDisplayTheme,
- TypeLocalizedString,
TypeLayerStates,
TypeLayerControls,
TypePostSettings,
@@ -84,7 +83,7 @@ export type TypeFeatureInfoLayerConfig = {
export type TypeBaseSourceVectorInitialConfig = {
/** Path used to access the data. */
- dataAccessPath?: TypeLocalizedString;
+ dataAccessPath?: string;
/** Settings to use when loading a GeoJSON layer using a POST instead of a GET */
postSettings?: TypePostSettings;
/** The feature format used by the XHR feature loader when url is set. */
@@ -290,7 +289,7 @@ export type TypeBaseSourceImageInitialConfig = {
* The service endpoint of the layer (English/French). If not specified, the metadataAccessPath of the GeoView parent
* layer is used
*/
- dataAccessPath?: TypeLocalizedString;
+ dataAccessPath?: string;
/**
* The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data
* with the Canvas renderer.
@@ -377,9 +376,9 @@ export type TypeGeoviewLayerConfig = {
* The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this
* information.
*/
- geoviewLayerName?: TypeLocalizedString;
+ geoviewLayerName?: string;
/** The GeoView layer access path (English/French). */
- metadataAccessPath?: TypeLocalizedString;
+ metadataAccessPath?: string;
/** Type of GeoView layer. */
geoviewLayerType: TypeGeoviewLayerType;
/** Date format used by the service endpoint. */
@@ -413,7 +412,7 @@ export type GeoCoreLayerConfig = {
// TO.DOCONT: I think it is working with other type of layer. Now having geocore not a layer type anymore, we should be able to overrides.
// TO.DOCONT: For this we will need a little trick because when we create the config the setting are set at the root level and in our config it will take it from the layerID.
// TO.DOCONT: There is refactor to do to make this work for all layer type. Global setting should be cascade to child of the root layer.
- geoviewLayerName: TypeLocalizedString;
+ geoviewLayerName: string;
};
/**
diff --git a/packages/geoview-time-slider/schema.json b/packages/geoview-time-slider/schema.json
index d7a27a3c85f..e305fdd55a3 100644
--- a/packages/geoview-time-slider/schema.json
+++ b/packages/geoview-time-slider/schema.json
@@ -12,34 +12,14 @@
"type": "object",
"properties": {
"title": {
- "type": "object",
- "properties": {
- "en": {
- "type": "string",
- "default": "Time slider title",
- "description": "The English version of the string."
- },
- "fr": {
- "type": "string",
- "default": "Titre du curseur temporel",
- "description": "The French version of the string. "
- }
- }
+ "type": "string",
+ "default": "Time slider title",
+ "description": "The title to display"
},
"description": {
- "type": "object",
- "properties": {
- "en": {
- "type": "string",
- "default": "Time slider description",
- "description": "The English version of the string."
- },
- "fr": {
- "type": "string",
- "default": "Description du curseur temporel",
- "description": "The French version of the string. "
- }
- }
+ "type": "string",
+ "default": "Time slider description",
+ "description": "The description to use."
},
"locked": {
"type": "boolean",
diff --git a/packages/geoview-time-slider/src/time-slider-types.tsx b/packages/geoview-time-slider/src/time-slider-types.tsx
index 70b24083e36..dfd29bc8504 100644
--- a/packages/geoview-time-slider/src/time-slider-types.tsx
+++ b/packages/geoview-time-slider/src/time-slider-types.tsx
@@ -1,10 +1,9 @@
import { TimeDimension } from 'geoview-core/src/core/utils/date-mgt';
-import { TypeLocalizedString } from 'geoview-core/src/api/config/types/map-schema-types';
export type SliderProps = {
layerPaths: string[];
- title: TypeLocalizedString;
- description: TypeLocalizedString;
+ title: string;
+ description: string;
locked: boolean;
reversed: boolean;
defaultValue: string;
diff --git a/packages/geoview-time-slider/src/time-slider.tsx b/packages/geoview-time-slider/src/time-slider.tsx
index e675e246a34..c5353176607 100644
--- a/packages/geoview-time-slider/src/time-slider.tsx
+++ b/packages/geoview-time-slider/src/time-slider.tsx
@@ -7,7 +7,7 @@ import {
} from 'geoview-core/src/core/stores/store-interface-and-intial-values/time-slider-state';
import { useLayerLegendLayers } from 'geoview-core/src/core/stores/store-interface-and-intial-values/layer-state';
import { LegendEventProcessor } from 'geoview-core/src/api/event-processors/event-processor-children/legend-event-processor';
-import { getLocalizedValue, getLocalizedMessage } from 'geoview-core/src/core/utils/utilities';
+import { getLocalizedMessage } from 'geoview-core/src/core/utils/utilities';
import { useAppDisplayLanguage } from 'geoview-core/src/core/stores/store-interface-and-intial-values/app-state';
import { logger } from 'geoview-core/src/core/utils/logger';
@@ -224,8 +224,8 @@ export function TimeSlider(props: TimeSliderProps): JSX.Element {
// TODO: add mechanism to initialize these values during store onInitialize
const sliderConfig = config?.sliders?.find((o: { layerPaths: string[] }) => o.layerPaths.includes(layerPath));
- if (title === undefined) setTitle(layerPath, getLocalizedValue(sliderConfig?.title, displayLanguage) || '');
- if (description === undefined) setDescription(layerPath, getLocalizedValue(sliderConfig?.description, displayLanguage) || '');
+ if (title === undefined) setTitle(layerPath, sliderConfig?.title || '');
+ if (description === undefined) setDescription(layerPath, sliderConfig?.description || '');
if (locked === undefined) setLocked(layerPath, sliderConfig?.locked !== undefined ? sliderConfig?.locked : false);
if (reversed === undefined) setReversed(layerPath, sliderConfig?.reversed !== undefined ? sliderConfig?.reversed : false);
if (defaultValue === undefined) setDefaultValue(layerPath, sliderConfig?.defaultValue || '');