Select to view content in your preferred language

# interior buffer

2961
3
10-17-2014 11:09 AM
New Contributor III

conceptually this doesn't seem hard, but i can't figure out how to do the following:

i have 700 building footprints.  i am trying to show what it would look like if 35% (or \$40% or 70% etc) of each building footprint had a green roof on it.  i did some research and tried using a parcel fabric.  that didn't work because while it did allow me to split the buildings into equal parts, i couldn't specify a percentage.  also, you had to split each footprint individually - i am looking for something that will allow me to do it all at once.  next i though about using an interior buffer.  if i can calculate the distance of a buffer to "eliminate" 65% of a building footprint (so that 35% remains) that could work.  however, i am not a math/geometry wiz - how would one go about calculating the distance of a buffer as i described above?  baring that, is there another approach i am missing?

Tags (4)
3 Replies
Esri Esteemed Contributor

I implemented something like this with the ArcSDE 'C' API.  There's a couple of issues to track:

1. You need to iterate negative buffers on each shape (I kept splitting the difference between a "too large" buffer and a "too small" one until the the area was within 2% or my target)
2. The distance to shrink any one shape can be very different  across rows (I started with a  distance that corresponded to the radius difference of a perfect circle, and let it shrink by a fixed fraction until "too small", then tried to home in on the optimal solution).
3. You can make your threshold very precise, but the number of iterations will increase significantly (and depending on the coordinate reference precision, it might not be possible to meet the threshold criteria, so be sure to impose a constant limit [e.g., 5000 reps] to avoid an infinite loop).

Good luck!

- V

PS: In the future, you may want to post this "In a Place" (like Managing Data) instead of relying on it being found in your personal discussion space based on nominal notification and keyword tags.  You also might want to add "geodatabase" and "geometry" tags.  You can move a discussion/question to a place by clicking on the title, then using the "Move" option off to the right.

New Contributor III

thanks vince.  also for the part about how to post.  this forum still confuses me!

MVP Honored Contributor

Along the lines of Vince's suggestion, here is a python script that goes most of the way there. The script below is a python script tool - change polyFC and outBuffs to file paths of your choice. The algorithm is more coarse than what Vince suggests - it merely shrinks the buffers by the distance specified in the increment variable, until it passes the threshold specified in the testPercent variable. The use of geometry objects allows for buffers on a feature by feature basis.

```# import libraries
import arcpy

# set input/output parameters
polyFC = arcpy.GetParameterAsText(0)    # input polygons
outBuffs = arcpy.GetParameterAsText(1)  # output interior buffers

# percentage of interest
testPercent = 0.35
# increment to shrink buffers
increment = -0.1 # e.g. 10cm

# buffers container
buffs = []

def negBuff(geom, dist, origArea):
# apply negative buffer
buffGeom = geom.buffer(dist)
buffArea = buffGeom.area
# test against percentage of interest
# if less than percentage, add to array
# if not, increase buffer and try again
if buffArea/origArea < testPercent:
buffs.append(buffGeom)
pass
else:
negBuff(geom, dist + increment, origArea)

for row in arcpy.da.SearchCursor(polyFC, ["SHAPE@"]):
# calculate original area
origArea = row[0].area
# run buffers
negBuff(row[0], increment, origArea)

# persist geometry objects
arcpy.CopyFeatures_management(buffs, outBuffs)
```