|
POST
|
Adding on to this, you can use an Arcade expression to smash several fields into one, I've found this just as easy to create and maintain as standard 2 or 3-field symbology.
... View more
02-25-2025
03:09 PM
|
1
|
1
|
3458
|
|
POST
|
Give your script a "main" function (call it whatever you like) that takes in parameters in their final form, then feed it processed parameters behind a main guard. For example: import arcpy
CODE_MAP = {
"North": "N",
"South": "S",
"Other Code": "Other"
}
def main(code: str):
arcpy.AddMessage(f"The code is: {code}".)
if __name__ == "__main__":
full_code = arcpy.GetParameterAsText(0)
short_code = CODE_MAP.get(full_code, "N/A")
main(short_code) This pattern has other advantages, like making it easy to call the function without a script tool wrapper, write tests, and so on.
... View more
02-25-2025
02:23 PM
|
3
|
3
|
2021
|
|
POST
|
Without access to some data I can't say for sure what's going on here. That said, using early returns with else/if chains is an odd coding pattern, you usually either do early return like this: def AdjustFCV(PropType,Land,Imp):
homestead = ("500","501","502")
if Land == "NULL" or Imp == "NULL":
return 0
if PropType == "Vacant Land" and Imp in homestead and Land not in homestead:
return Land
if Land in homestead or Imp in homestead:
return 0
return Land Or use a return value like this: def AdjustFCV(PropType,Land,Imp):
homestead = ("500","501","502")
retval = Land
if Land == "NULL" or Imp == "NULL":
retval = 0
elif PropType == "Vacant Land" and Imp in homestead and Land not in homestead:
retval = Land
elif Land in homestead or Imp in homestead:
retval = 0
return retval I know this doesn't answer why the code isn't behaving right but you should have another working code block at the very least. One last thing: does your data store null values as the string value "NULL"? If not, you'll want to compare your data to the None object, otherwise you won't catch those nulls. Here's that one line adjusted to check for nulls: if Land is None or Imp is None:
... View more
02-24-2025
05:46 PM
|
0
|
1
|
3594
|
|
POST
|
Survey123 will always fall apart if you have duplicate field names, even if those fields are ultimately mapped to disjoint tables. I like to add a small prefix to the fields in repeats (like "e_" for the equipment repeat) to avoid collisions I think that should work in your case as well.
... View more
02-24-2025
03:46 PM
|
1
|
0
|
991
|
|
POST
|
The polyline feature class was Z-enabled but the Polyline object to insert into the feature class was not, this is what I corrected on line 17 of my listing.
... View more
02-19-2025
11:40 AM
|
1
|
0
|
2722
|
|
POST
|
You need to specify that your Polyline object is Z enabled, even if you pass in three dimensional points. This is because the third dimension could be Z values or M values. I've also added a spatial reference where necessary. Please see this corrected excerpt of your code: sr = arcpy.SpatialReference(6679)
# Create a polyline feature class
feature_class_name_polyline = "counties_polyline"
arcpy.CreateFeatureclass_management(
out_path=gdb_full_path,
out_name=feature_class_name_polyline,
geometry_type="POLYLINE",
has_z="ENABLED", # Enable Z values
spatial_reference=sr
)
# Create polyline geometry with Z values
array_polyline = arcpy.Array([arcpy.Point(1000.0, 2000.0, 50.0),
arcpy.Point(1500.0, 2500.0, 75.0),
arcpy.Point(2000.0, 3000.0, 100.0)])
polyline = arcpy.Polyline(array_polyline, has_z=True, spatial_reference=sr)
# InsertCursor to add new polyline geometry
with arcpy.da.InsertCursor(os.path.join(gdb_full_path, feature_class_name_polyline), ['SHAPE@']) as cursor:
cursor.insertRow([polyline])
... View more
02-19-2025
09:48 AM
|
1
|
2
|
2728
|
|
BLOG
|
If you have a more regular set of nested data you can also one line it with a comprehension: z =[[[1, 2], [3, 4]]]
// We can use this generalized form for flattening a list
// where n is the amount of nesting
// and a starts at 0 but increases by 1 every loop
// start = [$0 for $n in z
// while a < n:
// start += for $n-(a+1) in $n-a
// a + 1
// return start + ]
// concrete example for z, which has 2 levels of nesting
[a for c in z for b in c for a in b]
... View more
02-19-2025
09:31 AM
|
1
|
0
|
1236
|
|
POST
|
The last item in the field list for FeatureSetByPortalItem is a boolean value, not a field name. I think you mistyped the return geometry parameter, the fixed line is: var fs = FeatureSetByPortalItem(
fsportal,
"dfc071575e924d5d88cb851eab914222",
0, [
"Total_Daily_Cases",
"Hispanic_or_Latino",
"Not_Hispanic_or_Latino",
"Unknown_Ethnicity",
"Ethnicity_Not_Reported",
"Black_or_African_American",
"White_Race",
"Other_Race",
"Native_Hawaiian_or_Other_Pacific_Islander_Race",
"Asian_Race",
"American_Indian_or_Alaskan_Native_Race",
"Unknown_Race",
"Race_Not_Reported",
"Unknown_Age_Group",
"00_17_Age_Group",
"18_29_Age_Group",
"30_39_Age_Group",
"40_49_Age_Group",
"50_64_Age_Group",
"65_74_Age_Group",
"75__Age_Group",
"Year"
],
false
);
... View more
02-19-2025
08:26 AM
|
2
|
1
|
1910
|
|
POST
|
Couple of options off the top of my head, depending on what you want the output to look like: Run Minimum Bounding Geometry with a convex hull and then buffer those results. Feed the buffer in Union with "Gaps Allowed" unchecked and then into Dissolve.
... View more
02-13-2025
01:21 PM
|
0
|
1
|
1415
|
|
POST
|
Even if you're able to get that Other value into the Rank question, you have to deal with sanitizing the answer so that it's a valid identifier and it'll most likely break the rank display when viewed online. You're best off leaving that rank choice as "Other" and using the "choice_filter" column to only show "Other" if there's a valid answer — you can use this blog post as a reference. For the future you can plead your case in this idea and maybe something will happen.
... View more
02-13-2025
10:50 AM
|
0
|
1
|
1292
|
|
IDEA
|
I agree that join performance in Pro should be re-evaluated, our team noticed such a drastic reduction in performance moving from Map to Pro that we now treat joins as a punishment for anyone who can't write Python scripts rather than a core ArcGIS function. We also use EGDBs extensively so I'd argue that's the best place to start looking for regressions.
... View more
02-13-2025
08:34 AM
|
0
|
0
|
1358
|
|
POST
|
Signature questions are just images with a special interface. You can't get text data out of them and they require a feature layer with attachments enabled as that's where the image is stored. If you need a name with the signature you'll have to make another text question in your form.
... View more
02-11-2025
02:09 PM
|
0
|
0
|
1060
|
|
POST
|
Going just off your description: select all stormwater inlets that intersect the SinkDA polygons, then select all SinkPoly polygons that intersect the previous selection. Only the inlets that hit a SinkDA will be selected first, so any SinkPoly selected next must be one that shares an inlet with a SinkDA.
... View more
02-10-2025
11:34 AM
|
1
|
1
|
951
|
|
IDEA
|
This would be a fantastic addition, our team occasionally has projects where many line features run tightly parallel and it can be tough to keep each feature's popup title distinct, especially when it's impossible to test the final output without saving the map, refreshing Field Maps etc. etc.. Adding a word wrap option in the designer would be fantastic; letting tablet users resize the feature selection pane would also be nice. As a workaround, updating the symbology so that more info is captured in the polygons themselves might help here. Just eyeballing the example above, the plant species could be used as the fill color or perhaps a point fill symbol per species. That would leave plenty of room for the polygon tag.
... View more
02-06-2025
11:22 AM
|
0
|
0
|
2257
|
|
POST
|
If the subsequent questions are identical then a select_one communities with a matching choice list is all you need. Each survey feature will have that community logged so you can aggregate and pivot easily. If there's differences in the questions based on the community, then things get tricky. If it's the same field set but different choices/constraints/etc. then you can use tools like cascading selects or conditional statements in constraints (e.g. . < if(${community} = 'San Francisco', 80, 40)). If the fields change between communities this will make the analysis more difficult as each community has to be treated differently but this is easy to do in the survey form, just use a condition in the relevant column to only show the correct fields for each community.
... View more
02-06-2025
11:06 AM
|
1
|
0
|
691
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 07-16-2026 11:42 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|