How to restrict a draw touches the another polygon

04-17-2024 10:49 AM
New Contributor III


I'm using ArcGIS API for JS. I'm able to create a grid of 1ft X 1ft. Now, whenever I'm able to add another polygon it should touch the grid and no one can start drawing in the middle of the grid, it has to be from corners based on grid size.

Try to use snapping but not able to start the middle of the grid.


Any idea or help will be more appreciated. 








0 Kudos
1 Reply
MVP Regular Contributor

You'll probably use the geometryEngine for this. The docs don't clarify what happens when two geometries share a boundary, so you'll have to do a little testing. Seems like crosses or intersects would be a good place to start. Assuming that intersects will return true if they share an edge, you could check if it intersects but doesn't cross.


It looks like relate is what you want. You'll look for a specific boundary result in the DE-9IM matrix table result values.

0 Kudos