# Update on last post

This is a quick post updating the last one. Some people inquired me on the possibility of downloading a georeferenced image from an online service.

The answer is yes and no. Cartopy has some very handy functions to do just that. However, most of them will not have the desired zoom level for just a small area as the one in the previous post. Also, the ItaguarÃ© region is very dynamic, so it is hard to find one image that will represent the area for all times. (Recall that in my previous post I rolled back the Google Earth Image archive to find one that was similar to the day of the sampling).

Anyways, if you are not limited by those points I raised above go ahead and give it a try!

In [2]:
import matplotlib.pyplot as plt
import cartopy.io.img_tiles as cimgt

In [3]:
def map_quest(map_request, figsize=(8, 8),
llcrnrlon=None, urcrnrlon=None,
llcrnrlat=None, urcrnrlat=None, zoom=8):
# Create a GeoAxes in the tile's projection.
fig, ax = plt.subplots(figsize=figsize, subplot_kw=dict(projection=map_request.crs))

ax.set_extent([llcrnrlon, urcrnrlon, llcrnrlat, urcrnrlat])

return fig, ax

In [4]:
llcrnrlon = -(45 + (58 + 32.27/60) / 60)  # 45Â°58'32.27"W
urcrnrlon = -(45 + (57 + 54.54/60) / 60)  # 45Â°57'54.54"W
llcrnrlat = -(23 + (47 +  7.65/60) / 60)  # 23Â°47' 7.65"S
urcrnrlat = -(23 + (46 + 42.25/60) / 60)  # 23Â°46'42.25"S


The Map Quest Aerial is a good choice if you are in the USA, but global coverage is provided only at zoom levels 0--11:

In [5]:
map_request = cimgt.MapQuestOpenAerial()
fig, ax = map_quest(map_request,
llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
zoom=11)


Open Street Map:

In [6]:
map_request = cimgt.OSM()
fig, ax = map_quest(map_request,
llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
zoom=15)


In [7]:
map_request = cimgt.GoogleTiles()
fig, ax = map_quest(map_request,
llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
zoom=15)


Map Quest using Open Street Maps:

In [8]:
map_request = cimgt.MapQuestOSM()
fig, ax = map_quest(map_request,
llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
zoom=15)


Microsoft WTS:

In [9]:
map_request = cimgt.QuadtreeTiles()
fig, ax = map_quest(map_request,
llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
zoom=15)


This last one was almost OK, but the image quality is not as Google Earth's image.

In [10]:
HTML(html)

Out[10]:

This post was written as an IPython notebook. It is available for download or as a static html.