Checking a marker on the geometries
- Create a Marker and Geometries
var marker = new longdo.Marker({lat:13.78,lon:100.43}, { draggable: true }); var geom1 = new longdo.Polygon([ {lat:13.94,lon:100.20}, {lat:13.94,lon:100.45}, {lat:13.62,lon:100.45}, {lat:13.62,lon:100.20} ], { lineWidth: 1, lineColor: 'rgba(0, 0, 0, 0.7)', fillColor: 'rgba(246, 210, 88, 0.6)', label:'geom 1' }); var geom2 = new longdo.Polygon([ {lat:13.94,lon:100.70}, {lat:13.94,lon:100.45}, {lat:13.62,lon:100.45}, {lat:13.62,lon:100.70} ], { lineWidth: 1, lineColor: 'rgba(0, 0, 0, 0.7)', fillColor: 'rgba(209, 47, 47, 0.6)', label:'geom 2' }); map.Overlays.add(marker); map.Overlays.add(geom1); map.Overlays.add(geom2);
- Checking if the marker is on the geometries
var checkGeom1 = geom1.contains(marker); var checkGeom2 = geom2.contains(marker);
* return true if overlay is inside
ExampleThe marker can be dragged
More information: contains documentation