geopandas / xyzservices

Source of XYZ tiles providers
https://xyzservices.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
169 stars 32 forks source link

Can not query `NASAGIBS.ASTER_GDEM_Greyscale_Shaded_Relief` #124

Closed benoit9126 closed 2 years ago

benoit9126 commented 2 years ago

Hi. Here is my problem. I try to use the query_name function to query the NASAGIBS.ASTER_GDEM_Greyscale_Shaded_Relief tile providers (note the _ in this name). Unfortunately, it is impossible.

from xyzservices import providers
providers.query_name('NASAGIBS.ASTER_GDEM_Greyscale_Shaded_Relief')

When you look at the implementation of query_name, you realize it seems impossible to query this tile provider.

xyz_flat_lower = {
    k.replace(".", "").lower(): v for k, v in self.flatten().items()
}
name_clean = name
remove = "., -_/"
for string in remove:
    name_clean = name_clean.replace(string, "")
name_clean = name_clean.lower()
if name_clean in xyz_flat_lower:
    return xyz_flat_lower[name_clean]

raise ValueError(f"No matching provider found for the query '{name}'.")

In the xyz_flat_lower dictionary, only dots are replaced in the tile provider name while for the provided name variable, _ are also replaced. Thus, the name_clean variable is 'nasagibsastergdemgreyscaleshadedrelief' while the key in the dictionary is 'nasagibs.aster_gdem_greyscale_shaded_relief' (with underscore).