Open jbednar opened 3 years ago
If you want to use it, I've created a short notebook showcasing XYZ tile, WMS, and WFS support https://github.com/anitagraser/ogd-at-lab/blob/main/notebooks/webmapping.ipynb
I am trying to follow this issue but I am having some troubles in getting the correct bounds and projection.
The info below should match what is found in the GetCapabilities
<CRS>EPSG:4326</CRS>
<CRS>CRS:84</CRS>
<CRS>EPSG:25833</CRS>
<CRS>EPSG:32661</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>21.7619</westBoundLongitude>
<eastBoundLongitude>34.4178</eastBoundLongitude>
<southBoundLatitude>69.5357</southBoundLatitude>
<northBoundLatitude>73.5396</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="EPSG:4326" minx="69.5357" miny="21.7619" maxx="73.5396" maxy="34.4178"/>
<BoundingBox CRS="CRS:84" minx="21.7619" miny="69.5357" maxx="34.4178" maxy="73.5396"/>
<BoundingBox CRS="EPSG:25833" minx="747367" miny="7.78265e+06" maxx="1.15805e+06" maxy="8.19063e+06"/>
<BoundingBox CRS="EPSG:32661" minx="2.79622e+06" miny="5454" maxx="3.1363e+06" maxy="341574"/>
<Layer>
The server URL, layers, crs, and extent are:
import holoviews as hv
import geoviews as gv
from owslib.wms import WebMapService
gv.extension('bokeh')
server = "http://nbswms.met.no/thredds/wms_ql/NBS/S1A/2021/04/22/IW/S1A_IW_GRDM_1SDV_20210422T152707_20210422T152740_037565_046E1E_0EF5.nc"
wms = WebMapService(server)
wms_layers = list(set(list(wms.contents)) - set(["WMS", "lat", "on"]))
# ['amplitude_vv', 'amplitude_vh']
YMIN, XMIN, YMAX, XMAX, crs = wms.contents[list(wms.contents)[0]].boundingBox
extents = (XMIN, YMIN, XMAX, YMAX)
# (69.5357, 21.7619, 73.5396, 34.4178)
url=f"{server}?&service=WMS&request=GetMap&layers={wms_layers[0]}&styles=&format=image/png&transparent=true&version=1.3.0&width=256&height=256&crs={crs}"
# 'http://nbswms.met.no/thredds/wms_ql/NBS/S1A/2021/04/22/IW/S1A_IW_GRDM_1SDV_20210422T152707_20210422T152740_037565_046E1E_0EF5.nc?&service=WMS&request=GetMap&layers=amplitude_vv&styles=&format=image/png&transparent=true&version=1.3.0&width=256&height=256&crs=EPSG:4326&bbox={XMIN},{YMIN},{XMAX},{YMAX}'
hv.Tiles(url, extents=extents).opts(width=600, height=600)
I guess I am doing something wrong, as the image rendered looks like:
Also the behaviour when zooming looks something wrong with projections/bounds, but I am still not able to find the issue.
Expected image from url should be:
Do you have any clue about what I am doing wrong?
after some debugging .. seems this WMS is using a swapped CRS ... x,y are inverted, and also it is my understanding that geoviews only supports tiles in EPSG:3857 - which is not suitable for high latitude data (my use-case)
this notebook shows the wms when rendered inline https://nbviewer.jupyter.org/gist/epifanio/b33428110136f60807a632fb05664481 however, no overlay with base maps seems to be possible. Also when embedded into a panel app, the map is not rendered in the correct place.
I believe GeoViews can now display tiles in any projection (didn't @philippjfr show me that?), but I don't know that it accepts them in different projections.
According to @philippjfr , the GeoViews Tiles element can support the sort of WMS maps shown by Folium in https://nbviewer.jupyter.org/gist/micpilon/41fe6834c2116c715486e059d7d449a5 using a specially constructed URL:
It would be good to expand http://geoviews.org/user_guide/Working_with_Bokeh.html or other docs to explain what's supported, what is not supported, and how to use the WMS and other non-WMTS tiled map support. CC: @rsignell-usgs