geopandas.GeoDataFrame.__geo_interface__#
- property GeoDataFrame.__geo_interface__#
返回一个
GeoDataFrame
作为一个PYTHON功能集合。实现 geo_interface 。返回的python数据结构表示
GeoDataFrame
作为一个类似GeoJSON的FeatureCollection
。这不同于 _to_geo() 只是因为它是具有默认参数的属性,而不是方法
示例
>>> from shapely.geometry import Point >>> d = {'col1': ['name1', 'name2'], 'geometry': [Point(1, 2), Point(2, 1)]} >>> gdf = geopandas.GeoDataFrame(d, crs="EPSG:4326") >>> gdf col1 geometry 0 name1 POINT (1.00000 2.00000) 1 name2 POINT (2.00000 1.00000)
>>> gdf.__geo_interface__ {'type': 'FeatureCollection', 'features': [{'id': '0', 'type': 'Feature', 'properties': {'col1': 'name1'}, 'geometry': {'type': 'Point', 'coordinates': (1.0, 2.0)}, 'bbox': (1.0, 2.0, 1.0, 2.0)}, {'id': '1', 'type': 'Feature', 'properties': {'col1': 'name2'}, 'geometry': {'type': 'Point', 'coordinates': (2.0, 1.0)}, 'bbox': (2.0, 1.0, 2.0, 1.0)}], 'bbox': (1.0, 1.0, 2.0, 2.0)}