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 = arcpy.mp.ArcGISProject('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,boundingBox)
y = random.uniform(boundingBox,boundingBox)
xy = (x,y)
cursor = arcpy.da.InsertCursor(fc, fields)
print('Done! ... i=' + str(i))