2

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?

mkennedy
19.4k2 gold badges40 silver badges62 bronze badges
asked Sep 7, 2018 at 15:27
1

1 Answer 1

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)
answered Sep 7, 2018 at 15:42
1
  • Very useful while the next version comes. Commented Sep 7, 2018 at 16:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.