例子:
里面的坐标是WGC0084的。
pythonfrom geopandas import GeoDataFrame
from shapely.geometry import Polygon
import matplotlib.pyplot as plt
record_area = {'新地类': {0: '裸岩', 1: '乔木林'},
'面积': {0: 2.46, 1: 0.12},
'Shape_Length': {0: 0.010351519392398598, 1: 0.0023489068258685593},
'Shape_Area': {0: 2.634822326382532e-06, 1: 1.246329599286182e-07},
'geometry': {0: Polygon([(115.30992347400002, 41.03045785900008), (115.3098257480001, 41.03042899800005),
(115.30969286300001, 41.030391199000064), (115.30960737200007, 41.030363582000064),
(115.30965327800004, 41.03029873600008), (115.30983235100007, 41.03028598000003),
(115.31004008700006, 41.030290766000064), (115.31030859000009, 41.03026627100007),
(115.31056930500006, 41.03019715200003), (115.31077333600001, 41.03014305800008),
(115.31089930700011, 41.03007015400004), (115.31105807100005, 41.03001293300008),
(115.31135016400003, 41.029988169000035), (115.3116654150001, 41.029762223000034),
(115.3118061460001, 41.029661358000055), (115.31249887400008, 41.029374731000075),
(115.31273030900002, 41.029320978000044), (115.3130813470001, 41.029239447000066),
(115.3131580270001, 41.02922081600008), (115.313297379, 41.029186956000046),
(115.31355647200007, 41.02892670500006), (115.31357707600012, 41.02886651400007),
(115.31291644200007, 41.02877125500004), (115.31159314900003, 41.028738934000046),
(115.31138943700012, 41.02892181000004), (115.31061582600012, 41.02947425800005),
(115.30987346500001, 41.029959062000046), (115.30967965600007, 41.030048538000074),
(115.30934632200001, 41.03028793000004), (115.30921034800008, 41.03033235700008),
(115.3091987890001, 41.03033314600003), (115.30982119300006, 41.03049919700004),
(115.30992347400002, 41.03045785900008)]),
1: Polygon([(115.30751786600001, 41.03123731200003), (115.30736804700007, 41.03119306200006),
(115.30724995300011, 41.03118725400003), (115.30725101300004, 41.03124084600006),
(115.30736995600012, 41.03128952700007), (115.30771220700001, 41.03141429200008),
(115.30786805900004, 41.03147224600008), (115.30819713300002, 41.03159461300004),
(115.30831718700006, 41.03146102800008), (115.3081085990001, 41.03141336600004),
(115.30803719100004, 41.03138201500008), (115.3077433850001, 41.031301418000055),
(115.30762438200009, 41.03126877200003), (115.30751786600001, 41.03123731200003)])
}
}
g = GeoDataFrame(record_area, crs="EPSG:4326")
print("地图")
print(g)
g.plot()
plt.show()
print("面积直接算 算的图形面积 不是地理面积:")
print(g.area)
g.to_crs(epsg=3310, inplace=True)
print("计算地图面积:")
print(g.area)
本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!