I know the ROUTENAME issue has been addressed many times in these forums over the past couple years. I have scoured them and am hung up on one point.
In the shortest distance thread it is stated that "You might have to load multiple copies of the same park because multiple people use the same park." In my case, these are facilities.
In the Re: Finding Distances Between Assigned Locations thread it is stated that "...your 368 locations are repeating. You could do this with some relates...", but there is not direction on how to use relates to generate repeated "locations."
I need to figure out how to make hundreds of duplicate copies of the same facility. Once duplicated, I will then give each one of the hundreds of copies of the same facility a unique ID. Then I can match the facility to the thousands of users of it using ROUTENAME.
It is just duplicating the facility that is hanging me up. Please help. Thanks.
This is EXACTLY what I need to do. I have never used Python script before, but I've invested no less than 8 hours trying to use the "Copy features..." code you provided. Using Geoprocessing=>Python does not work. Lots of >>> and ... symbols that appear to be present in some codes (such as above), but not in yours.
I also created a .py file with the code, created a toolbox, and used the script wizard in an attempt to run it as well. No luck. Of course, I adapted your code to my own file location paths. That is where it goes wrong early on. A lot of red text results make the claim that the files do not exist even though I have confirmed many times that they do.
I would love to run this script if you think you can guide me through getting it running without burdening yourself too much.
Thank you.
This is the code that eventually worked. The one in the Copy features a number of times based on a numeric field value thread did not
def main():
import arcpy
import os
fc_in = r"C:\Users\ccoutts\Desktop\Props\CRC_MultiGRant\Map1\Facilities1.shp" # this one exists
fld_count = "obs"
fc_out = r"C:\Users\ccoutts\Desktop\Props\CRC_MultiGRant\Map1\Facilities2.shp" # this one will be created
sr = arcpy.Describe(fc_in).spatialReference
# create the empty output featureclass
path, name = os.path.split(fc_out)
arcpy.CreateFeatureclass_management(path, name, "POINT", fc_in, "SAME_AS_TEMPLATE", "SAME_AS_TEMPLATE", sr)
# insert the features into the output fc
with arcpy.da.SearchCursor(fc_in, '*') as curs_in:
flds_in = curs_in.fields
idx_cnt = flds_in.index(fld_count)
with arcpy.da.InsertCursor(fc_out, '*') as curs_out:
for row in curs_in:
cnt = row[idx_cnt]
for i in range(0, cnt):
curs_out.insertRow(row)
main()