HARSHAD557
HARSHAD557

Reputation: 41

leaflet js determine which polygons are under polygon drawn by user

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 imagemap with polygons

Upvotes: 1

Views: 1086

Answers (1)

IvanSanchez
IvanSanchez

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

Related Questions