-
Notifications
You must be signed in to change notification settings - Fork 32
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
Conversation
Affected libs:
|
2b08b05
to
ff5cfab
Compare
ff5cfab
to
3652b8f
Compare
There was a problem hiding this 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.
export interface GeocodingProvider { | ||
id: 'geoadmin' | 'geonames' | 'data-gouv-fr' | ||
options: GeoadminOptions | GeonamesOptions | DataGouvFrOptions | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Description
This pull request introduces a new service,
geocoding.service.ts
, in thelibs/feature/map/src/lib
directory. The purpose of this service is to facilitate the use of multiple geocoding providers.The
GeocodingService
class ingeocoding.service.ts
uses an injection token,GEOCODING_PROVIDER
, to inject aGeocodingProvider
object. This object contains the ID of the geocoding provider and the options for that provider.Changes:
geocoding.service.ts
inlibs/feature/map/src/lib
geocoding.component.ts
to use the newGeocodingService
Quality Assurance Checklist
breaking change
labelbackport <release branch>
label