mirror of
https://github.com/maputnik/editor.git
synced 2026-03-23 02:30:01 +00:00
Add LocationIQ as supported map provider (#1293)
- Add LocationIQ access token field to settings and export modals - Include LocationIQ Streets style in gallery - Support automatic token replacement for LocationIQ URLs - Add LocationIQ tileset configuration - Include translations for all supported languages ## Launch Checklist - [x] Briefly describe the changes in this PR. - [x] Write tests for all new functionality. - [x] Add an entry to `CHANGELOG.md` under the `## main` section.
This commit is contained in:
@@ -20,6 +20,12 @@ const spec = (t: TFunction) => ({
|
||||
docUrl: "https://docs.stadiamaps.com/authentication/",
|
||||
docUrlLinkText: t("Learn More")
|
||||
},
|
||||
locationiq_access_token: {
|
||||
label: t("LocationIQ Access Token"),
|
||||
doc: t("Public access token for LocationIQ services."),
|
||||
docUrl: "https://docs.locationiq.com/docs/maps",
|
||||
docUrlLinkText: t("Learn More")
|
||||
},
|
||||
style_renderer: {
|
||||
label: t("Style Renderer"),
|
||||
doc: t("Choose the default Maputnik renderer for this style.")
|
||||
|
||||
@@ -79,6 +79,9 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri
|
||||
// so we need to check the source URL.
|
||||
authSourceName = "stadia"
|
||||
}
|
||||
else if (("url" in source) && source.url?.match(/\.locationiq\.com/)) {
|
||||
authSourceName = "locationiq"
|
||||
}
|
||||
|
||||
const accessToken = getAccessToken(authSourceName, mapStyle, opts)
|
||||
|
||||
@@ -138,6 +141,7 @@ function stripAccessTokens(mapStyle: StyleSpecification) {
|
||||
delete changedMetadata['maputnik:openmaptiles_access_token'];
|
||||
delete changedMetadata['maputnik:thunderforest_access_token'];
|
||||
delete changedMetadata['maputnik:stadia_access_token'];
|
||||
delete changedMetadata['maputnik:locationiq_access_token'];
|
||||
return {
|
||||
...mapStyle,
|
||||
metadata: changedMetadata
|
||||
|
||||
Reference in New Issue
Block a user