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

Conversation

jolevesq
Copy link
Member

@jolevesq jolevesq commented Feb 26, 2025

Closes #2606, #2690, #2755, #2695

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

2755

  • Message display layer now in proper language and reset notifications on language change
  • Replace layer id by name if available
  • Start a section in translation to better support error logging. Work will continue as part of another issue....

2606

  • The zoom problem comes from initial extent to restrict pan. In web mercator, to see the whole Canada extent needs to contain the whole world almost. I have added a sample were we override but I do not think we should have default as wide
  • Added a button in nav bar to switch projection (configurable)

2690

  • Fix the PostalCode AAA AAA vs AAAAAA issue
  • Rebuild the geolocator with hooks, add error management different then no result found
  • NOTE for geonames to do lat/long query on FSA, I asked Geo.ca team to do it within the wrapper

2695

  • Add the new Legend Icon

Other

  • Max zoom level for zoom in set to 20 (around 10 meters) instead of 50 (millimeters)
  • Update guide with new projection and basemap navbar buttons
  • Repair zoom on layer ids trigger before the even on loaded attached

Fixes #2606, #2690, #2755, #2695

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Hosted February 26, 1pm

https://jolevesq.github.io/geoview/demos-navigator.html?config=./configs/navigator/04-a-max-extent-override.json

  • New sample for custom max extent and new projection button

https://jolevesq.github.io/geoview/add-layers.html

  • New legend icon for app bar and footer bar
  • a: cgpv.api.maps['mapWM'].setLanguage('fr')
  • b: Add a wrong uuid to see message in proper language (21b821cf-0f1c-40ee-8925-eab12d3576UU)
  • c: cgpv.api.maps['mapWM'].setLanguage('en') - Notification are removed

https://jolevesq.github.io/geoview/demos-navigator.html?config=./configs/navigator/05-zoom-layer.json

  • Layer extent zoom is working
  • Try geolocator FSA vs PostalCode - space/no space

On any maps

  • Try to zoom in to millimeters, it is not possible anymore
  • Look at guide nav bar were 2 new button were added

Checklist:

  • I have build (rush build) and deploy (rush host) my PR
  • I have connected the issues(s) to this PR
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have created new issue(s) related to the outcome of this PR is needed
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This change is Reviewable

Copy link
Member

@Alex-NRCan Alex-NRCan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 30 of 38 files at r1, 7 of 8 files at r2, all commit messages.
Reviewable status: 37 of 38 files reviewed, 9 unresolved discussions (waiting on @DamonU2 and @MatthewMuehlhauserNRCan)


packages/geoview-core/src/api/config/types/classes/map-feature-config.ts line 240 at r2 (raw file):

    const minZoom = this.map.viewSettings.minZoom!;
    this.map.viewSettings.minZoom =
      !Number.isNaN(minZoom) && minZoom >= 0 && minZoom <= 20 ? minZoom : CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.minZoom;

Should the 2x '20' be in a default constant instead of hardcoded?


packages/geoview-core/src/core/components/geolocator/geolocator.tsx line 13 at r2 (raw file):

// import { handleEscapeKey } from '@/core/utils/utilities';
import { logger } from '@/core/utils/logger';
import { useGeolocator } from './hooks/use-geolocator';

Change to @/ imports?


packages/geoview-core/src/core/components/geolocator/geolocator.tsx line 27 at r2 (raw file):

const MIN_SEARCH_LENGTH = 3;
const DEBOUNCE_DELAY = 500;git add

Remove 'git add' this likely doesn't build :)


packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx line 60 at r2 (raw file):

  const navBarComponents = useUINavbarComponents();

  // State

Minor: Invert comments State and Ref


packages/geoview-core/src/geo/layer/basemap/basemap.ts line 250 at r2 (raw file):

    const resolutions: number[] = [];
    let minZoom = 0;
    let maxZoom = 23;

Should those be in a default constant instead of hardcoded?


packages/geoview-core/src/geo/layer/basemap/basemap.ts line 387 at r2 (raw file):

    let defaultResolutions: number[] | undefined;
    let minZoom = 0;
    let maxZoom = 23;

Should those be in a default constant instead of hardcoded?


packages/geoview-core/src/core/components/geolocator/hooks/use-geolocator.ts line 92 at r2 (raw file):

  const fetchGeolocations = useCallback(
    async (searchTerm: string): Promise<void> => {

Missing the explicit 'Promise' to be returned.
Add a return Promise.resolve() at the end?


packages/geoview-core/src/core/components/geolocator/hooks/use-geolocator.ts line 153 at r2 (raw file):

    // Only listen to change in language to request new value with updated language
    // eslint-disable-next-line react-hooks/exhaustive-deps

Not sure, but not having getGeolocationsin the dependency array means that when the geolocatorServiceURL changes, the useEffect will still execute on an 'disconnected' version of getGeolocations which would call a 'disconnected' service url. Right?


packages/geoview-core/src/geo/map/map-viewer.ts line 268 at r2 (raw file):

        extent: extentProjected || undefined,
        minZoom: mapViewSettings.minZoom || 0,
        maxZoom: mapViewSettings.maxZoom || 23,

Should those be in a default constant instead of hardcoded?

Copy link
Member

@DamonU2 DamonU2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 30 of 38 files at r1, 7 of 8 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @jolevesq and @MatthewMuehlhauserNRCan)


packages/geoview-core/src/ui/icons/index.ts line 52 at r3 (raw file):

  Highlight as HighlightIcon,
  Home as HomeIcon,
  HubOutlined as HubOutlinedIcon,

Remove old legend icon

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 37 of 38 files at r1, 5 of 8 files at r2, all commit messages.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @Alex-NRCan and @MatthewMuehlhauserNRCan)


packages/geoview-core/src/api/config/types/classes/map-feature-config.ts line 240 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Should the 2x '20' be in a default constant instead of hardcoded?

Done


packages/geoview-core/src/core/components/geolocator/geolocator.tsx line 13 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Change to @/ imports?

Done


packages/geoview-core/src/core/components/geolocator/geolocator.tsx line 27 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Remove 'git add' this likely doesn't build :)

Done.


packages/geoview-core/src/core/components/geolocator/hooks/use-geolocator.ts line 92 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Missing the explicit 'Promise' to be returned.
Add a return Promise.resolve() at the end?

Done.


packages/geoview-core/src/core/components/geolocator/hooks/use-geolocator.ts line 153 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Not sure, but not having getGeolocationsin the dependency array means that when the geolocatorServiceURL changes, the useEffect will still execute on an 'disconnected' version of getGeolocations which would call a 'disconnected' service url. Right?

Done.


packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx line 60 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Minor: Invert comments State and Ref

Done


packages/geoview-core/src/geo/layer/basemap/basemap.ts line 250 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Should those be in a default constant instead of hardcoded?

This is part of default basemap creation. I would keep it like this.


packages/geoview-core/src/geo/layer/basemap/basemap.ts line 387 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Should those be in a default constant instead of hardcoded?

This is part of default basemap creation. I would keep it like this.


packages/geoview-core/src/geo/map/map-viewer.ts line 268 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Should those be in a default constant instead of hardcoded?

Done

Copy link
Member

@Alex-NRCan Alex-NRCan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 8 files at r2, 1 of 1 files at r3, 8 of 8 files at r4.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @jolevesq and @MatthewMuehlhauserNRCan)

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @DamonU2 and @MatthewMuehlhauserNRCan)


packages/geoview-core/src/ui/icons/index.ts line 52 at r3 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

Remove old legend icon

Done.

@jolevesq jolevesq merged commit 1371aac into Canadian-Geospatial-Platform:develop Feb 26, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] 1 - Other type of zoom to layer issue [OSDP-1801]
3 participants