L
L
Leo9512019-09-15 10:08:42
Yandex maps
Leo951, 2019-09-15 10:08:42

How to check if the passed point lies inside the Polygon on the Yandex map using react.js?

There is an example in Yandex.maps api.
var myPolygon = new ymaps.geometry.Polygon([]);
// The method works only with a correctly specified map.
myPolygon.options.setParent(myMap.options);
myPolygon.geometry.setMap(myMap);
// Check if the click point is inside the polygon with the above geometry.
myMap.events.add('click', function (e) {
alert(myPolygon.geometry.contains(e.get('coords')) ? 'Hurt!' :
'Miss!');
});
How to implement myPolygon.geometry.contains in react.js?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question