I am trying to write a Python script that when imported into a toolbox can be used to draw user defined shapes on fly by clicking mouse points on the screen inside a GIS program. The motto of drawing should accomplish tasks like selecting the area of interest from a larger raster file etc.

How can I achieve this in Python using ArcPy with ArcGIS Pro?


To do this review the ArcGIS Pro Help on Interactive feature input:

When specifying a geoprocessing tool's input feature data, you have the following options:

  • Select a feature layer from the map.
  • Browse to a feature class.
  • Interactive input—add a new layer and interactively create features.

It is the third option, which I have bolded, that you need.

From the same page I would also emphasize:

You can add the interactive feature input capability to a custom model tool or script tool using the parameter datatype Feature Set. You can configure the interactive input feature type, symbology, attribute fields, editing templates, feature creation tools, and other properties using a layer file template associated with the feature set parameter.


You used to be able to accomplish this in ArcGIS Desktop through an ArcPy Add-in. This allowed you to create a toolbar and capture mouse activity. I'm not familiar enough with ArcGIS Pro, but it doesn't seem to have this available. The alternative seems to be to using their SDK and Microsoft.NET (VB or C#). That would certainly give you the ability to create buttons and capture mouse activity, but then you might have a steeper learning curve if you've never programmed in those languages. https://pro.arcgis.com/en/pro-app/sdk/

Here is an example that uses buttons to create different types of geometry: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geometry/Constructing-Geometries/ConstructingGeometries_VB

There is also one in C#, but VB is probably easier to understand syntax wise if you have never programmed in either of those languages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.