Python中GeoJson和bokeh-1的使用講解
更新時(shí)間:2019年01月03日 10:22:05 作者:staHuri
今天小編就為大家分享一篇關(guān)于Python中GeoJson和bokeh-1的使用講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
GeoJson 文檔
{ "type": "FeatureCollection", "features": [ { "geometry": { "type": "Polygon", "coordinates": [ [ [ 3, 1 ], [ 3, 2 ], [ 4, 2 ], [ 4, 1 ], [ 3, 1 ] ] ] }, "type": "Feature", "properties": { "perimeter": 0, "vista": "mim", "provincia": "右側(cè)正方形", "objectid": 24, "prov": 0, "bounds": [ 0, 0 ], "provif3_": 27.0, "ogc_fid": 26, "provif3_id": 26.0 } }, { "geometry": { "type": "Polygon", "coordinates": [ [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ], [ 1, 1 ] ] ] }, "type": "Feature", "properties": { "perimeter": 0, "vista": "mim", "provincia": "左側(cè)正方形", "objectid": 24, "prov": 0, "bounds": [ 0, 0 ], "provif3_": 27.0, "ogc_fid": 26, "provif3_id": 26.0 } } ] }
from bokeh.io import show, output_notebook, output_file from bokeh.models import ( GeoJSONDataSource, HoverTool, LinearColorMapper ) from bokeh.plotting import figure from bokeh.palettes import Viridis6 with open(r'argentina.json', 'r', encoding='utf8') as f: geo_source = GeoJSONDataSource(geojson=f.read()) color_mapper = LinearColorMapper(palette=Viridis6) TOOLS = "pan,wheel_zoom,box_zoom,reset,hover,save" p = figure(title="正方形", tools=TOOLS, x_range=[1, 10], y_range=[1, 10], width=500, height=500) p.grid.grid_line_color = None p.patches('xs', 'ys', fill_alpha=0.7, fill_color={'field': 'objectid', 'transform': color_mapper}, line_color='white', line_width=0.5, source=geo_source) hover = p.select_one(HoverTool) hover.point_policy = "follow_mouse" hover.tooltips = [("Provincia:", "@provincia")] output_file("test.html", title="Testing Polygon in bokeh") show(p)
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接
相關(guān)文章
TensorFlow基于MNIST數(shù)據(jù)集實(shí)現(xiàn)車牌識(shí)別(初步演示版)
這篇文章主要介紹了TensorFlow基于MNIST數(shù)據(jù)集實(shí)現(xiàn)車牌識(shí)別(初步演示版),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08如何在Windows環(huán)境下安裝PyMySQL(已安裝Anaconda)
這篇文章主要介紹了如何在Windows環(huán)境下安裝PyMySQL問(wèn)題(已安裝Anaconda),具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-08-08Pandas時(shí)間序列:重采樣及頻率轉(zhuǎn)換方式
今天小編就為大家分享一篇Pandas時(shí)間序列:重采樣及頻率轉(zhuǎn)換方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-12-12