In [1]:
import numpy as np
import travelmaps as tm
from adashof import cm2in
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

# Disable DecompressionBombWarning
from PIL import Image
Image.MAX_IMAGE_PIXELS = None

%matplotlib inline
from matplotlib import rcParams
# Adjust dpi, so figure on screen and savefig looks the same
dpi = 200
rcParams['figure.dpi'] = dpi
rcParams['savefig.dpi'] = dpi

In [10]:
# Coordinates (from Wikipedia) and shift
DF = [-99.1333, 19.4333]
TH = [  8.1042, 47.4375]
shift = [0, 4.5]

# 4000 km east-west, 3000 km north-south, low resolution, Transverse Mercator
width = 4000000
height = 2500000
res = 'c'
proj = 'tmerc'

In [11]:
fig = plt.figure(figsize=(cm2in([6.1, 4.2])))

# Create basemaps for Mexico and Switzerland
m_mx = Basemap(width=width, height=height, resolution=res, projection=proj,
               lon_0=DF[0]+shift[0], lat_0=DF[1]+shift[1])
m_ch = Basemap(width=width, height=height, resolution=res, projection=proj,
               lon_0=TH[0]+shift[0], lat_0=TH[1]+shift[1])

# Background
m_mx.warpimage('./data/TravelMap/HYP_HR_SR_OB_DR/HYP_HR_SR_OB_DR.tif')

# Country borders Mexico and Switzerland
tm.country('CHE', bmap=m_ch, fc='none', ec='r', lw=.5)
tm.country('MEX', bmap=m_mx, fc='none', ec='r', lw=.5)

# Mexico City and Thalheim
#m_mx.plot(DF[0], DF[1], 'k.', ms=2, latlon=True)
#m_ch.plot(TH[0], TH[1], 'k.', ms=2, latlon=True)

# Savefig
#fpath = '../mexico.werthmuller.org/content/images/karten/'
#plt.savefig(fpath+'Mexiko.png', bbox_inches='tight', pad_inches=0.03)

plt.show()



In [12]:
fig = plt.figure(figsize=(cm2in([6.1, 4.2])))

# Create basemaps for Mexico and Switzerland
m_mx = Basemap(width=width, height=height, resolution=res, projection=proj,
               lon_0=DF[0]+shift[0], lat_0=DF[1]+shift[1])
m_ch = Basemap(width=width, height=height, resolution=res, projection=proj,
               lon_0=TH[0]+shift[0], lat_0=TH[1]+shift[1])

# Background
m_ch.warpimage('./data/TravelMap/HYP_HR_SR_OB_DR/HYP_HR_SR_OB_DR.tif')

# Country borders Mexico and Switzerland
tm.country('CHE', bmap=m_ch, fc='none', ec='r', lw=.5)
tm.country('MEX', bmap=m_mx, fc='none', ec='r', lw=.5)

# Mexico City and Thalheim
m_mx.plot(DF[0], DF[1], 'k.', ms=2, latlon=True)
m_ch.plot(TH[0], TH[1], 'k.', ms=2, latlon=True)

# Savefig
#fpath = '../mexico.werthmuller.org/content/images/karten/'
#plt.savefig(fpath+'Schweiz.png', bbox_inches='tight', pad_inches=0.03)

plt.show()