0

I want to use Multiple Ring Buffer (MRB) tool to create multiple donuts, but when I use NONE dissolve and outside polygon it cuts only input buffer from all created and I want it to cut first ring from the second one created. For better understanding: I create 3 buffers - 1km, 5km, 10km First is continuous from starting point and I use it as input for MRB tool. 2nd and 3rd created via MRB: 2nd is what I want because tool dissolves and is outside it. 3rd - I want to have hole with 5km radius=cuted 2nd buffer not 1st.

I know I can do it creating one after another but maybe there is way to make it in one operation? I assume that there is small (?) change of python code needed but I don't know where and how :(

Bera
81.7k14 gold badges85 silver badges199 bronze badges
asked Sep 26, 2017 at 13:43
2
  • 1
    Aren't they donuts already? Commented Sep 26, 2017 at 14:30
  • Yes, they are but I want the donut hole to be larger every time. Like smaller donut cuts next/bigger one. And now they have the same size of hole. Commented Sep 27, 2017 at 6:29

1 Answer 1

0

I've written some python code a few years ago which creates donuts; you would wire it up to a script interface or you can hard wire the input parameters

'''
Title: Create donut rings around points
Description: Takes as input the distance of the inner and outer ring and creates a donut polygon around it.
Limitations: Tool expects units of point dataset to be in meters.
Created: 19/9/14
'''
import arcpy
import sys
# Set environment settings
arcpy.env.addOutputsToMap=True
arcpy.env.overwriteOutput = True
def main():
 try:
 # Get parameters
 layer = arcpy.GetParameterAsText(0) # Layer
 pointID = arcpy.GetParameterAsText(1) # Unique ID field
 innerBuff = float(arcpy.GetParameterAsText(2)) # Inner ring distance
 outerBuff = float(arcpy.GetParameterAsText(3)) # Outer ring distance
 outFC = arcpy.GetParameterAsText(4) # Output FeatureClass
 # Check if parameters are sensible
 if innerBuff <= 0:
 arcpy.AddWarning("The inner buffer must be greater than zero!")
 return
 if outerBuff < innerBuff:
 arcpy.AddWarning("The outer buffer must be larger than in the inner buffer value!")
 return
 features = []
 ids =[]
 # Create a cursor over the points and build donuts
 arcpy.AddMessage("Creating donuts...")
 with arcpy.da.SearchCursor(layer, ['SHAPE@', pointID]) as cursor:
 for row in cursor:
 geom = arcpy.PointGeometry(row[0].getPart(0))
 ID = row [1]
 inBuff = geom.buffer(innerBuff)
 outBuff = geom.buffer(outerBuff)
 donut = outBuff.symmetricDifference(inBuff)
 features.append(donut)
 ids.append(ID)
 # Write data to new FeatureClass
 arcpy.AddMessage("Writing features to output dataset...")
 arcpy.CopyFeatures_management(features, outFC)
 arcpy.MakeTableView_management(outFC,"tv")
 arcpy.AddField_management("tv","ID","LONG")
 x = 0
 with arcpy.da.UpdateCursor("tv",['ID']) as cursor:
 for row in cursor:
 row[0] = ids[x]
 x+=1
 cursor.updateRow(row)
 # Set output
 arcpy.SetParameterAsText(4,outFC)
 except Exception as e:
 # Report error
 arcpy.AddError(str(e))
 sys.exit("Failed to Process")
if __name__ == '__main__':
 main()

You would wire up the script as below:

Tool script properties

When you run this script it would generate output as shown below:

Example output

answered Sep 26, 2017 at 22:37
3
  • I have problem during adding this script as a tool in ArcToolbox. What should I pick as Data Type for ring distances, I've tried String, Linear Unit, Double and all have the same error comment: could not convert string to float. And is there a possibility to create multiple rings? Commented Sep 27, 2017 at 6:57
  • @KaBi I have amended my question with an image, also made a small tweak to the code for innerBuff. Commented Sep 27, 2017 at 11:03
  • thak you, I've skipped adding ID Field, my mistake. Once again thanks! Commented Sep 27, 2017 at 11:51

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.