|
POST
|
If you want to manually adjust labels, you will have to convert them to annotations. Maybe try your luck with a callout first?
... View more
10-12-2021
12:28 AM
|
0
|
0
|
2528
|
|
POST
|
The answer to this question seems like it should work for you, too.
... View more
10-12-2021
12:12 AM
|
1
|
2
|
3042
|
|
POST
|
I'd do it with the symbology. Go to the symbol's properties and add 4 marker layers: 1st Marker: use this form: activate symbol property connections and map the "Text string" variable to your text field set font attributes 2nd marker: set color to white, set size 3rd marker: switch to square, set color to green, rotate by 45°, set size (size of second marker + 2 ) 4th marker: switch to line, set "Shape line symbol" to "Single stroke" all markers: set "Offset Y" (4th marker to half of the others), uncheck "Angle to line", set "Placement" to something appropriate (I chose "At measured units" with an interval of 100m) 4th marker: set size to the "Offset Y" of the other markers
... View more
10-11-2021
11:57 PM
|
2
|
0
|
1099
|
|
POST
|
Imagine this is your current data structure: ID| StringField | CodeList 1 | abc | AU CU PB 2 | def | AU To get this structure: ID| StringField | CodeList 1 | abc | AU 2 | abc | CU 3 | abc | PB 4 | def | AU Use the script I provided in this question. To get this structure: ID| StringField | AU | CU | PB 1 | abc | 1 | 1 | 1 2 | def | 1 | 0 | 0 for each mineral: create the field calculate the field, switch to Arcade, use this expression: var codelist = $feature.CodeList
if(IsEmpty(codelist)) { return 0 }
if(Includes(Split(codelist, " "), "AU")) { return 1 } // change mineral here!
return 0
... View more
10-11-2021
11:02 PM
|
2
|
0
|
972
|
|
POST
|
Sorry, I find it hard to describe, as English isn't my first language. Hopefully the illustration helps... Imagine you have location data over two days (red and blue points). The first code sample will give you the polygons on the left side: one polygon for each time interval on each day. "Where were you on day 1, interval 2?" The second code sample will give you the polygons on the right side: one polygon for each time interval on all observed days. "Where were you on any day, interval 2?"
... View more
10-11-2021
10:40 PM
|
0
|
1
|
2007
|
|
POST
|
I think I misunderstood your question... The code above shows you the locations in a certain time interval. You want to know the probable locations in a time interval during a random day. Basic idea still applies: from datetime import date, time, timedelta
# variables
points_fc = "PointFC"
date_field = "DateField"
time_interval_minutes = 60
polygon_buffer = 100
# read shape and date
data = [list(r) for r in arcpy.da.SearchCursor(points_fc, ["SHAPE@", date_field])]
for d in data:
d.append(datetime.combine(date.today(), d[1].time()))
# construct time bins
start_time = datetime.combine(date.today(), time(0, 0))
end_time = start_time + timedelta(days=1)
time_bins = [start_time]
while time_bins[-1] < end_time:
time_bins.append(time_bins[-1] + timedelta(minutes=time_interval_minutes))
# create output fc
sr = arcpy.Describe(points_fc).spatialReference
polygons = arcpy.management.CreateFeatureclass("memory", "polygons", "POLYGON", spatial_reference=sr)
arcpy.management.AddField(polygons, "StartTime", "TEXT")
arcpy.management.AddField(polygons, "PointCount", "LONG")
# fill output fc
with arcpy.da.InsertCursor(polygons, ["SHAPE@", "StartTime", "PointCount"]) as cursor:
for b in range(len(time_bins)-1):
# get points that belong to the interval
t0 = time_bins[b]
t1 = time_bins[b+1]
points = [d[0].firstPoint for d in data if d[2] >= t0 and d[2] < t1]
# if there are points in the interval
if points:
# change list of point geometries to multipoint geometry
multipoint = arcpy.Multipoint(arcpy.Array(points))
# get the convex hull, buffer to prettify
polygon = multipoint.convexHull().buffer(polygon_buffer)
# insert
cursor.insertRow([polygon, t0.strftime("%H:%M"), len(points)])
... View more
10-11-2021
02:10 AM
|
0
|
3
|
2023
|
|
POST
|
Couldn't you just use the convex hull of all points in the same interval? import datetime
# variables
points_fc = "PointFC"
date_field = "DateField"
time_interval_minutes = 60
polygon_buffer = 100
# read shape and date
data = [r for r in arcpy.da.SearchCursor(points_fc, ["SHAPE@", date_field], sql_clause=(None, "ORDER BY " + date_field))]
# construct time bins
start_time = data[0][1]
end_time = data[-1][1]
time_bins = [start_time]
while time_bins[-1] < end_time:
time_bins.append(time_bins[-1] + datetime.timedelta(minutes=time_interval_minutes))
# create output fc
sr = arcpy.Describe(points_fc).spatialReference
polygons = arcpy.management.CreateFeatureclass("memory", "polygons", "POLYGON", spatial_reference=sr)
arcpy.management.AddField(polygons, "StartTime", "DATE")
arcpy.management.AddField(polygons, "PointCount", "LONG")
# fill output fc
with arcpy.da.InsertCursor(polygons, ["SHAPE@", "StartTime", "PointCount"]) as cursor:
for b in range(len(time_bins)-1):
# get points that belong to the interval
t0 = time_bins[b]
t1 = time_bins[b+1]
points = [d[0].firstPoint for d in data if d[1] >= t0 and d[1] < t1]
# if there are points in the interval
if points:
# change list of point geometries to multipoint geometry
multipoint = arcpy.Multipoint(arcpy.Array(points))
# get the convex hull, buffer to prettify
polygon = multipoint.convexHull().buffer(polygon_buffer)
# insert
cursor.insertRow([polygon, t0, len(points)])
... View more
10-11-2021
01:27 AM
|
0
|
4
|
2025
|
|
POST
|
// Split values corresponding to Action
// Reference layer using the FeatureSetByPortalItem() method.
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), 'a616dac6c1834fedb0fad1860c14234e' , 1, ['*'], false);
// Empty dictionary to capture each hazard reported as separate rows.
var choicesDict = {'fields': [{ 'name': 'split', 'type': 'esriFieldTypeString'}, { 'name': 'ID', 'type': 'esriFieldTypeString'}],
'geometryType': '',
'features': []};
// Split comma separated hazard types and store in dictionary.
for (var feature in fs) {
var ID = feature["ID_bins"]
var split_array = Split(feature["Action"], ',')
for(var i in split_array) {
Push(choicesDict.features, {"attributes": {"ID": ID, "split": Trim(split_array[i])}}
}
}
var result = Replace(choicesDict, "_", " ");
// Convert dictionary to featureSet.
var fs_dict = FeatureSet(Text(result));
// Return featureset after grouping by hazard types.
return GroupBy(fs_dict, ['split'],
[{ name: 'No', expression: 'split', statistic: 'COUNT' }]);
... View more
10-08-2021
01:10 AM
|
2
|
3
|
5804
|
|
POST
|
Use a try-except-block to handle the exception: try:
# try your code
arcpy.FruitVendor_foobar()
except ExecuteError:
# ignore the ExecuteError
# other Exceptions will still get raised
pass
... View more
10-08-2021
12:54 AM
|
0
|
0
|
1417
|
|
POST
|
As per these questions Solved: Conditional Field List - Esri Community Solved: Can you limit the drop down list of domain values ... - Esri Community they are working on supporting contingent values in feature services that can then be consumed in FieldMaps.
... View more
10-08-2021
12:43 AM
|
1
|
0
|
1135
|
|
POST
|
Not really. Arcade doesn't know where you clicked, just on which feature. You could disable popups for the flood layer and do all the flood related code in the suburb layer.
... View more
10-08-2021
12:29 AM
|
0
|
0
|
1425
|
|
POST
|
You return the first intersected suburb. If a flood feature intersects multiple suburbs (eg su2 and su3), the expression will only return su2. Try this: var intersectLayer = Intersects($feature, FeatureSetByName($map,"Suburb"))
var suburbs = []
for(var f in intersectLayer){
Push(suburbs, f.SuburbName)
}
return Concatenate(suburbs, ", ")
... View more
10-07-2021
02:34 AM
|
4
|
0
|
1577
|
|
BLOG
|
Interesting. One problem I see is that he snaps to the first point, not to the closest. But doing it this way keeps the rule shorter. I recently did the opposite: Snapping a point shape to the closest polyline. function closest_feature(test_feature, compare_feature_set) {
// returns the feature of compare_feature_set that is closest to test_feature
var min_distance = 9999999
var closest_feature = null
for(var f in compare_feature_set) {
var d = Distance(test_feature, f)
if(d < min_distance) {
min_distance = d
closest_feature = f
}
}
return closest_feature
}
function project_orthogonally(point_geometry, line_geometry) {
// returns a projection of the point_geometry onto the line_geometry
// only start and end point of the line_geometry are considered!
// https://de.wikipedia.org/wiki/Orthogonalprojektion
// https://en.wikibooks.org/wiki/Linear_Algebra/Orthogonal_Projection_Onto_a_Line
var p = point_geometry
var r0 = line_geometry.paths[0][0]
var r1 = line_geometry.paths[0][-1]
var ux = r1.x - r0.x
var uy = r1.y - r0.y
var lambda = ((p.x-r0.x)*ux + (p.y-r0.y)*uy) / (ux*ux + uy*uy)
var new_p = Point({"x": r0.x + lambda * ux, "y": r0.y + lambda * uy, "spatialReference": p.spatialReference})
// if new_p is on the line defined by r0 and r1 but not on the actual line_geometry, snap it to the closest end point
if(Disjoint(new_p, line_geometry)) {
new_p = IIF(Distance(r0, p) < Distance(r1, p), r0, r1)
}
return new_p
}
function snap_point_to_polyline(point_geometry, polyline_geometry) {
// returns a point that is snapped to the polyline_geometry
// create feature set of the polyline's segments
var sr = point_geometry.spatialReference
var vertices = polyline_geometry.paths[0]
var fs_segments = {"fields": [], "spatialReference": sr, "geometryType": "esriGeometryPolyline", "features": []}
for(var s=0; s<Count(vertices)-1; s++) {
var p0 = vertices[s]
var p1 = vertices[s+1]
Push(fs_segments.features, {"geometry": {"paths": [[ [p0.x, p0.y], [p1.x, p1.y] ]], "spatialReference": sr}})
}
fs_segments = FeatureSet(Text(fs_segments))
// project point_geometry onto the closest segment
var closest_segment_geo = Geometry(closest_feature(point_geometry, fs_segments))
return project_orthogonally(point_geometry, closest_segment_geo )
}
var fs_lines = FeatureSetByName($datastore, "Lines")
// optionally, buffer
fs_lines = Intersects(fs_lines, Buffer($feature, 100))
var closest_line_geometry = Geometry(closest_feature($feature, fs_lines))
return snap_point_to_polyline(Geometry($feature), closest_line_geometry)
... View more
10-01-2021
08:51 AM
|
3
|
0
|
1601
|
|
POST
|
Aaah, now I get the problem... Yeah, this is going to be tricky. I tried a few things and couldn't find a good solution, but maybe someone more versed in SQL than me can. If you're willing/able to edit your field, there would be a simple solution: Make sure that "MEDIEVAL" always has the slashes at the start and end e.g. have the logic that is filling that field insert the slashes at the start and end of the string, too search for CONTAINS '/MEDIEVAL/'
... View more
10-01-2021
06:57 AM
|
0
|
1
|
2183
|
|
POST
|
Assuming the input mask looks the same in AGOL as it does in Portal (bad Paint edit because my Portal is in German):
... View more
10-01-2021
05:35 AM
|
0
|
3
|
2187
|
| 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
|