For example, I want to choose 10 random points in Moscow. How to do this, so that the point was in the city and not somewhere in the area in the forest or in the swamp.

What if we take a rectangle in which Moscow fits completely and randomly take the coordinates of longitude and latitude in it?

But then all the same, the area behind the city will catch on.

Take a rectangle to fit in part of the city?

How to deal with the area of ​​the city, not related to it?

Take an arbitrary figure on the border of the city? What is it to do manually? And how then to take random coordinates in this figure?

Maybe there is a tool capable of issuing 100,500 points of the city? If there is a share of them. I do not understand how to even google on this topic ...

    1 answer 1

    I would do that

    1. Build a landfill boundaries
    2. Find the minimum and maximum latitude and longitude in this polygon.
    3. Generate a random point in the resulting rectangle.
    4. Check whether the point belongs to the polygon. If not, discard the point.

    Check functions for belonging to a polygon in the Internet in bulk