AnsweredAssumed Answered

ArcGIS Pro | ArcPy - How To Refresh the Map

Question asked by Thib@ult on Feb 16, 2017
Latest reply on May 1, 2019 by curtvprice

Hi ArcGIS Community,


I have a Python script that simply add points to a feature class in file GDB every second. The corresponding layer is in an ArcGIS Pro map, and I would like to visualise the point as their are being added, without manually interacting with the map.


When running the script as a standalone script, panning or zooming will force the map to refresh and display points newly added.


How can I programatically refresh the map to see the update displayed dynamically, without the need for user interaction ?




  • Windows 8.1
  • ArcGIS Pro 1.4.1


import arcpy, time, random, datetime

aprx ='D:\workspaces\sandbox\sandbox\sandbox.aprx')

fields = ['SHAPE@XY', 'DATETIME']
iteration = 10
second = 1
# bouding box: east, west, south, north (define your own extent)
boundingBox = [x1,x2,y1,y2]

fc = r"D:\workspace\mygdb.gdb\Points"

for i in range(iteration):
     x = random.uniform(boundingBox[0],boundingBox[1])
     y = random.uniform(boundingBox[2],boundingBox[3])
     xy = (x,y)
     cursor = arcpy.da.InsertCursor(fc, fields)
     del cursor
     print('Done! ... i=' + str(i))