Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cartopy shaded relief

I have been struggling with generating a shaded relief to underlay my cartopy maps. This srtm_shading example is very slow for downloading data from new areas. Is there any way to use a shaded relief image instead?

This image tiling seems promising, but I couldn't figure out how to get just shaded relief in grayscale rather than terrain.

like image 870
jsignell Avatar asked May 24 '16 21:05

jsignell


1 Answers

I found an ESRI shaded relief tiler and implemented a class that called to the tiler. I have submitted a pull request, but in the meantime:

from cartopy.io.img_tiles import GoogleTiles
class ShadedReliefESRI(GoogleTiles):
    # shaded relief
    def _image_url(self, tile):
        x, y, z = tile
        url = ('https://server.arcgisonline.com/ArcGIS/rest/services/' \
               'World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}.jpg').format(
               z=z, y=y, x=x)
        return url

As an example:

import matplotlib.pyplot as plt
ax = plt.axes(projection=ShadedReliefESRI().crs)
ax.set_extent([-22, -15, 63, 65])
ax.add_image(ShadedReliefESRI(), 8)

shaded relief

Just be sure that you comply with ESRI use guidelines.

like image 176
jsignell Avatar answered Sep 30 '22 05:09

jsignell