Pull data from polygon feature to point feature class

2749
16
Jump to solution
03-22-2021 07:41 AM
AlexP_
by
Occasional Contributor III

Hello,

I am not sure if I am in the right group. I have AGOL web app, arcgis pro 2.7.1, sde, feature service and map service arcgis server. I have a staff as an editor. I am trying to figure out how to set up pull data from polygon feature class parcel number field into point feature class in a parcel number field every time create a new point. If this way doesn't work, please correct me. Please kindly advise. Thank you.

 

Alex

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JoeBorgione
MVP Emeritus

I think on one of your other related posts I suggested an attribute rule.  I have one that does exactly what you are looking for:

var parcel = FeatureSetByName($datastore,"MyParcels",["parcel_id"],true)
var intersectLayer = Intersects(parcel, Geometry($feature))
if (Count(intersectLayer) > 0) {
    var layer = First(intersectLayer);
    return layer.parcel_id;    
} else {
    return null;
}

The if/else assures you that if there is not intersecting layer, the rule still fires correctly and does not toss an error.

That should just about do it....

View solution in original post

16 Replies
JoeBorgione
MVP Emeritus

I think on one of your other related posts I suggested an attribute rule.  I have one that does exactly what you are looking for:

var parcel = FeatureSetByName($datastore,"MyParcels",["parcel_id"],true)
var intersectLayer = Intersects(parcel, Geometry($feature))
if (Count(intersectLayer) > 0) {
    var layer = First(intersectLayer);
    return layer.parcel_id;    
} else {
    return null;
}

The if/else assures you that if there is not intersecting layer, the rule still fires correctly and does not toss an error.

That should just about do it....
AlexP_
by
Occasional Contributor III

Thank you @JoeBorgione 

1) Would this still work operate while create a new point feature class on web app builder?

2) is it required GLOBALID?

3) Do I add that attribute rule under new point feature class or under existing polygon feature class? 

4) I have a little knowledge with attribute rule. I have existing polygon feature class layer name is parcelview and the field is parent_folio. The new point feature class name is address_edit and the field is parent_folio.

Trying to replace what I have. My understanding is "parcel" is the name of feature class? "MyParcels" is another feature class? parcel_id is a field? I am a bit lost.

0 Kudos
AlexP_
by
Occasional Contributor III

@JoeBorgione 

Hello  I have a question, after applied this attribute rule, would it work thru web map app arcgis online when an editor add new info? Please confirm.  editor doesnt have pro. if any other method to use thru web?

0 Kudos
JoeBorgione
MVP Emeritus

1. It depends where you store your data: if it a hosted feature layer on AGOL, no.

2. To use attribute rules, the feature needs a global id

3. This type of rule is applied to the point feature

4.  MyParcels is the name of the feature class, and the variable 'parcel' refers to it

My suggestion is you take a look at the Arcade help pages to be come more familiar with it.  Something you need to consider is that when you create attribute rules that take data from one feature to another, all the feature classes must reside in the same 'datastore' which is Arcade for database.  At this point in time all my addressing data and the related features are in the same enterprise geodatabase.  I notice that you refer to your parcel feature class as 'parcelview': is this an actual database view of the data?  If so, that view and your address points need to be in the same datastore.

That should just about do it....
AlexP_
by
Occasional Contributor III

@JoeBorgione 

1) All my data are in the same enterprise geodatabase. parcelview is a enterprise geodatabase view under the same enterprise database also. Is it still ok? Also, you mentioned datastore, is it like enterprise database? Correct me if I am wrong.

0 Kudos
JoeBorgione
MVP Emeritus

'datastore' which is Arcade for database.

That's the great thing about having a database view: the view is in the same datastore/database that the points are in.  But the actual data that the view is referencing can be elsewhere.

That should just about do it....
AlexP_
by
Occasional Contributor III

@JoeBorgione 

Thank you for clarify.

2) GLOBALID, if I add it, would it be an issue if I need to set up unique identifier/avoid duplicate based on a text field?

0 Kudos
JoeBorgione
MVP Emeritus

GlobalIDs are maintained internally by the geodatabase, so you have no control over them.  I let the geodatabse do it's job.  The same goes for ObjectID: I avoid using either one for anything than they are intended for. I think I've also mentioned database sequences in one or more of my responses to your earlier posts.   I find deploying a database sequence and then capturing the next value in an attribute rule to be a very convenient and easy way to create a unique id of your own design.  Here is an example of using a database sequence which is numeric to update a text type of unique id field. 

// This rule will create a new unique id when new feature is created

// Define the leading text and the delimiter for the ID
var prefix = "MyID"
var join_char = "-"

//Ensure the ID is not already set, if it is, return the original id
if (IsEmpty($feature.siteaddid)) {
   return Concatenate([prefix, NextSequenceValue("MyDatabaseSequence")], join_char)
}
else {
   return $feature.siteaddid
}

In this example I use the text of MyID as the prefix to my unique identifier and concatenate to the next value in a database sequence named MyDatabaseSequence.  If the next value of my sequence is 100, then the unique id field value will be:

MyID-100

That should just about do it....
AlexP_
by
Occasional Contributor III

@JoeBorgione  Thank you for reply. The one I asked about sequence on post was for a different case. This case here is for example, address field, entry address info 1234 NW 102 AVE.  but if an editor re entry the same address. it needs to set up to avoid duplicate . hope this clarify.

0 Kudos