1

I am trying to set up a custom tool via a python script in ArcMap. I want the tool to be able to create a point feature with X/Y input and then pass that point into the buffers.

My thinking is that someone could use the tool to find what is inside the radius from their given point that they input themselves without having to create a feature class first (I hope that makes it clearer).

Am I doing this right by creating the point feature and using the GetParameterAstext string? What exactly would go in the multiple ring buffer at the bottom?

import arcpy
import os
# Create a Point object from coordinates then set up buffer rings 
pnt.X = arcpy.GetParameterAsText(0)
pnt.Y = arcpy.GetParameterAsText(1)
arcpy.Point(pnt.X, pnt.Y) = arcpy.GetParameterAsText(2)
BuffRing1 = arcpy.GetParameterAsText(3)
BuffRing2 = arcpy.GetParameterAsText(4)
distances = [BuffRing1, BuffRing2]
measure = ['miles']
arcpy.MultipleRingBuffer_analysis()
Erica
8,9824 gold badges35 silver badges85 bronze badges
asked Sep 23, 2017 at 14:56
0

1 Answer 1

3
  • To understand what parameters go into any ArcPy command, the best resource is the Esri help pages (in this case, for Multiple Ring Buffer). Parameters in curly brackets {} are optional. Any of these input parameters can either be hard-coded by you (for example, you might always want Buffer_Unit to be "Miles"), or passed in as variables that are set from user input parameters.

    arcpy.MultipleRingBuffer_analysis(
     Input_Features,
     Output_Feature_class,
     Distances,
     {Buffer_Unit},
     {Field_Name},
     {Dissolve_Option},
     {Outside_Polygons_Only})
    
  • You'll need to specify the Output_Feature_class since it is a required parameter of the tool. That can be either user-controlled, or hard-coded by you.

  • An arcpy.Point can be created with just two numeric inputs (ref.)

    # Create point object
    input_x = arcpy.GetParameterAsText(0)
    input_y = arcpy.GetParameterAsText(1)
    point = arcpy.Point(input_x, input_y)
    
  • And finally, the measure variable (presumably being passed in as the Buffer_Unit) should be a string, not a list.

answered Sep 23, 2017 at 17:19
11
  • Thanks, but I am trying to take this script and add it as a custom tool in a toolbox. I am not sure if I understand. I want it to open up in a dialog box so that I can add the x,y coordinates in their own rows and then have drop downs for the distance of my buffers. When I run the tool I want the point to generate based on the x,y with the buffers. Commented Sep 23, 2017 at 19:24
  • I understand that. What other parts of the process are you needing help with? Based on the two questions you asked above I thought this was all you needed, but I understand how complicated the Python tool creation process can be when you're doing it for the first time! Commented Sep 23, 2017 at 19:26
  • import arcpy import os XY = arcpy.GetParameterAsText(0) outputFC = arcpy.GetParameterAsText(1) buffDist = arcpy.GetParameterAsText(2) arcpy.Buffer_analysis(XY, outputFC, buffDist) Commented Sep 23, 2017 at 19:57
  • I am unable to get the tool to successfully run. It keeps saying that the tool failed. When I go to set the parameters in the tool, I set XY = point, Output FC = feature class and BuffDist = linear unit. I tried to make this even more simple but it is not generating. Commented Sep 23, 2017 at 19:59
  • For BuffDist, you probably want numbers (float, integer) rather than linear unit. Commented Sep 23, 2017 at 20:02

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.