Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2608 geo core initial settings #2651

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"map": {
"interaction": "dynamic",
"viewSettings": {
"projection": 3978
},
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": false
},
"listOfGeoviewLayerConfig": [
{
"geoviewLayerType": "geoCore",
"geoviewLayerId": "21b821cf-0f1c-40ee-8925-eab12d357668",
"listOfLayerEntryConfig": [
{
"layerId": "0",
"entryType": "group",
"layerName": "Airborne Radioactivity - Main Group",
"listOfLayerEntryConfig": [
{
"layerId": "1",
"layerName": "Airborne Radioactivity - Feature Layer",
"initialSettings": {
"states": {
"visible": false
}
}
}
]
}
]
},
{
"geoviewLayerType": "geoCore",
"geoviewLayerId": "0fca08b5-e9d0-414b-a3c4-092ff9c5e326",
"listOfLayerEntryConfig": [
{
"layerId": "6",
"layerName": "NS Marine Water Quality Data",
"initialSettings": {
"states": {
"hoverable": true,
"legendCollapsed": false,
"opacity": 0.3,
"queryable": true,
"visible": true
}
}
}
]
},
{
"geoviewLayerType": "geoCore",
"geoviewLayerId": "03ccfb5c-a06e-43e3-80fd-09d4f8f69703",
"listOfLayerEntryConfig": [
{
"layerId": "regina",
"layerName": "Temporal Series of the National Air Photo Library (NAPL) - Regina, Saskatchewan (1947-1967) / Série temporelle de la photothèque nationale de l'air (PNA) - Regina, Saskatchewan (1947-1967)",
"initialSettings": {
"states": {
"opacity": 0.5
},
"controls": {
"highlight": false,
"hover": false,
"opacity": true,
"query": false,
"remove": true,
"table": false,
"visibility": true,
"zoom": true
}
}
}
]
},
{
"geoviewLayerType": "geoCore",
"geoviewLayerId": "ccc75c12-5acc-4a6a-959f-ef6f621147b9",
"listOfLayerEntryConfig": [
{
"layerId": "0",
"layerStyle": {
"Point": {
"type": "uniqueValue",
"hasDefault": false,
"fields": ["SYMBOL_EN"],
"info": [
{
"label": "Confederation to 1914",
"visible": true,
"values": ["Confederation to 1914"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAahJREFUKJGd0ksoRFEcBvDvjMvci3E9GkxMxttYIIQo8igWHkmsRikLoSxlbSVZjKasyIIFmhQa5JmFZOGxMHYjeSQLxsw05ozhHgtcMWYWvjqbU7/zP9/pcPhnuN8blDqiGSONBCQHYG8gOPV62ZooijQgpB5XtySxsZvLu+j72weEcApoUzVQJ8TeejyuHkFQWfwgpc6BpwfH+PToCs4Xrn/com6oIKm1q26ZUmc7z0ctypBSZ7qX+sZMg3O42nn067M1cgoffVUYBpomKXXs8rxo5wCAMfQc7VtD/0Jf2TOeoaq5OEabmmgAYOIAgABlZ4e2wE/4GZv1ClqdpkyGAAl/dtGg6KPSCwAWLndkgE2bpS6y4joojE+KAwi5kCEBzKXVeR3rw8cBkSqbhz4/DYzBLEMlH2lOTtHsd07UVsz0bfuhsIQQ9BvbwAv8vCCoDr4nEsJe3O62yoaSVY0lvnB36QjWzUsoxVAU1megpqUU6sTYDUlSdH8dJn+AsIiIe8bs5Zm5ut5Mvc6AIegBvAE4AcGUUhk5SwiR/ODH5BgvAOPnCpp3ofqRTtNnzMYAAAAASUVORK5CYII=",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
},
{
"label": "First World War",
"visible": false,
"values": ["First World War"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAZ5JREFUKJGd0ssvA1EUBvDvjqmZelUH7UwkbZQFQSKqImw8dtLEomFlZ9HY+EssiC07G1IWBInEYyMWgiZeG7owI6lE23REemdavRZqhCqJLzmbm/zuOefm8vhn+O8HlKZrGSNBAtIKsFcQRA2D7TgcDloS0szzFMuz2Xg8XvuUSILjOCiyDElyPmQyz2G7vXqrCFKqz+hpfX5jcweapn2Zoqurs3FkeGiDUn1cFGvWLUip3mwY2dmV1TUkEsmifaLRC+SyOS4YHF2kNH0gio4UDwCMIXx9fWP7CX3k8uoG/p5up6K4JwEs8ABAgL6721jpJyzk/l6FIst9FgRIhWGaf0LTNAGwCmtHBty5XPV+VdV+hXV1EkBIzIIEiHR0tE+cnkZLIkEQ4PM1gTFELCiIVRFFlo9GhgcH9vYPi5DNxiMUGoMgiCt2e/XxZ0dCmPnyEgoE/Nsud0P3yckZVFUDz5ehpcWH3t4AJMm5m89zUx+XWR+gvLLykbFUv9frmfZ6PJMA2gC8AjgHwZIgVC0TQvJF8L2z0wAwV6hf8waIeZGd6U5WcwAAAABJRU5ErkJggg==",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
},
{
"label": "Second World War",
"visible": true,
"values": ["Second World War"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAZ5JREFUKJGd0EsoRFEYB/D/GZe511zzyhhiMTMiQxI2YsPKMylRSkqKlFhpSspGSRSSjcdOpAalPGJhpUkWrFiI2RiSzDTX454rc48FrhiP8q9TX6d+fQ8O/wz39YPSsJkxUkNAsgAWAcGRorBNk8lEf4RUvmtjqjoa8vvN94FL6LgYmF0uiHZ7QJbvOgQhYT0KUip1y7fBicOhEUgzC5+mSBnuT81pbVmjVGrgeeOKBimV0p+pMnrQ68Hj8nbUPleeQahU0eX3dM1SGt7leVOIAwDG0HGx54v9Dr3nemAEwdpqi9XlaAYwyQEAAYpufPs/n/AtweMTWJ3OIg0CJP5ZCv8JI7IMgMVrOzLgTMzKLPyLGtJSAULONUgAb1pZaWPgF8QV5iApLxeMwatBPS96LQ7nXsbidMlpU3sUinHYkDc1hljBsCQICb6PjoSwp4eH+vTK8g2jb6vAv7oGaWMHxGpEYlUFXHW1EJPt26qqa9MmeC/iDIZrxkLFtmx3p83tbkafxw0gAuAQBHN6vThPCFGj4GtniwJg/O39mhf/K5CfkLtGyAAAAABJRU5ErkJggg==",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
},
{
"label": "Korean War",
"visible": false,
"values": ["Korean War"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAYtJREFUKJGdz79rU2EUxvHvSa+5N2libixtwEpTEYkZjKBLsItQapfiInYKXTIEQd0U/AdcTKG2a91cxCCoVEEonSTiYkEIVKiIYCQdDEkoeW+09zioVzTGgg+8cHjhc35Y/GesPz+MabmqMifICdA9hE3P02eJRMIMhKbbKeL7Zdl572qzDkNDMHoU20197HY7pUgkvtYHjWlfo/P5jr++CI0Hv6+RuT4uUwuPjWlfcpyDDwNoTPsYPa/sr92E1kbfPbp1G756IZm+smpMa8NxEk0LQJUSb6sH/oYCvL0MJ+eSkkoXgBULQCCvH14NREHqNRibzAcQJKq99v7wiwE0GtyosC0jx89oYx/oHgaRdwEUqGjm3Dy1W4ORnYF0DlUqAbSdWMUbnXxBfmVKX17tR9YhZKYM4ej9SCRe/TVRRHu7uxf93OxTRh6d1jdP4NM6WHFk4jycugBu6rnvh4pBr59FeHi4odo86x3JXpbxbAFuZIE94DXCXduO3RMRvw9+n5z0gKUf75/5BuXZh6Fohy1dAAAAAElFTkSuQmCC",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
},
{
"label": "Peacekeeping",
"visible": true,
"values": ["Peacekeeping"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAatJREFUKJGd0jFoE1Ecx/HvP7kmd03iJSElwaLYq4OpRSQKFgUFt0IpFNGpkx2Ki1hcHNxdCio6OOjmoBAiiFZwEYTSrRYpioNBtLYErUlzxHuJ5p6D7YnGVPAH/+XB5/3//8cz+M8Yfx4otZHUWsYE2Qe6jbDUbOontm2rrlB57pTv69l3lVpyZb1BOCwMZm1yqfhHz3OnLSvxuAMqVT+/Xv96/crcMjfX3N+muDqc7T97Iv9Qqfpp09xRCqBS9UHVas9eLC1xr+p17DOzXKH5zQ9dGD1wW6mNZ6ZpVw0ArZmef73a8ze0lUtvPjFeqKWcnD0J3DAABEYWyp+7P+FmXn34gpNNjgQQpLfW+v5P6LXagO4NdtTwNp+JH2LV3Rb2p2MgUg6gQPHk/p1neLnWFR2JGBx0+tCaYgCjZrw4kGX+wXHn2MTzcgfaGw5xa3wYK9Jz37ISC786iuhWo3FqtDAwt9iXKJQW3/NoxSVtCGNOmonDe8ilYk99PzS1dVnwASKxWEXr6tGh3ZlzQ7syk5chD7SBFwh3otH4XRHxO+DPzqkmcG2zts0PBFWRZ33W55YAAAAASUVORK5CYII=",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
},
{
"label": "Afghanistan",
"visible": false,
"values": ["Afghanistan"],
"settings": {
"type": "iconSymbol",
"mimeType": "image/png",
"src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAadJREFUKJGd0ksoRFEYB/D/MZe5dzzGlccUxjOZsRksyLBRkkghVlZmISWRzSzsWShkFhQ7CzKNyCsbG1KTmBSJvMpzYYaZpjl35B4L44oxlH99m1O/833f6XD4Z7jvB5Q+JzJGGghIIcBeQeCSJLam1WppREgDPossy8OXD1eJ1+57qFQq5KVmQyem3AQCvk5BiF8Jg5R6ex59nrHB9UnY7pxfphgpak7vqGpbotTbyvMJDgVS6s2jweBw/+IQZt2nYfv0HTogvUhRvbWWKUqfN3le6+EAgDF0bh87o39CH7GerKDRVCPm6jLbAYxzAECA8p0LV+QnDOXo5gS5afpyBQJE8/Ti/xMGghQA0yg7MuDMkJxVilvnrzBd1AGEnCuQAPZqg7kNB/MRUZlahCnHCMZgV6Caj7PnpOq3Fyq7zU1btjCUz/GYqLdCiNHMCUL8zmdHQljQ72+pK65e3UvOKHG4NrB8u4skjkdDthlNJbXQiSkbshxl+bhM+QAxsbEPjHkqjPqCLmNmQfsAYADwCmAfBNNqddwMIUQOg++dRQnAaKh+zRtAE5CN4Z5HEQAAAABJRU5ErkJggg==",
"rotation": 0,
"opacity": 1,
"offset": [0, 0]
}
}
]
}
}
}
]
}
]
},
"components": ["overview-map"],
"overviewMap": {
"hideOnZoom": 7
},
"footerBar": {
"tabs": {
"core": ["legend", "layers", "details", "geochart", "data-table"]
}
},
"corePackages": [],
"theme": "geo.ca"
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ <h1><strong>Configurations Navigator</strong></h1>
<option value="./configs/navigator/24-vector-tile.json">Layer - Vector Tile -</option>
<option value="./configs/navigator/25-geojson-multi.json">Layer - GeoJSON MutiPolygon -</option>
<option value="./configs/navigator/28-geocore.json">Layer GeoView - GeoCore -</option>
<option value="./configs/navigator/28-geocore-custom-inline-config.json">Layer GeoView - GeoCore Custom Inline Config -</option>
<option value="./configs/navigator/27-geocore-custom.json">Layer GeoView - GeoCore Custom Config -</option>
<option value="./configs/navigator/29-geopackages.json">Layer GeoView - GeoPackages -</option>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,19 @@ export function AddNewLayer(): JSX.Element {
});
} else if (layerEntries.length > 0) {
(layerEntries as TypeGeoviewLayerConfig[]).forEach((geoviewLayerConfig) => {
const addedLayer = api.maps[mapId].layer.addGeoviewLayer(geoviewLayerConfig);
if (addedLayer) addedLayers.push(addedLayer);
if (layerName !== geoviewLayerConfig.geoviewLayerName) {
const tempConfig = geoviewLayerConfig;
if (tempConfig.listOfLayerEntryConfig.length > 1) {
tempConfig.geoviewLayerName = layerName;
} else {
tempConfig.listOfLayerEntryConfig[0].layerName = layerName;
}
const addedLayer = api.maps[mapId].layer.addGeoviewLayer(tempConfig);
if (addedLayer) addedLayers.push(addedLayer);
} else {
const addedLayer = api.maps[mapId].layer.addGeoviewLayer(geoviewLayerConfig);
if (addedLayer) addedLayers.push(addedLayer);
}
});
}

Expand Down
1 change: 1 addition & 0 deletions packages/geoview-core/src/core/utils/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class Config {
listOfGeoviewLayerConfig.forEach((geoviewLayerEntry) => {
if (mapConfigLayerEntryIsGeoCore(geoviewLayerEntry)) {
// Skip it, because we don't validate the GeoCore configuration anymore. Not the same way as typical GeoView Layer Types at least.
// TODO Why not do GeoCore request here? Then could easily replace listOfLayerEntries and validate / process along with other layers
} else if (Object.values(CONST_LAYER_TYPES).includes((geoviewLayerEntry as TypeGeoviewLayerConfig).geoviewLayerType)) {
const geoViewLayerEntryCasted = geoviewLayerEntry as TypeGeoviewLayerConfig;
this.#setLayerEntryType(geoViewLayerEntryCasted.listOfLayerEntryConfig!, geoViewLayerEntryCasted.geoviewLayerType);
Expand Down
5 changes: 4 additions & 1 deletion packages/geoview-core/src/geo/layer/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
mapConfigLayerEntryIsGeoCore,
layerEntryIsGroupLayer,
TypeLayerStatus,
GeoCoreLayerConfig,
} from '@/geo/map/map-schema-types';
import { GeoJSON, layerConfigIsGeoJSON } from '@/geo/layer/geoview-layers/vector/geojson';
import { GeoPackage, layerConfigIsGeoPackage } from '@/geo/layer/geoview-layers/vector/geopackage';
Expand Down Expand Up @@ -371,7 +372,9 @@ export class LayerApi {
const geoCore = new GeoCore(this.getMapId(), this.mapViewer.getDisplayLanguage());

// Create the layers from the UUID
promisesOfGeoCoreGeoviewLayers.push(geoCore.createLayersFromUUID(geoviewLayerConfig.geoviewLayerId));
promisesOfGeoCoreGeoviewLayers.push(
geoCore.createLayersFromUUID(geoviewLayerConfig.geoviewLayerId, geoviewLayerConfig as GeoCoreLayerConfig)
);
} else {
// Add a resolved promise for a regular Geoview Layer Config
promisesOfGeoCoreGeoviewLayers.push(Promise.resolve([geoviewLayerConfig as TypeGeoviewLayerConfig]));
Expand Down
20 changes: 16 additions & 4 deletions packages/geoview-core/src/geo/layer/other/geocore.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { TypeDisplayLanguage } from '@config/types/map-schema-types';

import { UUIDmapConfigReader } from '@/core/utils/config/reader/uuid-config-reader';
import { Config } from '@/core/utils/config/config';
import { ConfigValidation } from '@/core/utils/config/config-validation';
import { GeochartEventProcessor } from '@/api/event-processors/event-processor-children/geochart-event-processor';
import { logger } from '@/core/utils/logger';
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';

import { TypeGeoviewLayerConfig } from '@/geo/map/map-schema-types';
import { GeoCoreLayerConfig, TypeGeoviewLayerConfig } from '@/geo/map/map-schema-types';
import { TypeJsonValue } from '@/core/types/global-types';
import { api } from '@/app';

Expand All @@ -32,11 +33,11 @@ export class GeoCore {

/**
* Gets GeoView layer configurations list from the UUIDs of the list of layer entry configurations.
*
* @param {GeoCoreLayerEntryConfig} geocoreLayerConfig the layer configuration
* @param {string} uuid the UUID of the layer
* @param {GeoCoreLayerConfig} layerConfig the layer configuration
* @returns {Promise<TypeGeoviewLayerConfig[]>} list of layer configurations to add to the map
*/
async createLayersFromUUID(uuid: string): Promise<TypeGeoviewLayerConfig[]> {
async createLayersFromUUID(uuid: string, layerConfig?: GeoCoreLayerConfig): Promise<TypeGeoviewLayerConfig[]> {
// Get the map config
const mapConfig = MapEventProcessor.getGeoViewMapConfig(this.#mapId);

Expand All @@ -47,6 +48,17 @@ export class GeoCore {
// Get the GV config from UUID and await
const response = await UUIDmapConfigReader.getGVConfigFromUUIDs(url, this.#displayLanguage, [uuid]);

// Use user supplied listOfLayerEntryConfig if provided
if (layerConfig?.listOfLayerEntryConfig || layerConfig?.initialSettings) {
const tempLayerConfig = { ...layerConfig } as unknown as TypeGeoviewLayerConfig;
tempLayerConfig.metadataAccessPath = response.layers[0].metadataAccessPath;
tempLayerConfig.geoviewLayerType = response.layers[0].geoviewLayerType;

const config = new Config(this.#displayLanguage);
const newLayerConfig = config.getValidMapConfig([tempLayerConfig]);
return newLayerConfig as TypeGeoviewLayerConfig[];
}

// Validate the generated Geoview Layer Config
ConfigValidation.validateListOfGeoviewLayerConfig(this.#displayLanguage, response.layers);

Expand Down
6 changes: 6 additions & 0 deletions packages/geoview-core/src/geo/map/map-schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ export type GeoCoreLayerConfig = {
// 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: string;

/** Initial settings to apply to the GeoCore layer at creation time. */
initialSettings?: TypeLayerInitialSettings;

/** The layer entries to use from the GeoCore layer. */
listOfLayerEntryConfig?: TypeLayerEntryConfig[];
};

/**
Expand Down
Loading