|
POST
|
Census tract codes are text fields, so your syntax would work. However, your code gets the last four numbers. To get the first 4 numbers you can use the Left function, or in python use the slice expression [:4].
... View more
04-28-2022
07:37 AM
|
0
|
15
|
6732
|
|
POST
|
I would start with the Solar Radiation Toolset. If you already are looking at this, I don't understand what you want, a layer for every hour, every day, for a year (365 x 24 layers?). This could be done by iterating the tools I guess in ModelBuidler or Python, but that could take a while.
... View more
04-28-2022
07:33 AM
|
0
|
2
|
1879
|
|
POST
|
This can't be done in ModelBuilder tools, but you can use the Calculate Value tool like this in ModelBuilder. Expression: proc(r"C:\users\me\my.gdb", r"C:\users\me\my.csv") Code Block: def get_gdb_feature_count(gdb_path):
# set workspace to gdb
prev_ws = arcpy.env.workspace
arcpy.env.workspace = gdb_path
# list all feature classes and tables in workspace
fcs_and_tbls = arcpy.ListFeatureClasses() + arcpy.ListTables()
# GetCount() on all of these
counts = [int(arcpy.management.GetCount(ft)[0]) for ft in fcs_and_tbls]
# revert workspace
arcpy.env.workspace = prev_ws
# return [ ["TableName", count] ]
return zip(fcs_and_tbls, counts)
def proc(gdb, csv_path):
result = get_gdb_feature_count(gdb)
with open(csv_path, "w") as f:
f.write("Name,Count\n")
for r in result:
f.write(f"{r[0]},{r[1]}\n")
... View more
04-28-2022
06:45 AM
|
0
|
0
|
2482
|
|
POST
|
Hi Dan. Here's my fix Field Name: %Value%_Slope_Type Expression: reclass(!%Value%_Slope!) (I am assuming this is a field name (of a numeric field in your table, since you are doing a numeric comparison in your code block) Code Block: (unlike label expressions you must use a local variable here. Make sure you handle the 0 or None [null] case) def reclass(vs):
if vs < 0:
return 1
elif vs > 0:
return 2
else:
return 0 The error message (ERROR 000013: N_Slope_Type already in N_Sample_Lines) may reflect that first time @KedaravindanBhaskar ran the model the field N_Slope_Type didn't exist yet, so the field existed already from then on but ModelBuilder didn't know it so tried to add it hence the error. The Calculate Field tool has the capability of creating a field as it runs, but because of ModelBuilder validation issues I do not use this feature as it may work the first time but not in future iterations because of validation confusion (the validation tells GP the field does not exist but in iteration two or another run, it exists!) (I think this was a bad design decision, but I'm sure they had their reasons.) When I am creating a new field I run the Add Field tool first (in your case adding the field %Value%_Slope_Type) because if the field exists, Add Field just passes a warning and moves on. Hope this helps.
... View more
04-28-2022
06:17 AM
|
2
|
1
|
2121
|
|
POST
|
I would look for funky field names in either table. How To Name Things In ArcGIS You also may want to try copying the .csv to a file geodatabase and then doing the update. If the table is relatively small, you can even copy it to the memory workspace (fast!). Of course @DanPatterson would say - load the tables into numpy and do it there (faster). I also like Kim's idea of formatting data in Excel and loading from there to enforce data type. .csv files can be a real pain.
... View more
04-20-2022
04:56 PM
|
0
|
0
|
4507
|
|
BLOG
|
This policy may not support our use cases, even though we are no longer teaching ArcMap in our introductory GIS courses. We have research users and instructors that use software like HEC_GeoRAS and SWAT that use ArcMap (some even old versions) - that is, add-ons that do not work with Pro and will not be ported there. Are you saying we won't be able to support these people starting next January? I teach workshops to local cities and counties that are still using ArcMap for parcel mapping. Am I not going to be able to support these people either. There is no linear referencing course in the Esri Academy yet. So my students have been learning ArcMap (easy if you know Pro) to do that class. This had the added benefit that they know a little ArcMap when they go out and get jobs (ArcMap is still used widely in industry for many reasons.)
... View more
04-20-2022
03:14 PM
|
1
|
0
|
1751
|
|
BLOG
|
Just so you know, in my lectures, Arc/INFO (my favorite old-school spelling since INFO was its own application - Henco, Inc!) is brought in the context of the development of GIS, linking geographic tools with an RDBMS to solve spatial analysis problems. AML Forever!
... View more
04-19-2022
09:15 AM
|
0
|
0
|
1069
|
|
POST
|
There is a windows mouse settings of number of lines to scroll, but it only turns down to 1 line. Tweaking it is worth a try.
... View more
04-18-2022
08:41 PM
|
1
|
0
|
3927
|
|
BLOG
|
I talk about ARC - INFO. The "Arc" is the geometry and the "info" is the RDBMS part and what makes GIS, GIS is the use of the two together. Old school.
... View more
04-18-2022
08:33 PM
|
1
|
0
|
1085
|
|
POST
|
I'm guessing the zone field values in the dissolved shapefile were not integer.
... View more
04-18-2022
08:30 PM
|
0
|
0
|
4113
|
|
POST
|
I agree with Dan - but honestly when you purchased your license you got no instructions at all on how to set things up? I'm guessing they set you up with an ArcGIS Online instance with a single named user that you log into to access ArcGIS Pro. The personal use license should give you access to all of Pro and many extensions.
... View more
04-18-2022
07:02 PM
|
0
|
1
|
1990
|
|
POST
|
The question was specifically for ModelBuilder so I think this is exactly the right place! You can use python modules in ModelBuilder using a python function inside the Calculate Value tool. So time.sleep() is probably your go-to here. Connect this Calculate Value output as a precondition to your tool call so it will have to run before your tool that gets the data runs. Expression: wait(60) Code block: import time
def wait(sec):
time.sleep(sec)
return 1
... View more
04-13-2022
11:57 AM
|
1
|
0
|
1470
|
|
POST
|
Ah, I should have started with k=0 for the first example (I will fix that for the good of the thread) You can assign text, but you need to make sure the value you are assigning to a text type field is text. Python handles data types for you. You do know that assigning latitude will not set the point location, right? You'd have to use the shape field to do that (kind of advanced stuff).
... View more
03-30-2022
01:26 PM
|
1
|
0
|
1920
|
|
POST
|
I don't understand row[1] as you only have one field so row will only have one element row[0]. If you are trying to populate the 12 values on row at a time (assuming they come out in order, which isn't guaranteed, depending on data source) I think this is the pattern you want: with arcpy.da.UpdateCursor(fc2, field2) as rows:
k = 1
for row in rows:
row[0] = LatY[k]
rows.updateRow(row)
k += 1 If order becomes a problem you can use the ID field: with arcpy.da.UpdateCursor(fc2, ["ID", "Latitude"]) as rows:
for row in rows:
row[1] = LatY[row[0] - 1] # index 0 to 11 (IDs are 1 to 12)
rows.updateRow(row) One more issue, your latitude field must be FLOAT or DOUBLE not LONG (LONG will truncate all data to integer when you assign it to the field!)
... View more
03-30-2022
11:51 AM
|
1
|
2
|
1959
|
|
POST
|
I suggest pausing OneDrive syncing while you are working in Pro. The Esri tech support article linked up thread is pretty clear you can easily corrupt a project or geodatabase by running Pro with cloud synching active, so you should always avoid these folders (including using synched folders as temp!) - or pause sync while you are working.
... View more
03-30-2022
10:15 AM
|
1
|
0
|
6477
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|