Esri / Esri/esri-leaflet-vector
Add suggested conversions between v1 and v2 basemap style enumerations
- Dominant language
- JavaScript
- Stars
- 72
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
### 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:
```js
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_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.