It would be really useful to make that information available directly in a JSON file that could be used from other projects. For example, xyzservices extracts that information from leaflet-provider.js to make the same information available to Python. Xyzservices has some adoption in the scientific Python ecosystem (Geopandas, ipyleaflet, contextily, leafmap, bokeh, and others) - meaning that this project has in fact a lot of indirect adoption...
This separate JSON file could even be published independently of the leaflet-providers JS source, which would probably make it valuable for other users.
Hi @brunob, we already have that magic in
xyzservices. We scrape your JS to get that JSON but the result is slightly adapted to work within our use case. But the Python code for that is here https://github.com/geopandas/xyzservices/blob/main/provider_sources/_parse_leaflet_providers.py and a resulting JSON here https://github.com/geopandas/xyzservices/blob/main/provider_sources/leaflet-providers-parsed.json.
@brunob Yeah, we do that within this GHA https://github.com/geopandas/xyzservices/blob/main/.github/workflows/update_providers.yaml using this makefile
Yes, it would be nice to maintain the list in a machine readable format, and generate
leaflet-providers.js from it + a template. I am not sure about JSON though. In the current definitions, we use some comments: (1 2 3 4), which I think is a valuable capability not possible in classic json.
Other options would be JSONC, but that would require consumers of the file to use non-standard parsers too.
|Issue Title||Created Date||Updated Date|