0

I have two sf polygon objects - one of land parcels and the other of parks. All parcels are within 2 miles of at least one park, but some parcels are within that distance to multiple parks. Parks and parcels are not of uniform size or shape.

For each land parcel, I want to calculate the area of park polygons within a half mile. Other posts answer how to calculate the area of each park and the distance between polygons, but not how I can calculate the area of parks within a half mile of each parcel. Any advice would be appreciated. Thank you!

parks in red (polylines), parcels surrounding

  • Without example data it's a bit hard to show this, but I would buffer the land parcels and then intersect the buffered parcels with the parks to get the area you want – Calum You Sep 24 '19 at 17:27
  • A picture is illustrative but does not actually help us reproduce your question. Please take a look at [how to ask](https://stackoverflow.com/questions/58085389/how-to-calculate-area-of-polygons-within-distance-of-other-polygons) and [how to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). In particular, if you use `dput` to provide a few examples, perhaps 3 parcels and 2 parks, it will be much easier to provide and test solutions. – Calum You Sep 24 '19 at 19:45
  • @CalumYou thank you for the idea! I do think that would be pretty computing intensive, though - running a buffer for each parcel, then seeing the amount of that buffer within a park, then transferring that value back to the parcel. But I suppose any other method would involve similarly-intense computation! – cedarlake23 Sep 24 '19 at 19:49

1 Answers1

0

Figured I should post the steps I took to solve this:

  1. Create a buffer sf object for the parcels (dist = 1/2 mile)
  2. Create an intersection sf object for the buffer and the parks (this will still have the parcel IDs, since it's based on each parcel's buffer)
  3. Use st_area the calculate the area of those intersections
  4. convert the intersection sf object to a data.table
  5. merge that data.table with the original parcel sf object based on PID

That results in the parcel sf object having the area of the parks within a half mile of them.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92