holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
599 stars 77 forks source link

Confusion on geoview's WMTS support #568

Open hxawax opened 2 years ago

hxawax commented 2 years ago

Hello,

I believe there is a misunderstanding on Geoviews ability to display WMTS data with the gv.WMTS class. The gv.WMTS class need XYZTiles format url to work as describe in element.py

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
    """
[...]

This format is different from the WMTS format and closer to an XYZtile unofficial format. The current WMTS class is unable to display a proper WMTS request because WMTS requests need to provide the flowing arguments ( LAYER, TILEMATRIXSET, TILEMATRIX, TILEROW, TILECOL ) and not just {X}/{Y}/{Z} url arguments. This can lead to confusion on current Geoviews capability.

Sources:

WMTS standar as described by ogc : https://www.ogc.org/standards/wmts https://en.wikipedia.org/wiki/Tile_Map_Service https://en.wikipedia.org/wiki/Tiled_web_map https://gis.stackexchange.com/questions/132242/what-are-the-differences-between-tms-xyz-wmts

jbednar commented 2 years ago

Do you have examples of available WMTS tile servers that should be supported, and the format they expect?

hxawax commented 2 years ago

There are lots of different uses for WMTS services, I think letting the user choose the server from where he wants to take data from, adds a GIS like usage to Geoviews and increase possibilities .    Basically, WMTS can be used to display almost any geographical data as a background map, allowing more possibilities than generic background maps. 

It can be used for accessing regional topographic maps https://data.gov.uk/dataset/b6d2c93a-a57c-422e-931a-349f6ceab3e7/os-maps-api-wmts   It can be used for accessing very high resolution DEM data without downloading the whole files. https://www.geo.admin.ch/en/geo-services/geo-services/portrayal-services-web-mapping/web-map-tiling-services-wmts.html  Or even the latest satellite imagery  https://securewatchdocs.maxar.com/en-us/Miscellaneous/DevGuides/WMTS/WMTS_MapTile.htm https://www.sentinel-hub.com/develop/api/ogc/standard-parameters/wmts/ https://developers.planet.com/docs/basemaps/tile-services/wmts/

The WMTS format is not the only available format, but it is usually admitted to be the fastest in use. It is described here https://portal.ogc.org/files/?artifact_id=35326

jbednar commented 2 years ago

Here I was looking for links to specific servers along with URL examples for what queries those servers will accept. I have found the query format surprisingly difficult to pin down, and once we have a set of those that are very clear ("this string 'https://some.server.org/mapname/l1/35.png' works, where it means 'https://some.server.org/mapname/{LAYER}/{etc}.png'") then it shouldn't be too hard to add support.

hxawax commented 2 years ago

Here is an example http://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/21781/20/58/70.jpeg from this doc https://api3.geo.admin.ch/services/sdiservices.html#result

prusswan commented 2 years ago

WMTS allows for different tile grids/matrix/origins for different zoom levels, as long as they are specified (e.g. https://wmts.geo.admin.ch/EPSG/3857/1.0.0/WMTSCapabilities.xml). So for two different WMTS services serving tiles on the same projection (it can be EPSG:3857 or any other projection), it is entirely possible for the tile served at zoom level 0 to have different dimensions and extent. The XYZ tiling scheme that is commonly seen and used makes certain assumptions about these parameters, so it is like a special case of WMTS.

In summary, as a start, to fully support WMTS (even if it is only for EPSG:3857), Geoviews need to be able to at least fetch the tile correctly at zoom level 0 (by getting the corner and tile span right) and make some assumptions about the other zoom levels.