D
D
Dima Pautov2021-08-11 13:42:32
JavaScript
Dima Pautov, 2021-08-11 13:42:32

How to color an area on google map?

Good afternoon!
I have a task to make it possible to hover over areas in google maps.

Hover example
6113a8e63c2ab847630321.jpeg


I googled, looked at the doc, and realized that for this, I would need to use the Polygon class in the maps and draw it on top of the map in the areas I need.
After simply hanging events on this polygon with hovers, I will get the result I need.

But, how to get the coordinates of the area I need to create a polygon on it?
After all, the polygon needs to give a path to build a curve.
Those. if we take the Moscow region, how to get curves for it?

I didn’t find normal answers, there were similar topics on the questionnaires, they suggested using third-party services to get these polygons and create them based on them, I tried to poke, even I didn’t understand anything the first time.

Google maps have the ability to get curves for given areas, for example, if you geocode an address, is it possible to get curves from it to build a polygon? If so, could you poke your nose where to look. And if not, how to solve such a problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandroppolus, 2021-08-11
@Alexandroppolus

there is no way to get the polygon of an object in the map API. If you need subjects of the Russian Federation (regions, republics, etc.), then you will have to look somewhere. These data must be available, for example, at the work before last, I had to highlight the regions of Moscow on the map, the data came from the back. Where did they come from, I didn't ask.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question