Overlay coastline on tile

Hi, if there’s a image over map, we need to draw coastline to make it easier to read.

I have tried this:

import geoviews as gv
import geoviews.feature as gf


gv.tile_sources.OSM() * gf.coastline.opts(projection=ccrs.GOOGLE_MERCATOR)

The result is wrong although the coastline has been reprojected.

What if you just do

import geoviews as gv
import cartopy.crs as ccrs
gv.extension("bokeh")

gv.Points(([-88], [40])).opts(projection=ccrs.GOOGLE_MERCATOR, global_extent=True) * gv.feature.coastline() * gv.tile_sources.OSM()

image

1 Like

Another way:

import xarray as xr
import hvplot.xarray
ds = xr.tutorial.open_dataset("air_temperature")
ds.hvplot("lon", "lat", coastline=True, projection="GOOGLE_MERCATOR")

Ha, interesting. Projected points * coastline * tile works. Don’t know the logic behind it, hah. Anyway, thanks for the solution.

I think this works too if you zoom out / set .opts(global_extent=True)