Field maps calculated value allow edit

03-23-2023 02:00 PM
New Contributor II

I have a calculated expression that grabs the ID of the nearest structure when placing a point in field maps. However, the user would like the option to enter the ID manually if they are far away from the structure, and the ID it grabs is not the nearest to them. Currently Field Maps does not allow this field with a calculated value to be edited. Any Ideas?




var line_fs = FeatureSetByName($map,"Structures")

// If you have many lines, just select those that are within a certain distance of your point
// I tested it without this line and around 10.000 line features and it took a good time to compute. With this line it was done almost instantly.
// Choose a distance in which a line feature will certainly be!
line_fs = Intersects(line_fs, Buffer($feature, 100, "Meters"))

// Cycle through the line features and find the nearest one
var min_dist = 999999  // arbitrary large number
var nearest_line_oid = null
var geo = Geometry($feature)
for(var line in line_fs) {
  var line_geo = Geometry(line)
  var dist = Distance(geo, line_geo)
  if(dist < min_dist) {
    min_dist = dist
    nearest_line_oid = line.STRUCTUR_1 

// Return the ObjectID of the nearest line feature
return nearest_line_oid​


Tags (3)
0 Replies