How to restrict a draw touches the another polygon

126
1
2 weeks ago
SaiPeketi
New Contributor II

Hi, 

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. 

 

Thanks,

Sai

 

 

 

 

0 Kudos
1 Reply
BlakeTerhune
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.

EDIT:

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