Reputation: 41
I am using leaflet js for drawing polygon on map and map already have drawn polygons but i am facing problem how to determine which polygons are under polygon which is drawn by user as follows in image
Upvotes: 1
Views: 1086
Reputation: 19069
One option is to use TurfJS's intersect()
functionality to perform the geometry transformation/relation. Other libraries and utilities exist (e.g. the PostGIS spatial functions for geometries in databases), but Turf is my tool of choice for client-side javascript geospatial analysis.
Please be aware that there is no such thing as "polygon being under other polygon". I suggest you read about spatial predicates, and the difference between "overlap", "cover" and "intersect".
Upvotes: 2