Select to view content in your preferred language

ArcPy script to write same record in another feature layer

841
3
10-31-2020 06:45 PM
ShahriarRahman
New Contributor III

I am trying to add created records in one layer to another feature layer using ArcPy script. Is there any sample script to do so? Thanks in advance.

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Related... with unresolved questions in the post

Copying exact record in another feature class while creating the record in a feature class using Arc... 


... sort of retired...
0 Kudos
ShahriarRahman
New Contributor III

Hi @DanPatterson

I have come up with a solution to the task I wanted to accomplish, but the script is taking around 5 minutes to do perform the task(s). I need to minimise the time of processing, great to have your expert suggestion if I can reduce the processing time,

......................................................................

for m in aprx.listMaps():
    for layer in aprx.activeMap.listLayers():
      if(layer.name[0:12]=="CGD.PARCELS_" and layer.getSelectionSet()):
          arcpy.management.Append(layer, "BASEDATA", "NO_TEST")
          arcpy.SelectLayerByLocation_management("BASEDATA","ARE_IDENTICAL_TO",layer)

........................................................................

0 Kudos
DanPatterson
MVP Esteemed Contributor

Lots of "ifs" there.  

I would start with consolidating your data so you don't have to cycle through a number of layers that you know won't meet the conditions in the first place.

You don't indicate :

  • how big the files are,
  • where they are located (fgdb, SDE etc) and
  • how you are accessing them (local? network? remote?) and
  • your computer specs. 

In some cases directing to "memory" workspace helps Write geoprocessing output to memory 

Also, is 5 minutes really too long?  😉   (ie. is this a 911 or similiar application?)


... sort of retired...
0 Kudos