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

[Fixes #976] Fix missing required accessToken for MapBox background when adding a map to a geostory #977

Closed
wants to merge 3 commits into from

Conversation

mattiagiupponi
Copy link

Fix missing required accessToken for MapBox background when adding a map to a geostory

Copy link
Collaborator

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

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

before to proceed we need to verify if we can fix this also inside the MapStore2 core. I'm going to verify it and provide a feedback

Copy link

@giohappy giohappy left a comment

Choose a reason for hiding this comment

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

@allyoucanmap as agreed let's check if this improvement can be done upstream in MapStore2, rather then inside the GeoNode client.

@allyoucanmap
Copy link
Collaborator

@giohappy the improvement can be done in the MapStore2 upstream project and it could follow the same workflow that we use for bing maps api keys.

In MapStore we need to improve the setApiKeys function here by adding the case for mapbox backgrounds

export const setApiKeys = function(layer) {
    if (layer.type === 'bing') {
        layer.apiKey = defaultConfig.bingApiKey;
    }
    if (layer.type === 'mapquest') {
        layer.apiKey = defaultConfig.mapquestApiKey;
    }
    if (layer.type === 'tileprovider' && ['MapBoxStyle', 'MapBox'].includes(layer.provider)) {
        // include an empty string if missing to avoid errors in the layer url template
        layer.accessToken = defaultConfig.mapboxAccessToken || '';
    }
    return layer;
};

then we can pass the access token from the _geonde_config.html in the geonode_mapstore_client.html

bingApiKey: '{% bing_api_key %}',
mapboxAccessToken: '{{ MAPBOX_ACCESS_TOKEN }}',

the fix should be quick mapstore side but then we will need to backport and update the submodule that could take some time

@giohappy
Copy link

the fix should be quick mapstore side but then we will need to backport and update the submodule that could take some time

Can we have an ETA for this @allyoucanmap? If it's mroe then 1 week from now we will have to make the fix inside geonode client for the moment.

@allyoucanmap
Copy link
Collaborator

@giohappy just created a PR on MapStore2 master geosolutions-it/MapStore2#8246

I'll let you know when the backport is ready on the stable branch

@allyoucanmap
Copy link
Collaborator

@giohappy I'm closing this in favor of #1014

@afabiani afabiani deleted the ISSUE_976 branch July 7, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants