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

fix(ui-core): LEgend icon, layerId zoom, guide, minZooom, Geolocator and add a demo for max extent #2766

Merged
merged 8 commits into from
Feb 26, 2025
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
Expand Up @@ -2,9 +2,6 @@
"map": {
"interaction": "dynamic",
"viewSettings": {
"initialView": {
"extent": [-90, 45, -65, 70]
},
"projection": 3857
},
"basemapOptions": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"map": {
"interaction": "dynamic",
"viewSettings": {
"maxExtent": [-180, -50, 180, 89],
"projection": 3857
},
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": true
},
"listOfGeoviewLayerConfig": [
{
"geoviewLayerId": "472ef86d-7f7c-423b-a7d2-b6f92b79fd6d",
"geoviewLayerType": "geoCore"
}
]
},
"components": [
"overview-map",
"north-arrow"
],
"navBar": ["home", "projection"],
"footerBar": {
"tabs": {
"core": [
"legend",
"layers",
"details",
"data-table"
]
}
},
"corePackages": [],
"theme": "geo.ca"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/geoview-core/public/locales/en/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The following navigation controls can be found in the bottom right corner of the
| <img src="{{assetsURL}}/img/guide/navigation/minus.svg" width="30"/> | Zoom out | Zoom out one level on the map to see less detailed content - bound to Minus key (-) |
| <img src="{{assetsURL}}/img/guide/navigation/geolocation.svg" width="30"/> | Geolocation | Zoom and pan to your current geographical location |
| <img src="{{assetsURL}}/img/guide/navigation/home.svg" width="30"/> | Initial extent | Zoom and pan map such that initial extent is visible |
| <img src="{{assetsURL}}/img/guide/navigation/basemapSelect.svg" width="30"/> | Change Basemap | Change the basemap
| <img src="{{assetsURL}}/img/guide/navigation/projection.svg" width="30"/> | Change Projection | Change the map projection between Web Mercator and LCC

You can also pan the map by using your left, right, up and down arrow keys, or by click-holding on the map and dragging. Using the mouse scroll wheel while hovering over the map will zoom the map in/out.

Expand Down
38 changes: 29 additions & 9 deletions packages/geoview-core/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"zoomOut": "Zoom out",
"coordinates": "Toggle coordinates format",
"scale": "Toggle between scale and resolution",
"location": "Zoom to my location"
"location": "Zoom to my location",
"projection": "Change map projection"
},
"basemaps": {
"select": "Select a basemap",
Expand Down Expand Up @@ -60,7 +61,7 @@
"appbar": {
"export": "Download map",
"notifications": "Notification",
"no_notifications_available": "No notifications available",
"noNotificationsAvailable": "No notifications available",
"layers": "Layers",
"share": "Share",
"version": "About GeoView",
Expand Down Expand Up @@ -106,7 +107,7 @@
"layerSelect": "Select layer(s)",
"errorEmpty": "cannot be empty",
"errorNone": "No file or source added",
"errorFile": "Only geoJSON, CSV and GeoPackage files can be used",
"errorFile": "Only geoJSON and CSV files can be used",
"errorServer": "source is not valid",
"errorNotLoaded": "An error occured when loading the layer",
"errorProj": "does not support current map projection",
Expand Down Expand Up @@ -160,15 +161,15 @@
},
"validation": {
"layer": {
"loadfailed": "Layer [__param__] failed to load on map __param__.",
"notfound": "The sublayer __param__ of the layer __param__ does not exist on the server",
"createtwice": "Can not execute the createGeoViewRasterLayers method twice for the layer __param__ on map __param__",
"usedtwice": "Duplicate use of layer identifier [__param__] on map __param__",
"loadfailed": "Layer __param__ failed to load on map.",
"notfound": "The sublayer __param__ of the layer __param__ does not exist on the server",
"createtwice": "Can not execute the createGeoViewRasterLayers method twice for the layer __param__ on map",
"usedtwice": "Duplicate use of layer identifier __param__ on map",
"multipleUUID": "GeoCore layers may only have one GeoCore id per layer"
},
"schema": {
"notFound": "A schema error was found, check the console to see what is wrong.",
"wrongPath": "Cannot find schema ([__param__])"
"wrongPath": "Cannot find schema (__param__)"
},
"changeDisplayLanguageLayers": "Layers can not be relaoded because the configuration does not support this language",
"changeDisplayLanguage": "Only 'en' and 'fr' are supported",
Expand All @@ -187,7 +188,7 @@
"geolocator": {
"title": "Geolocator",
"search": "Search",
"errorMessage": "No matches found for",
"noResult": "No matches found for",
"province": "Province",
"category": "Category",
"clearFilters": "Clear filters",
Expand Down Expand Up @@ -227,5 +228,24 @@
"footerBar": {
"resizeTooltip": "Resize",
"noTab": "No tab"
},
"error": {
"metadata": {
"unableRead": "Unable to read metadata",
"empty": "Value returned is empty",
"capability": "Value returned doesn't contain Capability, Layer or is empty"
},
"layer": {
"createGroup": "Unable to create group layer",
"emptyGroup": "Empty layer group",
"esriId": "ESRI layerId must be a number",
"esriIdNotFound": "ESRI layerId not found"
},
"geocore": {
"noLayer": "No layers returned by GeoCore service"
},
"geolocator": {
"noService": "Geolocator service not available"
}
}
}
2 changes: 2 additions & 0 deletions packages/geoview-core/public/locales/fr/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ On trouve les commandes suivantes dans le coin inférieur droit de la carte&nbsp
| <img src="{{assetsURL}}/img/guide/navigation/minus.svg" width="30"/>| Zoom arrière| Permet de faire un zoom arrière d’un niveau à la fois pour voir le contenu moins en détail; fonctionne aussi avec la touche de soustraction du clavier (-).|
| <img src="{{assetsURL}}/img/guide/navigation/geolocation.svg" width="30"/>| Géolocalisation| Permet de zoomer et de déplacer la carte sur votre position géographique.|
| <img src="{{assetsURL}}/img/guide/navigation/home.svg" width="30"/>| Vue initiale| Permet de zoomer et de déplacer la carte pour retourner à la vue initiale.|
| <img src="{{assetsURL}}/img/guide/navigation/basemapSelect.svg" width="30"/> | Changer la carte de base | Changer la carte de base
| <img src="{{assetsURL}}/img/guide/navigation/projection.svg" width="30"/> | Changer la projection | Changer la projection de la carte entre Web Mercator et LCC

Vous pouvez aussi déplacer la carte avec les touches fléchées vers la gauche, la droite, le haut et le bas, ou en cliquant sur la carte, puis en la glissant. Lorsque le pointeur est sur la carte, la molette de la souris permet de faire un zoom avant et arrière.

Expand Down
42 changes: 31 additions & 11 deletions packages/geoview-core/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"zoomOut": "Zoom arrière",
"coordinates": "Basculer le format des coordonnées",
"scale": "Basculer entre l'échelle et la résolution",
"location": "Zoom sur ma position"
"location": "Zoom sur ma position",
"projection": "Changer la projection de la carte"
},
"basemaps": {
"select": "Choisir une carte de base",
Expand Down Expand Up @@ -60,7 +61,7 @@
"appbar": {
"export": "Télécharger la carte",
"notifications": "Notification",
"no_notifications_available": "Aucune notification disponible",
"noNotificationsAvailable": "Aucune notification disponible",
"layers": "Couches",
"share": "Partager",
"version": "À propos de GéoView",
Expand Down Expand Up @@ -106,11 +107,11 @@
"layerSelect": "Sélectionner couche(s)",
"errorEmpty": "ne peut être vide",
"errorNone": "Pas de fichier ou de source ajouté",
"errorFile": "Seuls les fichiers geoJSON, CSV et GeoPackage peuvent être utilisés",
"errorFile": "Seuls les fichiers geoJSON et CSV peuvent être utilisés",
"errorServer": "source n'est pas valide",
"errorNotLoaded": "Une erreur s'est produite lors du chargement de la couche",
"errorProj": "ne prend pas en charge la projection cartographique actuelle",
"errorImageLoad": "Erreur de chargement de l'image source pour le couche: __param__ au niveau de zoom __param__",
"errorImageLoad": "Erreur de chargement de l'image source pour la couche: __param__ au niveau de zoom __param__",
"only": "seulement",
"opacity": "Opacité",
"opacityMax": "Maximum du parent",
Expand All @@ -120,9 +121,9 @@
"toggleAllVisibility": "Basculer toute les visibilités",
"toggleCollapse": "Basculer la fermeture",
"querying": "Requête en cours",
"layerAdded": "Couche __param__ ajoutée",
"layerAdded": "Couche __param__ ajoutée",
"layerAddedAndLoading": "Couche __param__ ajoutée et en chargement",
"layerAddedWithError": "Couche __param__ en erreur",
"layerAddedWithError": "Couche __param__ en erreur",
"instructionsNoLayersTitle": "Aucune couche visible",
"instructionsNoLayersBody": "Ajoutez des couches visibles sur la carte."
},
Expand Down Expand Up @@ -160,15 +161,15 @@
},
"validation": {
"layer": {
"loadfailed": "Le chargement de la couche [__param__] a échoué sur la carte __param__.",
"loadfailed": "Le chargement de la couche __param__ a échoué sur la carte.",
"notfound": "La sous couche __param__ de la couche __param__ n'existe pas sur le sereur",
"createtwice": "On ne peut exécuter deux fois la méthode createGeoViewRasterLayers pour la couche __param__ sur la carte __param__",
"usedtwice": "Utilisation en double de l'identifiant de couche [__param__] sur la carte __param__",
"createtwice": "On ne peut exécuter deux fois la méthode createGeoViewRasterLayers pour la couche __param__ sur la carte",
"usedtwice": "Utilisation en double de l'identifiant de couche __param__ sur la carte",
"multipleUUID": "Les couches GeoCore ne peuvent avoir qu'un seul identifiant par couche."
},
"schema": {
"notFound": "Une erreur de schéma a été trouvée, vérifiez la console pour voir ce qui ne va pas.",
"wrongPath": "Impossible de trouver le schéma ([__param__])"
"wrongPath": "Impossible de trouver le schéma (__param__)"
},
"changeDisplayLanguageLayers": "Les couches ne peuvent être chargée(s) de nouveau car la configuration ne supporte pas ce langage",
"changeDisplayLanguage": "Seulement 'en' et 'fr' sont supporées",
Expand All @@ -187,7 +188,7 @@
"geolocator": {
"title": "Géolocalisation",
"search": "Texte à rechercher",
"errorMessage": "Aucun résultat correspondant à",
"noResult": "Aucun résultat correspondant à",
"province": "Province",
"category": "Catégorie",
"clearFilters": "Effacer les filtres",
Expand Down Expand Up @@ -226,5 +227,24 @@
"footerBar": {
"resizeTooltip": "Redimensionner",
"noTab": "Pas d'onglet"
},
"error": {
"metadata": {
"unableRead": "Impossible de lire les métadonnées",
"empty": "La valeur renvoyée est vide",
"capability": "La valeur renvoyée ne contient pas de Capability, de Layer ou est vide"
},
"layer": {
"createGroup": "Impossible de créer une couche de groupe",
"emptyGroup": "Groupe de couches vide",
"esriId": "Le layerId ESRI doit être un nombre",
"esriIdNotFound": "Le layerId ESRI introuvable"
},
"geocore": {
"noLayer": "Aucune couche renvoyée par le service GeoCore"
},
"geolocator": {
"noService": "Service de géolocalisation non disponible"
}
}
}
3 changes: 2 additions & 1 deletion packages/geoview-core/public/templates/add-layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h4 id="HUC1">1. Default Configuration</h4>
},
'corePackages': [],
'externalPackages': [],
'navBar': ['home', 'basemap-select', 'projection', 'fullscreen'],
'appBar': {
'tabs': {
'core': ['legend', 'layers', 'details', 'data-table', 'geochart']
Expand Down Expand Up @@ -168,7 +169,7 @@ <h4>Add Layer Examples</h4>
</ul>
</div>
<div>
GeoPackage Layer
GeoPackage Layer - DEPRECATED
<ul>
<li class="source-link">https://canadian-geospatial-platform.github.io/geoview/public/datasets/geopackages/rivers.gpkg</li>
</ul>
Expand Down
3 changes: 2 additions & 1 deletion packages/geoview-core/public/templates/demos-navigator.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ <h1><strong>Configurations Navigator</strong></h1>
</option>
<option value="./configs/navigator/03-projection-WM.json">Basemap WM</option>
<option value="./configs/navigator/04-restrict-zoom.json">Restricted zoom [4, 8]</option>
<option value="./configs/navigator/04-a-max-extent-override.json">Unrestricted zoom map extent for WM zoom north</option>
<option value="./configs/navigator/05-zoom-layer.json">Zoom on layer extent</option>
<option value="./configs/navigator/05-layer-zoom-levels.json">Layer Max and Min Zoom Settings</option>
<option value="./configs/navigator/06-basic-footer.json">Basic map with footer</option>
Expand Down Expand Up @@ -151,7 +152,7 @@ <h1><strong>Configurations Navigator</strong></h1>
<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>
<option value="./configs/navigator/29-geopackages.json">Layer GeoView - GeoPackages DEPRECATED-</option>
</select>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/geoview-core/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1739,13 +1739,13 @@
"type": "integer",
"description": "The minimum zoom level used to determine the resolution constraint. If not set, will use default from basemap.",
"minimum": 0,
"maximum": 50
"maximum": 20
},
"maxZoom": {
"type": "integer",
"description": "The maximum zoom level used to determine the resolution constraint. If not set, will use default from basemap.",
"minimum": 0,
"maximum": 50
"maximum": 20
},
"projection": {
"$ref": "#/definitions/TypeValidMapProjectionCodes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
ACCEPTED_SCHEMA_VERSIONS,
VALID_PROJECTION_CODES,
CV_MAP_CENTER,
CV_VALID_ZOOM_LEVELS,
} from '@config/types/config-constants';
import { isvalidComparedToInputSchema, isvalidComparedToInternalSchema } from '@config/utils';
import {
Expand Down Expand Up @@ -237,11 +238,15 @@ export class MapFeatureConfig {
: CV_DEFAULT_MAP_FEATURE_CONFIG.schemaVersionUsed!;
const minZoom = this.map.viewSettings.minZoom!;
this.map.viewSettings.minZoom =
!Number.isNaN(minZoom) && minZoom >= 0 && minZoom <= 50 ? minZoom : CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.minZoom;
!Number.isNaN(minZoom) && minZoom >= CV_VALID_ZOOM_LEVELS[0] && minZoom <= CV_VALID_ZOOM_LEVELS[1]
? minZoom
: CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.minZoom;

const maxZoom = this.map.viewSettings.maxZoom!;
this.map.viewSettings.maxZoom =
!Number.isNaN(maxZoom) && maxZoom >= 0 && maxZoom <= 50 ? maxZoom : CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.maxZoom;
!Number.isNaN(maxZoom) && maxZoom >= CV_VALID_ZOOM_LEVELS[0] && maxZoom <= CV_VALID_ZOOM_LEVELS[1]
? maxZoom
: CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.maxZoom;

if (this.map.viewSettings.initialView!.zoomAndCenter) this.#validateMaxExtent();
this.#logModifs(providedMapConfig);
Expand Down
11 changes: 7 additions & 4 deletions packages/geoview-core/src/api/config/types/config-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,17 @@ export const CV_VALID_MAP_CENTER: Record<TypeValidMapProjectionCodes, Record<str

// extents and center for each projection
export const CV_MAP_EXTENTS: Record<TypeValidMapProjectionCodes, number[]> = {
3857: [-170, 35, -20, 84],
3857: [-180, 0, 80, 84],
3978: [-135, 25, -50, 89],
};
export const CV_MAP_CENTER: Record<TypeValidMapProjectionCodes, number[]> = {
3857: [-90, 55],
3857: [-90, 67],
3978: [-90, 60],
};

// valid zoom levels from each projection
export const CV_VALID_ZOOM_LEVELS: number[] = [0, 20];

/**
* Definition of the MapFeatureConfig default values. All the default values that applies to the map feature configuration are
* defined here.
Expand All @@ -170,8 +173,8 @@ export const CV_DEFAULT_MAP_FEATURE_CONFIG = Cast<MapFeatureConfig>({
},
enableRotation: true,
rotation: 0,
minZoom: 0,
maxZoom: 50,
minZoom: CV_VALID_ZOOM_LEVELS[0],
maxZoom: CV_VALID_ZOOM_LEVELS[1],
maxExtent: CV_MAP_EXTENTS[3978],
projection: 3978,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,13 @@
"description": "The minimum view zoom level (exclusive) above which this layer will be visible.",
"type": "integer",
"minimum": 0,
"maximum": 50
"maximum": 20
},
"maxZoom": {
"description": "The maximum view zoom level (inclusive) above which this layer will be visible.",
"type": "integer",
"minimum": 0,
"maximum": 50
"maximum": 20
},
"className": {
"description": "A CSS class name to set to the layer element.",
Expand Down
Loading
Loading