3

I have an 'area.shp' (a polygon) file that I would like to buffer with a distance of 1000m. The polygon needs to be read from a folder, and the output needs to be saved with a new name at the same folder.

@BERA's suggestion creates a circle polygon around the polygon using GeoPandas - see script below.

Can GeoPandas expand/buffering keeping the same angle/shape?

import geopandas as gpd
df = gpd.read_file("C:\GIS\data\testdata\Grid_sample.shp") 
df2 = df.buffer(1000) 
df2.to_file("C:\GIS\data\testdata\Grid_sample_buffered.shp")
Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
heljor
  • 185
  • 1
  • 8
  • 1
    Add a screenshot/drawing showing what you want to do – BERA Sep 11 '20 at 09:06
  • 2
    I think what you need is complicated. It may not have a simple solution. – Kadir Şahbaz Sep 11 '20 at 09:52
  • Should be able to use scale but the "buffer" will not be 1000 m everywhere – BERA Sep 11 '20 at 10:58
  • It looks to me like you want to resize the polygon, right? Look at the picture in this question, is this what you need? https://gis.stackexchange.com/questions/169694/is-there-arcpy-tool-for-polygon-resizing-like-scale-tool-of-advanced-editing-too – Comrade Che Sep 11 '20 at 12:03

1 Answers1

0

GeoPandas supports cap_style and join_style options in buffer. Since it is using shapely's buffer method, see their documentation on those options - https://shapely.readthedocs.io/en/latest/manual.html#object.buffer.

df2 = df.buffer(1000, cap_style=3, join_style=2) 

However, although it can get closer to original shapes and angles than round buffer, keep in mind that in some cases it is simply not possible to buffer a geometry while preserving its shape.

Other option would be to scale geometry (https://shapely.readthedocs.io/en/latest/manual.html#shapely.affinity.scale). That preserves the original shape, but it may be tricky to get the correct dimension.

martinfleis
  • 2,407
  • 11
  • 17