Set extent for WMTS tile

When setting the extent of WMTS tiles, we should convert degree to pass them as xlim or ylim.
Here’s the example:

import geoviews as gv
from pyproj import Proj, transform

inProj = Proj(init='epsg:4326')
outProj = Proj(init='epsg:3857')

arctic_lon1, arctic_lat1 = transform(inProj,outProj,-180,60)
arctic_lon2, arctic_lat2 = transform(inProj,outProj,180,90)

gv.tile_sources.OSM().opts(xlim=(arctic_lon1, arctic_lon2), ylim=(arctic_lat1, arctic_lat2))

However, some white stripes exist on the top. Is it possible to crop correctly?

I think you can just change the width/height aspect

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

Or aspect=2

Thanks, but the default view I want is the Arctic region (60<lat<90, -180<lon<180).

gv.tile_sources.OSM().opts(xlim=(arctic_lon1, arctic_lon2), ylim=(arctic_lat1, arctic_lat2), aspect=360/30)

1 Like

In your original example the map is being limited correctly to 90°. You’re getting white space because there are no map tiles above ~85°. The web mercator coordinate system doesn’t extend beyond 85°.

Area of use: World between 85.06°S and 85.06°N.