【发布时间】:2019-10-26 19:26:00
【问题描述】:
我有这个代码:
import pandas as pd
import numpy as np
from geopandas import GeoDataFrame
import geopandas
from shapely.geometry import LineString, Point
import matplotlib.pyplot as plt
import contextily
''' Do Something'''
df = start_stop_df.drop('track', axis=1)
crs = {'init': 'epsg:4326'}
gdf = GeoDataFrame(df, crs=crs, geometry=geometry)
ax = gdf.plot()
contextily.add_basemap(ax)
ax.set_axis_off()
plt.show()
基本上,这会生成一个位于新加坡的背景地图。但是,当我运行它时,我收到以下错误:HTTPError: Tile URL resulted in a 404 error. Double-check your tile url:http://tile.stamen.com/terrain/29/268436843/268435436.png
但是,它仍然会生成此图像:
如何更改磁贴 URL?我仍然希望将新加坡地图作为基础图层。
编辑:
还尝试将此参数包含在 add_basemap 中:url ='https://www.openstreetmap.org/#map=12/1.3332/103.7987'
哪个产生了这个错误:OSError: cannot identify image file <_io.BytesIO object at 0x000001CC3CC4BC50>
【问题讨论】:
标签: python python-3.x geopandas contextily