Reputation: 105
I am making a map using the Cartoee
functionality of geemap
in Python
. The basemap is srtm from the Earth Engine
library. When I make the map and add gridlines, the longitude sequence is backwards from what I am use to, or it seems like the zero longitude is out over the Pacific. Here is a minimal working example pretty much taken from the Cartoee
examples 50 cartoee quickstart - geemap:
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
import ee
import geemap
from geemap import cartoee
%pylab inline
# Initialize geemap
geemap.ee_initialize()
srtm = ee.Image("USGS/3DEP/10m")
region = [-122.5, 36.75, -121.5, 37.25]
vis = {"min": -20, "max": 600}
fig = plt.figure(figsize=(8, 5))
ax = cartoee.get_map(srtm, cmap='gist_yarg', region=region, vis_params=vis)
cartoee.add_colorbar(ax, vis, cmap = 'gist_yarg', loc="right", label="Elevation (m)", orientation="vertical")
cartoee.add_gridlines(ax, crs=ccrs.PlateCarree(), interval=0.15, xtick_rotation=45, linestyle=":")
plt.savefig('foo.png', bbox_inches='tight')
This produces the following map:
The plotted region is central coastal California, in between -122.5 and -121.5 degrees west longitude (the City of Santa Cruz is pretty much in image center). I would like the longitude coordinate sequence flipped on the basis of the zero longitude running through the U.K., France, Algeria, Mali, etc. (prime meridian). I am not sure how to proceed after unsuccessfully trying to flip the xlabels by using ax.get_xlabels()
.
Upvotes: 0
Views: 29