|
POST
|
yes, thought the list() was retuning objects.. I've edited the code in my original reply which should work.
... View more
02-23-2020
04:14 AM
|
0
|
0
|
10844
|
|
POST
|
import os
import arcpy
#enter your fgb input and output paths here
file_gdb = r'your gdb to loop thru'
output_gdb = r'output gdb'
arcpy.env.workspace = file_gdb
datasets = arcpy.ListDatasets("", "Feature")
fd_path_list = [ ]
fd_name_dict = { }
for feature_dataset in datasets:
fd_path = os.path.join(file_gdb, feature_dataset)
fd_path_list.append(fd_path)
fd_name_dict[fd_path] = str(feature_dataset)
print(fd_name_dict)
for fd in fd_path_list:
fc_path_list_WD = [ ]
fc_path_list_WED = [ ]
arcpy.env.workspace = fd
featureclasses = arcpy.ListFeatureClasses()
for fc in featureclasses:
if "_WD" in fc:
fc_path = os.path.join(fd, fc)
fc_path_list_WD.append(fc_path)
if "_WED" in fc:
fc_path = os.path.join(fd, fc)
fc_path_list_WED.append(fc_path)
wd_path = os.path.join(output_gdb, fd_name_dict[fd])
print(fd_name_dict[fd])
wd_path = wd_path + "_WD"
print(wd_path)
if len(fc_path_list_WD) != 0:
try:
arcpy.Merge_management(fc_path_list_WD, wd_path)
except:
continue
wed_path = os.path.join(output_gdb, fd_name_dict[fd])
wed_path = wed_path + "_WED"
print(wed_path)
if len(fc_path_list_WED) != 0:
try:
arcpy.Merge_management(fc_path_list_WED, wed_path)
except:
continue
del fc_path_list_WD
del fc_path_list_WED
print("done")
... View more
02-22-2020
03:42 PM
|
4
|
4
|
10843
|
|
POST
|
Yes but I need to know what the target shapefiles look like
... View more
02-22-2020
03:00 PM
|
0
|
1
|
10844
|
|
POST
|
The only thing is the spatial join. What are the shapefiles and how are they structured? I'll need to define this in the code
... View more
02-22-2020
02:29 PM
|
0
|
1
|
10843
|
|
POST
|
If you want those as a script it should be pretty easy and I'm happy to help, though I understand that might not be the point. I'm happy to admit my knowledge of model builder is limited!
... View more
02-22-2020
02:05 PM
|
0
|
3
|
10843
|
|
POST
|
Do you mean different types of retail attribute will contribute more to the density? Or separate densities for each type of retail?
... View more
02-22-2020
11:54 AM
|
0
|
8
|
2678
|
|
POST
|
Hi, completely unsure of the reason but a quick fix in field calculator would be: set it to python on the radio button and click 'show codeblock' put this in the pre-logic script code : def curly(field):
field = field.replace("{","")
field = field.replace("}","")
return field then type into the codeblock at the bottom (below 'my field =') curly(the name of your field enclosed within ! !) e.g. curly(!GUID!)
... View more
02-22-2020
08:17 AM
|
0
|
0
|
4201
|
|
POST
|
More info please. Is this for a home range? If you can give a full picture of the inputs, process and outputs.
... View more
02-22-2020
04:43 AM
|
0
|
2
|
2095
|
|
POST
|
Jeremy, nice one. Why I tried to edit the dictionary comprehension i dont know. I'm sticking to iterators! I think that may mislead others with incorrect solutions, but thanks anyway. Theres a points system??
... View more
02-21-2020
01:53 PM
|
0
|
0
|
2070
|
|
POST
|
Wifi down so back to phone. The last line in my previous should be cursor.updateRow(row)
... View more
02-21-2020
12:58 PM
|
1
|
0
|
4088
|
|
POST
|
I can't see why it's doing that. Could you show the prints or resend the feature as it wouldnt open in arc
... View more
02-21-2020
12:18 PM
|
0
|
2
|
4088
|
|
POST
|
import arcpy
inFC = #path toExample.gdb\Lines
inFields = ['ID', 'SHAPE@', "Shape_Length"]
valueDict = {r[0]:r[1] if int(r[2])!= 0 for r in arcpy.da.SearchCursor(inFC, inFields)}
print(valueDict)
with arcpy.da.UpdateCursor(inFC, inFields) as cursor:
for row in cursor:
row[1] = valueDict[row[0]]
print(row[1])
row.updateRow(row) my dictionary comprehension might be wrong, I always get confused doing them. the rest miiiight work..
... View more
02-21-2020
11:07 AM
|
1
|
4
|
4088
|
|
POST
|
Are you saying the problem is its failing on the second iteration? What's the full error? Can you print the tin filepath if that's what's erroring? Why do you need the time.sleep?
... View more
02-21-2020
10:31 AM
|
0
|
0
|
1389
|
|
POST
|
Yep I'd recommend that. Let me know if you need a hand with the script. I thought you meant a related table 'joins and relates'.
... View more
02-21-2020
09:28 AM
|
0
|
6
|
4088
|
|
POST
|
#Create an empty list of ArcMap documents to process...
mxd_list=[ ]
directory = r'#your filespace to find mxds in#'
for root, dirs, files in os.walk(directory):
for file in files:
if ".mxd" in file:
mxd_path = os.path.join(root, file)
mxd_list.append(mxd_path)
... View more
02-21-2020
07:55 AM
|
1
|
1
|
3761
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-13-2025 01:08 PM | |
| 1 | 09-25-2025 03:19 PM | |
| 1 | 09-24-2025 02:35 PM | |
| 1 | 09-17-2025 02:42 PM | |
| 1 | 09-10-2025 02:35 PM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|