Select to view content in your preferred language

Snap New Point to Point of Another Feature Layer

330
0
09-16-2024 12:32 PM
MikhaylaB
Frequent Contributor

I have an inspection layer and an address layer in a web map. I'm using an Arcade expression in the web map to pull the address from the nearest address point within 15 feet, otherwise return null. I have an attribute rule set to prohibit null values, it is a constraint and resets the editor. My next step is to snap the newly created point to that address point. Does anyone have an example of an attribute rule or arcade expression in the web map form to do this?

 

 

var addr = FeatureSetByName($map, "AddressingSoftware");

// Find the nearest addresses within the buffer
var nearestAddr = Intersects(addr, BufferGeodetic($feature, 15, "feet"));

// Check if there are any valid addresses in the result
if (Count(nearestAddr) > 0) {
    // Return the complete address of the nearest valid address
    for (var f in nearestAddr) {
        return f.COMPLETE_ADD;
    }
} else {
    // Return an empty value (i.e., field is left empty)
    return null;
}

 

Some extra tidbits, I'm using a service created in Pro 3.3.0, running latest enterprise version, service is in a web map and will be utilized in experience builder. Ex Builder has "snapping" guides, but it just lights up when they're hover over a point. 

 

0 Kudos
0 Replies