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

Add suggested conversions between v1 and v2 basemap style enumerations #178

Open
gowin20 opened this issue May 22, 2023 · 0 comments
Open
Assignees

Comments

@gowin20
Copy link
Contributor

gowin20 commented May 22, 2023

Describe the problem

The new Basemap Styles Service v2 uses different basemap enumerations than version 1, and it is confusing. I think that users who are acustomed to v1 enumerations (e.g. ArcGIS:Imagery:Base) will be confused when their enumeration does not work with the new service (which expects arcgis/imagery/base to load the equivalent layer).

Describe the proposed solution

I would like to include a suggestion in the error message that displays when a v2 basemap is created using a v1 enumeration, and vice versa. The error message would read like the following:

Error: 'ArcGIS:Streets' is a v1 basemap style enumeration. Did you mean 'arcgis/streets'?

I have already written code that generates suggestions for the v2 service:

    const firstBreak = sourceAndStyle.indexOf(':');
    let secondBreak = sourceAndStyle.indexOf(':', firstBreak + 1);

    const source = sourceAndStyle.substring(0, firstBreak);
    const layer = (secondBreak !== -1) ? sourceAndStyle.substring(secondBreak + 1, sourceAndStyle.length) : null;

    if (secondBreak === -1) secondBreak = sourceAndStyle.length;
    const style = sourceAndStyle.substring(firstBreak + 1, secondBreak);

    const suggestion = source.toLowerCase() + '/' + style.toLowerCase() + (layer !== null ? '/' + layer.toLowerCase() : '');

However, providing a suggestion like this only makes sense if the original enumeration was valid. To check this, we would need to keep a static list of all valid basemap enumerations. This would obviously come with some overhead, so I'd like some feedback on whether or not this is reasonable

Alternatives considered

A self-describing endpoint is in the works for the v2 service that should return a json list of every supported basemap enumeration. It will not release for a while, but once it does we could deprecate our static list of enums in favor of this new endpoint. Luke Smallwood knows more.

Additional Information

No response

@gowin20 gowin20 self-assigned this May 26, 2023
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

No branches or pull requests

1 participant