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

[Map-Viewer] Added Geocoding service for Multiple Providers #795

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

ronitjadhav
Copy link
Collaborator

Description

This pull request introduces a new service, geocoding.service.ts, in the libs/feature/map/src/lib directory. The purpose of this service is to facilitate the use of multiple geocoding providers.

The GeocodingService class in geocoding.service.ts uses an injection token, GEOCODING_PROVIDER, to inject a GeocodingProvider object. This object contains the ID of the geocoding provider and the options for that provider.

Changes:

  • Added geocoding.service.ts in libs/feature/map/src/lib
  • Updated geocoding.component.ts to use the new GeocodingService

Quality Assurance Checklist

  • Commit history is devoid of any merge commits and readable to facilitate reviews
  • If new logic ⚙️ is introduced: unit tests were added
  • If new user stories 🤏 are introduced: E2E tests were added
  • If new UI components 🕹️ are introduced: corresponding stories in Storybook were created
  • If breaking changes 🪚 are introduced: add the breaking change label
  • If bugs 🐞 are fixed: add the backport <release branch> label
  • The documentation website 📚 has received the love it deserves

Copy link
Contributor

github-actions bot commented Feb 12, 2024

Affected libs: feature-map, feature-dataviz, feature-record, feature-router, data-access-datafeeder, api-metadata-converter, api-repository, feature-catalog, feature-search, feature-auth, feature-editor, ui-search, util-data-fetcher, data-access-gn4, util-app-config, common-fixtures, util-shared, ui-elements, ui-catalog, ui-widgets, ui-inputs, ui-map, common-domain, ui-dataviz, util-i18n, ui-layout,
Affected apps: metadata-editor, datahub, demo, webcomponents, search, map-viewer, metadata-converter, datafeeder, data-platform,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

@coveralls
Copy link

coveralls commented Feb 12, 2024

Coverage Status

coverage: 83.944% (+1.7%) from 82.294%
when pulling 1c8006b on mv-geocoding-providers
into 0da0455 on main.

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

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

Thank you, clean implementation! I made a suggestion for typing the provider injectable token, feel free to address and merge.

Comment on lines 16 to 19
export interface GeocodingProvider {
id: 'geoadmin' | 'geonames' | 'data-gouv-fr'
options: GeoadminOptions | GeonamesOptions | DataGouvFrOptions
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if having something more like ['geoadmin', { ...options }] would be easier to handle.

So the type would be:

type GeoadminGeocodingProvider = [
  'geoadmin',
  GeoadminOptions
]
type GeonamesGeocodingProvider = [
  'geonames',
  GeonamesOptions
]
type DataGouvFrGeocodingProvider = [
  'data-gouv-fr',
  DataGouvFrOptions
]
export type GeocodingProvider = GeoadminGeocodingProvider | GeonamesGeocodingProvider | DataGouvFrGeocodingProvider

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, will implement this suggestion.

@ronitjadhav ronitjadhav merged commit e394770 into main Feb 14, 2024
9 checks passed
@ronitjadhav ronitjadhav deleted the mv-geocoding-providers branch February 14, 2024 13:32
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.

3 participants