我正在关注这个例子(https://github.com/geodocker/geodocker-jupyter-geopyspark/blob/master/notebooks/sanfranmvp.ipynb)所以我可以复制类似的输出,除了最后一个之外,每个都是成功的,我已经尝试了所有可能的调整但没有成功,请有人帮忙告诉我我做错了什么。这是代码的最后一步,使用 folium 在 Jupyter notebook 中查看我的地图。
m = folium.Map(tiles='OpenStreetMap', location=map_center, zoom_start=zoom)
folium.TileLayer(tiles=tms.url_pattern, attr='GeoPySpark', name='Weighted layer', overlay=True).add_to(m)
folium.GeoJson('data/bars.geojson', name='Bars', style_function=lambda x: {'radius': 2, 'color': 'red'}, overlay=True).add_to(m)
folium.GeoJson('data/cafes.geojson', name='Cafes', style_function=lambda x: {'fillColor': 'orange'}, overlay=True).add_to(m)
folium.GeoJson('data/transit.geojson', name='Transit', style_function=lambda x: {'fillColor': 'green'}, overlay=True).add_to(m)
m
这是错误消息:
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-13-42944e2ceb84> in <module>()
11 m = folium.Map(tiles='OpenStreetMap', location=map_center, zoom_start=zoom)
12 folium.TileLayer(tiles=tms.url_pattern, attr='GeoPySpark', name='Weighted layer', overlay=True).add_to(m)
---> 13 folium.GeoJson('data/bars.geojson', name='Bars', style_function=lambda x: {'radius': 2, 'color': 'red'}, overlay=True).add_to(m)
14 folium.GeoJson('data/cafes.geojson', name='Cafes', style_function=lambda x: {'fillColor': 'orange'}, overlay=True).add_to(m)
15 folium.GeoJson('data/transit.geojson', name='Transit', style_function=lambda x: {'fillColor': 'green'}, overlay=True).add_to(m)
/usr/local/lib/python3.4/site-packages/folium/features.py in __init__(self, data, style_function, name, overlay, control, smooth_factor, highlight_function)
480 else: # This is a filename
481 with open(data) as f:
--> 482 self.data = json.loads(f.read())
483 elif data.__class__.__name__ in ['GeoDataFrame', 'GeoSeries']:
484 self.embed = True
/usr/lib64/python3.4/encodings/ascii.py in decode(self, input, final)
24 class IncrementalDecoder(codecs.IncrementalDecoder):
25 def decode(self, input, final=False):
---> 26 return codecs.ascii_decode(input, self.errors)[0]
27
28 class StreamWriter(Codec,codecs.StreamWriter):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 10894: ordinal not in range(128)