Using Matplotlib and Cartopy, plotting a map from Swisstopo is shifted by about 170m. The official coordinate system of Switzerland is EPSG 2056 ("LV95"). I create an axes in matplotlib with this projection and use wms_add to plot the map. I know the coordinate of some objects and they do not match in the plot. Also, when I overlay objects downloaded from Swisstopo (in LV95) they do not match the wms map. The same offset is seen in: https://gis.stackexchange.com/questions/4035/problem-with-swiss-coordinate-system-overlay-in-wms?newreg=db3988a2d7e4441993f3fb1795f76bbf
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
LV95 = ccrs.epsg(2056)
# in LV95:
x0 = 2682956; y0 = 1246234; extent = 500;
xmin=x0-extent/2; xmax=x0+1.5*extent; ymin=y0-extent; ymax=y0+extent
fig = plt.figure(figsize=(8,8), dpi=96)
ax = fig.subplots(subplot_kw={'projection':LV95})
ax.add_wms(wms='https://wms.geo.admin.ch/',
layers='ch.swisstopo.swisssurface3d-reliefschattierung-multidirektional')
ax.set_xticks([xmin,0,xmax]); ax.set_yticks([ymin,0,ymax])
ax.set_xlim(xmin,xmax); ax.set_ylim(ymin,ymax)
ax.ticklabel_format(axis='x', useOffset = x0)
ax.ticklabel_format(axis='y', useOffset = y0)
ax.set_xlabel("(LV95) X [m]"); ax.set_ylabel("(LV95) Y [m]");
I tried to specify explicitly the coordinate system for the wms query with
wms_kwargs = {'srs':'EPSG:2056'}
but get an error (double specification). Maybe it has to do with the default order for SRS in the query:
https://scitools.org.uk/cartopy/docs/latest/_modules/cartopy/io/ogc_clients.html
I don't know if this is a bug, or I do something wrong. Any help please!