【发布时间】:2020-05-06 10:20:59
【问题描述】:
在问这个问题之前,我要展示一下我做了什么:
我正在使用 Pyhton 以及即将展示的软件包。
我想使用 osmnx 访问与葡萄牙大陆(西班牙旁边的部分,因此不包括岛屿)对应的数据:
import geopandas as gpd
import pandas as pd
from shapely.geometry import Point, LineString, Polygon
import networkx as nx
import osmnx as ox
import matplotlib.pyplot as plt
from descartes import PolygonPatch
from IPython.display import IFrame
ox.config(log_console=True, use_cache=True)
选择了地点。我得到了葡萄牙对应的MultiPolygon
place = 'Portugal'
G = ox.gdf_from_place(place)
fig, ax = ox.plot_shape(G, figsize=(17,17))
我只想要葡萄牙大陆,我的意思是这只是西班牙旁边的部分,不包括亚速尔群岛和马德拉岛等岛屿。因此,我探索了 MultipPolygon 的几何形状。然后将所有多边形按面积排序,选出面积最大的那个。
exploded_G = G.explode()
exploded_G['area'] = exploded_G.area
exploded_G.sort_values(by='area', inplace=True)
Portugal= exploded_G.iloc[-1]['geometry']
我的问题是:如何访问我现在拥有的多边形(我称之为葡萄牙的多边形)的所有信息,例如兴趣点、道路、节点等。
提前谢谢你。
【问题讨论】:
标签: python python-3.x polygon osmnx