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 geoviews offline features and tiles docs #649

Merged
merged 7 commits into from
Jul 6, 2023
Merged

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Jun 7, 2023

doc/index.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved
@hoxbro
Copy link
Member

hoxbro commented Jun 8, 2023

Maybe think about if we should move this information into another place than the front page.

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Jun 8, 2023

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

@hoxbro
Copy link
Member

hoxbro commented Jun 8, 2023

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.

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Jun 8, 2023

image image

@ahuang11 ahuang11 marked this pull request as ready for review June 8, 2023 18:09
@ahuang11 ahuang11 requested a review from hoxbro June 8, 2023 18:09
@hoxbro
Copy link
Member

hoxbro commented Jun 8, 2023

I will look into this more tomorrow, but I think cache_tiles could be added directly to geoviews.util.

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Jun 8, 2023

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)

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Jun 8, 2023

But yeah, maybe this caching thing could be used to fix
#650

@ahuang11 ahuang11 changed the title Add geoviews offline docs Add geoviews offline features and tiles docs Jun 12, 2023
@ahuang11
Copy link
Collaborator Author

Any other thoughts on this PR?

Copy link
Member

@hoxbro hoxbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additions look fine.

Maybe have some reference to external resources if users want to know more. E.g., one to cartopy_offline and one to Bokeh with resources INLINE.

In the future, we will need to convert this to real markdown files, as we have done with Panel.

@hoxbro
Copy link
Member

hoxbro commented Jun 18, 2023

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.

@ahuang11
Copy link
Collaborator Author

How do I convert the notebooks to Markdown files?

@hoxbro
Copy link
Member

hoxbro commented Jun 25, 2023

I just copied the content to a new markdown file.

@ahuang11
Copy link
Collaborator Author

ahuang11 commented Jul 6, 2023

Thanks for reviewing!

@ahuang11 ahuang11 merged commit 118568e into main Jul 6, 2023
@ahuang11 ahuang11 deleted the geoviews_offline branch July 6, 2023 11:43
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

Successfully merging this pull request may close these issues.

2 participants