We have several emergency operation layers that we want to clear out quickly before an event. We will use juniper to share it with our staff too. Thank you.
Solved! Go to Solution.
Thanks that worked perfectly for me, the only change I had to make was to change OBJECTID to OID because it was throwing up an error.
max_objid = flayer.query(out_statistics=[{"statisticType":"MAX","onStatisticField":"OID","outStatisticFieldName":"MAX_OBJ"}], return_geometry=False)
maxoid = max_objid.features[0].attributes['MAX_OBJ']
#delete in steps of 20000 or more, in case the dataset is large
i = 0
step = 20000
#replace maxoid with count if attempting to delete features based on feature count
while i <= maxoid:
i += step
flayer.delete_features(where=f"OID<= {i}")
print(i)
Cheers