How to draw(click/drag) an arbitrary area in the Yandex Map Api?

451 Views Asked by At

I need to make that functional: Selected Area, but I've never worked with yandex map api, so don't know how to do that. Help me please to solve this problem

2

There are 2 best solutions below

0
On

You can draw an area with Polygon object. Like this:

var myPolygon = new ymaps.GeoObject({
    geometry: {
        type: "Polygon",
        coordinates: [
            [[/*...*/]],
            [[/*...*/]]
        ]
    }
});

Look at this example.

0
On

Here is the example exactly of what I wanted —https://tech.yandex.ru/maps/jsbox/2.1/polygon_custom