For example, I have this vector (It will be a more complicate linestring, not just a rectangle).
For a given coordinate (without clicks, just a latitude, longitude), how could I know (in an easy way, maybe collision?) if that coordinate is inside that vector?
From the @JohnBarça answer, with turf library, this is working perfect:
var linestring1 = turf.linestring([ [4.9020, 52.3667], [4.9030, 52.3667], [4.9040, 52.3667], [4.9050, 52.3667] ]); var pt1 = turf.point([4.9040, 52.3667]); var pt2 = turf.point([4.9060, 52.3667]); var intersection = turf.intersect(pt1, linestring1); if (intersection) alert('found pt1') else alert('not found pt1') intersection = turf.intersect(pt2, linestring1); if (intersection) alert('found pt2') else alert('not found pt2')