1

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?

2

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 Sep 7 '18 at 16:27

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.