Select to view content in your preferred language

Autofill Fields Using Overlapping Point Buffers Using Arcade?

1130
4
Jump to solution
04-05-2019 10:32 AM
ShelbyZemken1
Regular Contributor

I was inspired by KGerrow's blog post to autogeneraet some attributes when creating a feature since it could save hundreds of hours of time. I'm looking for some feedback on my methods and code below. My aim is to autopopulate the field of one point feature layer from a field value of another point feature layer when I generate a new feature in a web map. What makes this different than what I have seen is that I have to buffer the point first to make sure the data is joined correctly.

I I think I'm missing some key piece of code to put the data from layer A into layer B. When I test

  1. Define var A and field I want to extract from
  2. Define var B and field I want to put the value into
  3. Define var C - which buffers the A  20 feet so when the new feature is created next to it, it pulls the info from A into B. 
  4. Return Layer A field ID into newly generated feature of Layer B into ID field.

var A = FeatureSetByName($map, "A")
var B = FeatureSetByName($map, "B")
var C = Intersects(Buffer($feature, 20, 'feet'), FeatureSetByName($map, "A"))

  

for (var C in B)
        {return C.ID}‍‍‍‍‍‍‍‍‍‍‍‍

How do I take the field from the buffered layer C and put it into layer B?

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

You won't be able to update attributes in another feature service using Arcade.  From the help, Arcade is intended solely for evaluating embedded expressions such as those used in the visualization, labeling, popup, and alias contexts of applications built with the ArcGIS platform

You will only be able to display the information you want when clicking on the feature.  It will not be stored within the service's attributes.

View solution in original post

0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Shelby,

I think I'm following you correctly.  You want to buffer layer B by 20 feet and get the ID from layer A.  Is that correct?

Try the following:

var bufferLayer = Buffer($feature, 20, 'feet')
var intersectLayer =Intersects(FeatureSetByName($map,"A"), bufferLayer)

for (var f in intersectLayer){
    return f.ID
}
‍‍‍‍‍‍‍‍‍‍‍‍‍
ShelbyZemken1
Regular Contributor

Jake, yes exactly. But how does the code tell where to put the ID from buffered layer A into the right field in layer B?


In essence what I'm trying to do is this:if I create a new feature B that is within 20 feet of a feature in Layer A, take ID from Layer A and put it in ID for layer B.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

You won't be able to update attributes in another feature service using Arcade.  From the help, Arcade is intended solely for evaluating embedded expressions such as those used in the visualization, labeling, popup, and alias contexts of applications built with the ArcGIS platform

You will only be able to display the information you want when clicking on the feature.  It will not be stored within the service's attributes.

0 Kudos
ShelbyZemken1
Regular Contributor

Thank you Jake, I appreciate your time and effort.

0 Kudos