Closed ahuang11 closed 1 year ago
Maybe think about if we should move this information into another place than the front page.
Yeah I was uncertain on whether I should put this on front page or one of the gallery items because of
1. Create a new cartopy environment (or use an existing one)::
conda create -n cartopy_env python=3.10
2. Install the required packages::
conda install -c conda-forge geoviews cartopy cartopy_offlinedata
I think this should have a new page. I would build it up like a how-to, e.g, How to use tiles offline
and put it in the user guide for now.
I will look into this more tomorrow, but I think cache_tiles could be added directly to geoviews.util.
Yeah that sounds like a good idea.
I'm not exactly sure how WMTS
works under the hood; does it use cartopy or bokeh to fetch the tiles underneath?
class WMTS(_GeoFeature):
"""
The WMTS Element represents a Web Map Tile Service specified as a
URL containing {x}, {y}, and {z} templating variables, e.g.:
https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png
"""
crs = param.ClassSelector(default=ccrs.GOOGLE_MERCATOR, class_=ccrs.CRS, doc="""
Cartopy coordinate-reference-system specifying the
coordinate system of the data. Inferred automatically
when _Element wraps cartopy Feature object.""")
group = param.String(default='WMTS')
layer = param.String(doc="The layer on the tile service")
def __init__(self, data, kdims=None, vdims=None, **params):
if ((MercatorTileSource and isinstance(data, MercatorTileSource)) or
(GoogleTiles and isinstance(data, GoogleTiles))):
data = data.url
elif WebMapTileService and isinstance(data, WebMapTileService):
pass
elif not isinstance(data, str):
raise TypeError(
f'{type(self).__name__} data should be a tile service '
f'URL not a {type(data).__name__} type.'
)
super().__init__(data, kdims=kdims, vdims=vdims, **params)
def __call__(self, *args, **kwargs):
return self.opts(*args, **kwargs)
But yeah, maybe this caching thing could be used to fix https://github.com/holoviz/geoviews/issues/650
Any other thoughts on this PR?
In the future, we will need to convert this to real markdown files, as we have done with Panel.
I just tried, and this is already possible. So the notebooks can be converted to Markdown files.
How do I convert the notebooks to Markdown files?
I just copied the content to a new markdown file.
Thanks for reviewing!
Directly based on https://discourse.pangeo.io/t/geoviews-offline/3487/2 Partially based on https://discourse.holoviz.org/t/using-geoviews-tile-sources-offline/4859/5
Planning to do tiles soon.