I want to create buffers from any point in a multiple point file.
I can do it with a constant buffer using geopandas.buffer()
track.geometry = track['geometry'].buffer(0.05)
track_line = track.iloc[2:].head()
but the buffer is applied to all points.
I would like to apply different buffer values. For example, using values in another column of the data frame or a new csv column value.
For example,
ID,latitude,longitude,buffer_value
0,45.4,-156.0,0.3
1,45.53,-156.98,0.4
2,45.66,-156.97,0.34
3,45.79,-156.957,0.23
4,45.93,-156.942,0.45
How can I do it?
-
Does this answer your question? gis.stackexchange.com/a/258357/78446Jon– Jon2018年09月07日 15:39:29 +00:00Commented Sep 7, 2018 at 15:39
1 Answer 1
In the next version of GeoPandas this will be possible with the buffer
method (https://github.com/geopandas/geopandas/pull/781), but for now you do it manually like this:
track['geometry'] = track.apply(
lambda row: row.geometry.buffer(row.buffer_value), axis=1)
-
Very useful while the next version comes.kamome– kamome2018年09月07日 16:27:39 +00:00Commented Sep 7, 2018 at 16:27