2

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")
  • 1
    Add a screenshot/drawing showing what you want to do – BERA Sep 11 at 9:06
  • 2
    I think what you need is complicated. It may not have a simple solution. – Kadir Şahbaz Sep 11 at 9:52
  • Should be able to use scale but the "buffer" will not be 1000 m everywhere – BERA Sep 11 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? gis.stackexchange.com/questions/169694/… – Comrade Che Sep 11 at 12:03
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.