|
POST
|
Nearly there, but you need to pass in 2 arguments. #prelogic codeblock
def Reclass(arg1, arg2):
if arg1 in ["222", "333"]:
return "<Null>"
else:
return arg2
#code
Reclass(!NAME!, !PNAME!)
... View more
03-22-2020
06:57 AM
|
1
|
1
|
1357
|
|
POST
|
import arcpy
#from arcpy import env
#i prefer to be explicit in module use
#use raw formatting
arcpy.env.workspace = r"C:/EsriPress/Python/Data/Exercise07"
#lower case
#is this in the workspace? if not use a full path
fc = "airports.shp"
#arcpy.da.searchcursor is best
#rows = arcpy.SearchCursor(fc)
#fields = arcpy.ListFields(fc)
#for field in fields:
#if fields.name == "NAME"
#for row in rows:
#print "Name = {0}".format(row.getValue(field.name))
try:
with arcpy.da.SearchCusor(fc, "NAME") as cursor:
for row in cursor:
print("Name = " + row)
except:
print("No field 'NAME' found")
break
... View more
03-21-2020
11:07 AM
|
1
|
0
|
1968
|
|
POST
|
I would read all of the geometries into 2 dictionaries then run a nested for loop to grab the OIDs which match (geometry.distanceTo <=1600 etc.) then a search and update cursor to concatenate and append the string.
... View more
03-21-2020
05:16 AM
|
0
|
0
|
794
|
|
POST
|
Hi Brandon. I can't think of any possible workaround. perhaps you could use the spare time to do an esri MOOC? https://www.esri.com/training/mooc/ although you will have to download Pro and will be provided with a license for the course duration.
... View more
03-20-2020
01:00 PM
|
0
|
0
|
1428
|
|
POST
|
import arcpy
input_table = r'C:\'
#create a list of unique names
#a set has no duplicates
abbr_name_list = []
with arcpy.da.SearchCursor(input_table, "ABBR_NAME") as cursor:
for row in cursor:
abbr_name_list.append(row[0])
abbr_name_set = set(abbr_name_list)
#make a list of ABBR_NAMEs in the set along with the cell IDs
abbr_name_cell_id_list = []
for abbr_name in abbr_name_set:
cell_id_list = []
with arcpy.da.SearchCursor(input_table, ["ABBR_NAME", "CELL_ID"]) as cursor:
cell_id_list = []
for row in cursor:
if abbr_name == row[0]:
cell_id_list.append(row[1])
if len(cell_id_list) != 0:
cell_id_string = str(cell_id_list)
cell_id_string = cell_id_string.replace("u","")
cell_id_string = cell_id_string.replace("[","")
cell_id_string = cell_id_string.replace("]","")
cell_id_string = cell_id_string.replace("'","")
cell_id_string = cell_id_string.replace(" ","")
item = (abbr_name + "-" + cell_id_string)
abbr_name_cell_id_list.append(item)
for x in abbr_name_cell_id_list:
with arcpy.da.UpdateCursor(input_table, ["ABBR_NAME", "GridIndex"]) as cursor:
for row in cursor:
if str((x.split("-"))[0]) == str(row[0]):
row[1] = (x.split("-"))[0] + " - " + (x.split("-"))[1]
cursor.updateRow(row)
... View more
03-20-2020
09:24 AM
|
0
|
0
|
1806
|
|
POST
|
a spatial relate would be nice, someone please make that btw Maybe your script could select only new features to run the join on, i.e hold a text file somewhere which references the most recent object id, select those greater than it then run the join and replace the oid in the text file.
... View more
03-20-2020
04:38 AM
|
0
|
1
|
1119
|
|
POST
|
do you have multiple instances of the table open? close down all your ArcGIS applications and open up a fresh mxd then retry.
... View more
03-20-2020
03:45 AM
|
0
|
0
|
1357
|
|
POST
|
Hi, try adding an else statement to handle the bulk of the values which don't meet the condition. def Reclass(arg):
if arcg.endswith(""):
return "3"
else:
return arg
... View more
03-20-2020
03:18 AM
|
0
|
0
|
1357
|
|
POST
|
Hey you're very welcome Johnny. Two final points: 1. dependant on the buffer distance you may want to consider a "GEODESIC" buffer to preserve true distance. 2. Buffering country sized polyline data is extreeeeeemely processing intensive
... View more
03-19-2020
01:22 PM
|
1
|
1
|
500
|
|
POST
|
of course, I should have noticed this. fcs is just a list of the string names of the feature classes/shapefiles in that workspace. simply join the workspace path to fc in fcs to give a full filepath for fc in fcs: fc_path = os.path.join(arcpy.env.workspace, fc)
... View more
03-19-2020
12:34 PM
|
0
|
3
|
2668
|
|
POST
|
sorry I forgot the .shp extension. for fc in fcs: output_path = fc[:-4] + "_buff.shp" or as Joshua says: for fc in fcs: output_path = os.path.join(fc[:4], "buff.shp") or even better as Joshua says, save it as a feature class.
... View more
03-19-2020
11:50 AM
|
0
|
5
|
2668
|
|
POST
|
currently you're trying to add "buff" to something with a .shp extension I guess? for fc in fcs: output_path = fc[:-4] + "_buff"
... View more
03-19-2020
11:35 AM
|
0
|
7
|
2668
|
|
POST
|
The easiest way is to symbolise the data in the classes you need, then drag that layer into the Reclassify tool, which should add those break values for you to change. here is the difference between geoid and ellipsoid it can be recoded by the Reclassify tool
... View more
03-19-2020
05:51 AM
|
0
|
2
|
1666
|
|
POST
|
Check the geometry of your input and repair if necessary. Check the transformation is being populated with hungarian1972 to wgs84, also check the environments output coordinate system and processing extent, as ArcMap loves to randomly add a transformation.
... View more
03-19-2020
05:23 AM
|
0
|
4
|
3567
|
|
POST
|
Dan is correct in how to convert this, however this may also be a mis-understanding of the percentage slope. This is rise/run *100, meaning a 100% slope is 45 degrees, and a 330% slope is 73 degrees.
... View more
03-19-2020
04:49 AM
|
0
|
1
|
1666
|
| 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 |
01-14-2026
12:10 PM
|