【问题标题】:Increase the radius of polygon geometries in geopandas增加 geopandas 中多边形几何的半径
【发布时间】:2020-09-22 20:53:46
【问题描述】:

如下图所示,我在 geopandas df 中有一堆饼形的多边形,我正在考虑将多边形的半径从 x 增加到 y。

这可以使用 geopandas 或 shapely 完成吗?我不知道从哪里开始。任何帮助或提示将不胜感激。谢谢你。提前为手绘图道歉。

import pandas as pd
from shapely.geometry import Point, LineString, Polygon
from geopandas import GeoDataFrame

data = [[1,72.774906,27.620367],[1,72.983647,27.707941], 
[1,73.148441,27.785725],[1,73.280277,27.853741],[1,73.401127,27.921714], 
[1,73.467045,27.795445],
[1,73.510990,27.737117],[1,73.521977,27.659298],[1,73.500004,27.581423], 
[1,73.478031,27.552206],[1,73.467045,27.503493],[1,73.434086,27.454759],
[1,73.412113,27.406003],[1,72.774906,27.620367]] 
df_poly = pd.DataFrame(data, columns = ['poly_ID','lon', 'lat']) 

lat = df_poly.lat.tolist()
lon = df_poly.lon.tolist()

polygon_geom = Polygon(zip(lon, lat))
crs = {'init': 'epsg:4326'}
polygon = gp.GeoDataFrame(index=[0], crs=crs, geometry=[polygon_geom])       


import folium
m = folium.Map([50.854457, 4.377184], zoom_start=5, tiles='cartodbpositron')
folium.GeoJson(polygon).add_to(m)
folium.LatLngPopup().add_to(m)
m

【问题讨论】:

    标签: python geopandas shapely


    【解决方案1】:

    看看shapely.affinity.scale 方法。 有了这个,您可以根据您的需要在 x 和 y 方向上缩放您的几何图形! Shapely affinity scale

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-01
      • 2021-12-28
      • 2018-06-14
      • 1970-01-01
      • 2021-04-01
      • 2021-03-21
      相关资源
      最近更新 更多