Determine if Address is inside of a polygon

1183
3
03-10-2021 09:16 AM
ChrisCalbreath
New Contributor

I have a webmap in ArcGIS Online that contains a single polygon layer. I would like to be able to query the map  after a user submits an address and then return a True/False result based on if the address is inside the polygon or not. What would be the minimum javascript code to get started with this? IM just getting started with the ESRI API's and would appreciate any input to get started. 

TIA, 

Chris

0 Kudos
3 Replies
BlakeTerhune
MVP Regular Contributor

You would need to geocode the address (unless you have an address layer you can search) to get a location; probably with the Search widget. Then use the geometry engine contains() method to test the address location with your polygon.

0 Kudos
ChrisCalbreath
New Contributor
The address will come from a webform - I just need to pass the address on submit of the form to check if it's inside a polygon or not.
0 Kudos
BlakeTerhune
MVP Regular Contributor

An address from a form is just a string. You will need to geocode it to determine the actual spatial location (geometry) in order to perform geometry operations with it, like testing if it's located inside a polygon.

0 Kudos