|
POST
|
This is my biggest gripe with Arcade: it treats null values as zero. To circumvent that, you have to manually check each value for null, for example like this: var values = [$feature.Lot_Cost,
$feature.Lot_Cost_,
$feature.Lot_Cost__,
]
var value_sum = 0
var value_count = 0
for(var i in values) {
if(values[i] != null) {
value_sum += values[i]
value_count ++
}
}
return value_sum / value_count Related idea (though I don't think this will be implemented): Arcade: Don't treat null as zero in mathematical f... - Esri Community
... View more
06-21-2022
08:27 AM
|
1
|
1
|
2141
|
|
POST
|
Yes. This script reverses the order of layout elements in the content pane and in the layout itself: layout = arcpy.mp.ArcGISProject("current").listLayouts()[0]
cim = layout.getDefinition('V2')
print([e.name for e in cim.elements]) # layout elements from bottom to top
#['Map Frame', 'Scale Bar', 'North Arrow', 'Map Frame 1', 'Table Frame']
cim.elements.reverse()
print([e.name for e in cim.elements])
#['Table Frame', 'Map Frame 1', 'North Arrow', 'Scale Bar', 'Map Frame']
layout.setDefinition(cim)
... View more
06-20-2022
11:36 PM
|
0
|
0
|
1422
|
|
IDEA
|
I agree that this can be quite limiting for labeling, but it probably won't be implemented any time soon (if ever) for performance reasons. Take a look at this idea in which they give more reasoning and a suggested workaround (Attribute Rules): Add Arcade Globals for Visualization/Symbology Exe... - Esri Community
... View more
06-20-2022
11:23 PM
|
0
|
0
|
1236
|
|
POST
|
From the down arrow in the tool parameter, it seems like you don't use the actual feature class, but the layer from the map. If you have a selection or definition query in that layer, most tools will only affect the selected rows. Drag&Drop the actual feature class from the database into the tool parameter (or use the folder button to browse to the feature class) and try again.
... View more
06-20-2022
06:21 AM
|
0
|
1
|
3580
|
|
POST
|
I hate that error so much... And it could have any number of reasons. Try a different approach: Calculate the field, switch language to Arcade, use the script below. Be sure to clear selections! var partner_oid = $feature.OBJECTID
if($feature.OBJECTID % 2 == 0) {
partner_oid -= 1
} else {
partner_oid += 1
}
var partner = First(Filter($featureset, "OBJECTID = @partner_oid"))
if(partner == null) { return null }
return Abs(partner.Z - $feature.Z)
... View more
06-20-2022
06:15 AM
|
1
|
1
|
2668
|
|
POST
|
It couldn't find OBJECTID 2. Clear all selections and try again. If it still doesn't work, you need the slightly more complicated script.
... View more
06-20-2022
12:57 AM
|
0
|
3
|
2682
|
|
POST
|
Open the Python window: Copy the script below, paste it into the Python window, edit the first line, run it fc_path_or_layer_name = "PointsWithZValues"
fields = ["OBJECTID", "Z", "Delta"]
z_dict = {r[0]: r[1] for r in arcpy.da.SearchCursor(fc_path_or_layer_name, fields)}
with arcpy.da.UpdateCursor(fc_path_or_layer_name, fields) as cursor:
for oid, z, delta in cursor:
# if OBJECTID is even, the partner oid is oid - 1
# if OBJECTID is odd, the partner id is oid + 1
partner_oid = oid + (-1 if oid % 2 == 0 else 1)
delta = abs(z - z_dict[partner_oid])
cursor.updateRow([oid, z, delta]) Here, I used DoubleField as Z and TextField as Delta: !!! The script assumes that your screenshot shows exactly what your table looks like, especially that the pairs are always odd and even ObjectID. If this isn't the case, the script gets a little more complicated (but not much) !!!
... View more
06-19-2022
10:46 PM
|
0
|
0
|
2689
|
|
POST
|
You will have to create an Arcade expression for that. Before: Create a label expression: "Einleitung " + $feature.OBJECTID + ": " + Round($feature.QErlaubt, 2) + " m³/s"
// or, with newer syntax:
`Einleitung ${$feature.ObjectID}: ${Round($feature.QErlaubt, 2)} m³/s` After: In Pro, it's the same. Before: After:
... View more
06-15-2022
11:39 PM
|
1
|
0
|
804
|
|
POST
|
AFAIK, it's not possible to change the manual editing workflow to "select one of the domain codes or type in your own value". But you can insert features with "wrong" values using Python (and probably Arcade, though I haven't tested that): with arcpy.da.InsertCursor("Table", ["Field"]) as cursor:
cursor.insertRow([5]) # Coded Value Domain [0, 1]
... View more
06-15-2022
11:05 PM
|
1
|
1
|
2065
|
|
POST
|
Hi, welcome to the ESRI community! There should be a border radius option in the style menu:
... View more
06-15-2022
10:48 PM
|
0
|
0
|
2988
|
|
POST
|
The ArcGIS Pro equivalent seems to be the Append tool. You can do field mapping there:
... View more
06-15-2022
10:23 PM
|
1
|
0
|
1194
|
|
POST
|
Also, it should be "esriFieldTypeString", not "esriFieldTypesString".
... View more
06-15-2022
02:15 AM
|
0
|
0
|
7962
|
|
POST
|
Your field declaration and the fields of your features have to match. name STMP2022F1Sp, SumF1Sp, F1Sp_Per SPECIES, SPArea, SPPer type according to the docs, there is no BigInteger, only Integer SPArea and SPPer are probably Double, so either use esriFieldTypeDouble or use Round(x, 0)
... View more
06-15-2022
02:13 AM
|
1
|
3
|
7962
|
|
POST
|
copy your feature class run the script below (change path to the copy) with arcpy.da.UpdateCursor("fc_path_or_layer_name", ["SHAPE@"]) as cursor:
for shp, in cursor:
new_path = shp[0][:2] # first part, first and second vertex
new_shp = arcpy.Polyline(new_path, spatial_reference=shp.spatialReference)
cursor.updateRow([new_shp])
... View more
06-15-2022
01:40 AM
|
2
|
0
|
2156
|
|
POST
|
Is there a way I could program my own script without too much effort? The most effortless way is running the tools manually, then going to the Geoprocessing history and copying the commands into a Python script: I found another way that might help you: Calculate the distance of your measured points to the transmitter. Generate buffers around the points, based on that distance. Get the intersection points of all the buffers In a perfect world without measuring uncertainties and without signal absorption in walls, all circles around your points with a radius of the calculated distance would intersect in a single point, the transmitter (and in many other points, but they would all have that common point). In our more imperfect world, the highest density of intersections should still be close to the transmitter. Create a heat map of the intersection points. Analyze that heat map like in my original answer. Just to show how you could create your own script, I'll run the tools manually and then copy/paste the Python commands from the history here. Note that I'm using memory paths for intermediate results. This means they are only stored in RAM and thus will be gone when I close ArcGIS. The advantage is that this way is much faster than saving on disk. My input data, area is ~ 250m x 250m, signal strength is calculated using the formulas from the links below plus a little noise. Calculate the distance of your measured points to the transmitter. In this thread and this wiki page, you can find formulas to convert signal strength to distance to the transmitter. arcpy.management.CalculateField("points", "Distance", "dist(!DoubleField!)", "PYTHON3", """def dist(fspl):
k = -27.55
f = 2413
pot = (fspl - k - 20 * math.log10(f)) / 20
return math.pow(10, pot)""", "TEXT", "NO_ENFORCE_DOMAINS") Create buffers around the points based on the calculated distance. arcpy.analysis.Buffer(r"memory\points", r"memory\circles", "Distance", "FULL", "ROUND", "NONE", None, "PLANAR") Intersect the buffers with themselves, specify point output. arcpy.analysis.Intersect(r"memory\circles #", r"memory\circle_intersections", "ALL", None, "POINT") Create a heat map of these intersections (Point Density). Play with the Output cell size and Neighbourhood parameters, they massively influence the result. out_raster = arcpy.sa.PointDensity("circle_intersections", "NONE", 1, "Circle 5 CELL", "SQUARE_METERS"); out_raster.save(r"memory\heatmap") The area with the most intersections of the buffers should be near the transmitter. Create Contour lines to find this area. arcpy.ddd.Contour("heatmap", r"memory\contours", 1, 0, 1, "CONTOUR", None) That's pretty busy. Let's zoom in. Slightly over 5m off, not too shabby! Let's create an ouput feature class (saved on disc), showing the most probable transmitter locations. # get the raster values as points
arcpy.conversion.RasterToPoint("heatmap", r"memory\raster_values", "Value")
# delete all points where grid_value != max(grid_value)
# it would be easier to use the arcpy.da.SearchCursor and UpdateCursor for this (or do it manually in the attribute table)
# but we're pretending we don't know Python and want to create a script, so let's do it with tools.
arcpy.management.CalculateField("raster_values", "IsMax", """if($feature.grid_code == 0) {
return 0
}
var max_grid_code = Max($featureset, "grid_code")
return $feature.grid_code == max_grid_code""", "ARCADE", '', "TEXT", "NO_ENFORCE_DOMAINS")
# 400k points take a really long time...
# 1/2 hour later: well, I'm going to use the Cursors...
# this is how you would procee with tools:
arcpy.management.SelectLayerByAttribute("raster_values", "NEW_SELECTION", "IsMax = '1'")
arcpy.management.DeleteFeatures("raster_values")
# And this is using cursors
grid_codes = [row[0] for row in arcpy.da.SearchCursor("memory/raster_values", ["grid_code"], "grid_code > 0")]
max_grid_code = max(grid_codes)
with arcpy.da.UpdateCursor("memory/raster_values", ["grid_code"], f"grid_code < {max_grid_code}") as cursor:
for row in cursor:
cursor.deleteRow()
# that took like 10 seconds...
# save the result on disc
save_path = "TransmitterLocations" # Save in the project's default gdb
arcpy.management.CopyFeatures(r"memory\raster_values", save_path)
... View more
06-14-2022
01:02 AM
|
1
|
1
|
2662
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-30-2023 09:57 AM | |
| 1 | 05-18-2023 12:51 AM | |
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|