|
POST
|
Field names of joined tables have to be called using bracket notation. The resulting Arcade expression should look like this: $feature["TableName.FieldName"]
... View more
07-05-2022
01:02 AM
|
2
|
0
|
1314
|
|
POST
|
Some of our features have links to our document management system. The links look like this: vis://93BECD56-7B0A-4442-B935-2DC2AB7C0EA8/1/309892 I can configure my browser to open these links in the corresponding software. But when I click on them in a popup of a web map, they get replaced with the web map's url, wich just opens the current web map in a new tab. I guess ArcGIS detects these links as wrong or dangerous and changes them. This behavior is consistent between different web environments (Enterprise Portal 10.9.1, AGOL) different browsers(Edge, Firefox) Map Viewer and Map Viewer Classic (How) can I stop ArcGIS from replacing those links?
... View more
07-04-2022
11:59 PM
|
3
|
0
|
686
|
|
POST
|
You should be able to press the middle mouse button / mouse wheel to pan the map.
... View more
07-04-2022
10:43 PM
|
0
|
0
|
1333
|
|
POST
|
def analyze_connections(area_fc, line_fc, area_id_field, line_id_field):
"""Analyzes how areas are connected by lines.
area_fc: str, layer name or path of the areas (polygons)
line_fc: str, layer name or path of the lines (polylines)
area_id_field: str, uniqe identifier of the areas
line_id_field: str, unique identifier of the lines
Returns a dict of dicts, specifiying the areas and the count of direct connections to other areas
"""
areas = [row for row in arcpy.da.SearchCursor(area_fc, ["SHAPE@", area_id_field])]
lines = [row for row in arcpy.da.SearchCursor(line_fc, ["SHAPE@", line_id_field])]
areas_on_line = {line[1]: [area[1] for area in areas if not line[0].disjoint(area[0])] for line in lines}
areas = [area[1] for area in areas]
area_connections = dict()
for area in areas:
area_connections[area] = dict()
for other_area in areas:
connections = 0
for l, a in areas_on_line.items():
if area != other_area:
if area in a and other_area in a:
connections += 1
area_connections[area][other_area] = connections
return area_connections
def compare_connections(old, new):
"""Compares two connection dictionaries (eg output of analyze_connections).
old: dict of dicts, the old connections
new: dict of dicts, the new connections
Returns a dict of dicts, specifying the difference between the connection counts of old and new connections.
"""
areas = sorted(list(old.keys()))
diff = dict()
for area in areas:
diff[area] = dict()
for other_area in areas:
diff[area][other_area] = new[area][other_area] - old[area][other_area]
return diff
def print_adjacency_matrix(connections):
"""Takes a dict of dicts (eg output of analyze_connections) and prints
a 2D matrix.
""""
areas = sorted(list(connections.keys()))
rows = [[connections[area][other_area] for other_area in areas] for area in areas]
for i, row in enumerate(rows):
rows[i] = "\t".join([areas[i]] + [str(r) for r in row])
rows.insert(0, "\t".join([""] + areas))
print("\n".join(rows)) old_connections = analyze_connections("TestPolygons", "TestLines", "TextField", "TextField")
print_adjacency_matrix(old_connections)
# A B C D
#A 0 1 0 1
#B 1 0 2 2
#C 0 2 0 1
#D 1 2 1 0
new_connections = analyze_connections("TestPolygons", "TestLines", "TextField", "TextField")
print_adjacency_matrix(new_connections)
# A B C D
#A 0 0 1 0
#B 0 0 1 0
#C 1 1 0 1
#D 0 0 1 0
difference = compare_connections(old_connections, new_connections)
print_adjacency_matrix(difference)
# A B C D
#A 0 -1 1 -1
#B -1 0 -1 -2
#C 1 -1 0 0
#D -1 -2 0 0
... View more
07-04-2022
03:02 AM
|
1
|
0
|
2424
|
|
POST
|
arcpy.env.workspace = r"C:\gdblocation"
fcList = arcpy.ListFeatureClasses("*")
for fc in fcList:
print(fc)
fields = arcpy.ListFields(fc)
field_names = [f.name for f in fields]
null_counts = {fn: 0 for fn in field_names}
with arcpy.da.SearchCursor(fc, field_names) as cursor:
for row in cursor:
for i, v in enumerate(row):
if v is None:
null_counts[field_names[i]] += 1
for field in fields:
print("{0},{1},{2},{3}".format(field.name, field.type, field.length, field.domain, null_counts[field.name]))
... View more
07-03-2022
11:16 PM
|
2
|
1
|
3750
|
|
POST
|
var gasworks = FeaturesetByName(...)
var gasworks_in_state = Intersects($feature, gasworks)
var landfills = FeaturesetByName(...)
var landfills_in_state = Intersects($feature, landfills)
var waste = FeaturesetByName(...)
var waste_in_state = Intersects($feature, waste)
var point_counts = [
`gasworks: ${Count(gasworks_in_state)}`,
`landfills: ${Count(landfills_in_state)}`,
`waste: ${Count(waste_in_state)}`,
]
return Concatenate(point_counts, TextFormatting.Newline)
... View more
07-03-2022
10:26 PM
|
0
|
1
|
1469
|
|
POST
|
I havent' found a way to do this without data. I think the best (only?) way to do this is to create a dummy feature for each of the types you expect, configure the symbols, then delete the dummy features.
... View more
07-01-2022
02:36 AM
|
1
|
0
|
2177
|
|
IDEA
|
Does List By Datasorce cover that? JohannesLindner_0-1656585191959.png
... View more
06-30-2022
03:37 AM
|
0
|
0
|
1043
|
|
POST
|
I do not understand why the index calculated for the reference or the maximum is 1000... It should be 999. When you use Max_X as GPS_X input, dx will be equal to nc*CellsizeX, which would be 1000. index_x = dx/CellsizeX will still be 1000. See lines 16, 22, and 25 in your code, analogous for dy. Does anybody have an idea about how to fix this problem ? The root of the problem are lines 16 and 17. Here, you're telling Python that your raster has 1001 rows/columns: the start row + 1000 rows after that. This should fix it: Max_x = Ref_X + (nc - 1) * CellsizeX
... View more
06-30-2022
02:56 AM
|
0
|
0
|
2232
|
|
POST
|
You're almost there. The last step is to determine whether the date you calculated is before or after today: var startDate = $feature["EFFECTIVE_DT"];
var sixyears = DateAdd(startDate,6, 'years')
return sixyears < Today() This will return true for permits that passed the moratorium date, false for active permits. JohannesLindner_0-1656578743535.png Then you can change the legend labels: JohannesLindner_1-1656578785670.png And that's it. JohannesLindner_2-1656578852149.png
... View more
06-30-2022
01:49 AM
|
0
|
0
|
1529
|
|
POST
|
OK, time to check your service. Take a look at these articles: https://pro.arcgis.com/en/pro-app/2.8/help/data/geodatabases/overview/calculation-attribute-rules.htm https://pro.arcgis.com/en/pro-app/2.8/help/data/geodatabases/overview/share-datasets-with-attribute-rules.htm#ESRI_SECTION1_350657B6EC564DF3ACAF62A10C60C5FB Your service has to have the "Validation" option checked. It has to be a feature service. All data has to be branch versioned. The connected geodatabase has to be in branch versioned mode (gdb connection properties) The connected gdb user has to be the data owner.
... View more
06-29-2022
12:58 PM
|
0
|
0
|
12745
|
|
POST
|
Cursors do take quite some time, so you should minimize them. You only need to instantiate a cursor 3 times: read the zones read the provinces update the zones You can do everything else without cursors: # [ [Zones.OBJECTID, Zones.Shape] ]
zones = [ [oid, shp] for oid, shp in arcpy.da.SearchCursor("Zones", ["OBJECTID", "SHAPE@"])]
# [ [Provinces.Name, Provinces.Shape] ]
provinces = [ [name, shp] for name, shp in arcpy.da.SearchCursor("Provinces", ["Name", "SHAPE@"])]
# {Zones.OBJECTID: Zones.ProvinceNames}
zone_dict = dict()
for z_oid, z_shp in zones:
p_names = [p_name for p_name, p_shp in provinces if z_shp.overlaps(p_shp)]
zone_dict[z_oid] = ", ".join(p_names)
with arcpy.da.UpdateCursor("Zones", ["OBJECTID", "ProvinceNames"]) as cursor:
for oid, names in cursor:
try:
names = zone_dict[oid]
cursor.updateRow([oid, names])
except KeyError:
print(f"could not find any province names for zone with OID {oid}")
... View more
06-28-2022
03:23 AM
|
0
|
0
|
1176
|
|
POST
|
JohannesLindner_0-1656409948165.png You need a Standard or Advanced license for that tool. I guess you have a Basic license? To see your license level: Open the Project settings JohannesLindner_2-1656410228268.png Go to the Licensing tab. This might take a while to load. JohannesLindner_1-1656410098676.png
... View more
06-28-2022
02:57 AM
|
0
|
0
|
1247
|
|
POST
|
Your syntax is OK. You don't need the elses here, because when you return, the rest of the code gets skipped and isn't executed. But that's a small, optional thing. Back() only works on arrays, not on feature sets, I just added an idea to change that. So to return the last feature, you need to sort the featureset. Assuming you have some key field (I use OBJECTID here), you could do it like that: var fsParcel = FeatureSetByName($datastore, "Parcel", ["OBJECTID", "APN", "SitusUnitNumber", "SitusStreetNumber"])
var fsParcelIntersect = OrderBy(Intersects(fsParcel, $feature), "OBJECTID")
// loop through parcel features
for (var Parcel in fsParcelIntersect) {
// unit number is not empty and matches -> return APN
if (Parcel.SitusUnitNumber != null && Parcel.SitusUnitNumber ==$feature.Unit){
return Parcel.APN
}
// unit number is empty, but street number matches -> return APN
if (Parcel.SitusUnitNumber == null && Parcel.SitusStreetNumber == $feature.Add_Number){
return Parcel.APN
}
// both unit number and street number are empty/0 -> return last parcel's APN
if (Parcel.SitusUnitNumber == null && Parcel.SitusStreetNumber == "0"){
// to get the last feature, reverse the featureset and call First()
var LastParcel = First(OrderBy(fsParcelIntersect, "OBJECTID DESC"))
return Iif(IsEmpty(LastParcel), Null, LastParcel.APN)
}
}
// if we land here, none of the intersected parcels has the address's Unit
// returns first intersect
var Parcel = First(fsParcelIntersect)
return Iif(IsEmpty(Parcel), Null, Parcel.APN) I don't really understand your last check. If both SitusUnitNumber and SitusStreetNumber are empty (I guess that what "0" represents), why do you want to get the last parcel instead of just letting the loop get to the next parcel?
... View more
06-28-2022
02:20 AM
|
0
|
1
|
1961
|
|
IDEA
|
At a first glance, Back() seems to be the equivalent to First(). One gets the first element of an array, the other gets the last element. But there are two important differences: First() has two signatures, it works on arrays and feature sets First(inputArray) -> Any First(features) -> Feature Back() only has one signature, it doesn't work on feature sets Back(inputArray) -> Any The behavior when called on an empty array is different: var arr = []
var f_arr = First(arr) // f_arr is null
var b_arr = Back(arr) // this will throw an ExecutionError This has implications for guarding against empty arrays (or featuresets): var arr = []
// some code that fills arr (or doesn't)
// when we want to goard against an empty array using First(), we can simply
// call the function and check the result for null:
var f_arr = First(arr)
if(f_arr == null) {
// arr is empty, code for that case here
} else {
// arr isn't empty
}
// when we want to do the same using Back(), we have to call Count(), which
// is more computationally intensive, especially for large array
if(Count(arr) == 0) {
// arr is empty, code for that case here
} else {
// arr isn't empty
} For most arrays, this is probably negligible, but it could very well become a problem if Back() could work on feature sets. Also, it's just irritating that these two quite similar functions handle this case so differently. So, my suggestion: Enable Back() to work on feature sets Change how Back() handles empty input to how First() does it optionally, rename Back() to Last(), because that's what it does: it gets the last element, in the same way that First() gets the first element and isn't named Front()...
... View more
06-28-2022
01:48 AM
|
3
|
0
|
616
|
| 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
|