S
S
SeaWeer2017-06-05 19:21:24
JavaScript
SeaWeer, 2017-06-05 19:21:24

How to determine if a point is in a polygon?

In general, there are 3 polygons, mypoligon, mypoligon2, mypoligon3. How to determine if a point falls into a polygon and which one?
The point is implemented on click:

setStartPoint: function (position) {
                console.log('change start');
                if (this._startPoint) {
                    this._startPoint.geometry.setCoordinates(position);
                } else {
                    // Создаем маркер с возможностью перетаскивания (опция `draggable`).
                    // По завершении перетаскивания вызываем обработчик `_onStartDragEnd`.
                    this._startPoint = new ymaps.Placemark(position, {iconContent: 'А'}, {draggable: true});
                    this._startPoint.events.add('dragend', this._onStartDragEnd, this);
                    this._map.geoObjects.add(this._startPoint);

                }
                this.geocode('start', position);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SeaWeer, 2017-06-05
@SeaWeer

Who needs :

myPolygon.geometry.contains(СoordsPoint)
Returns true, false.

S
Sergey Sokolov, 2017-06-05
@sergiks

GeoQuery and searchInside() - slip a polygon instead of a circle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question