Update attributes on a point after moving it inside a polygon

1503
11
09-12-2018 01:38 PM
StevenBell2
New Contributor III

I have a feature layer of points representing people and a feature layer of polygons representing areas they are assigned to be in.  I would like to have a web app where a user can move an existing point into a different polygon then have the point update to the name of the new area.  If it's possible I would like the point to be updated by clicking a button that runs a tool that updates by the point's location rather than by having the user type in the information.

I'm having trouble searching for answers to this because all the ones I find relate to doing a spatial join.  But I don't want to create a new feature class.  I need to only update the attributes of the feature in the existing point feature layer.

Thank you.

Steve

0 Kudos
11 Replies
DarrenWiens2
MVP Honored Contributor

Are you hoping for a Python or JS solution, or something else?

0 Kudos
StevenBell2
New Contributor III

Honestly anything. I don’t really have much scripting experience so I’d have to learn more about any possible solution.

Sent from my iPhone

0 Kudos
DarrenWiens2
MVP Honored Contributor

In Python, you would find the Point Geometry you moved, then cycle through the Polygon objects, checking if the polygon contains the point (using one of the polygon methods, like contains or not disjoint). The JS API would have similar objects/methods, but I'm not particularly familiar with it.

MatthewDobson
Occasional Contributor

Steven, where does the data reside? If it is in a relational database (MS SQL Server, Oracle etc.) you could work something up at the database level.

Matthew

0 Kudos
StevenBell2
New Contributor III

It resides in an sql database but the updates will be made through a web app.

Sent from my iPhone

0 Kudos
MatthewDobson
Occasional Contributor

Yea, that's okay. I'll have a crack at a little SQL trigger that will do the update within the database once the point is moved via the WebMap. You might need to do some finessing as I don't know your data structure.

Matthew

0 Kudos
MatthewDobson
Occasional Contributor

You'll need to update the attached with your database, schema and featureclass names, as well as the names of the fields in your point and polygon featureclasses.

The trigger will:
    1. get the geometry for the moved point feature
    2. find the polygon that the point intersects with and gets the 'name' of that area.
    3. updates the point attribute with the 'name' of that area

Let me know how you get on.

StevenBell2
New Contributor III

Thank you for trying to help.  I'm not seeing anything attached to your post.

0 Kudos
MatthewDobson
Occasional Contributor

Second try ....

0 Kudos