1

I have an algorithm, that generates random points with in a given polygon (Generate random points in polygon. Algorithm question). The Polygons the points are generated in are communities or districts of germany. So instead of just randomly placing the points somewhere in the Polygon I would like to place them near cities, town etc. since a Point should represent a person.

So my Idea was to use OpenStreetMap data to query cities, town etc., but I yet have to find out which data from OSM I need to use. Under the assumption that the data is available how do I influence the algorithm to generate the Random points near the cities?

  • So, taking Berlin as an example, which is about 4.3% of the German population, you would like it so that approx 4.3% of the points were within some distance of Berlin, etc. – John Powell Nov 30 '14 at 17:22
  • Well Berlin is not a good example, since the whole city is a district, so it won't matter where the point is located since it is in the city anyways. Instead think of a district which has 2 smaller cities and 12 towns. I want to generate the points around the cities and towns. They can be evenly distributed for simplicity's sake. – Benjamin Nov 30 '14 at 17:30
  • You could choose a random point, determine the nearest city and subtract a random offset towards this city from your random point. The size of the random offset could depend on the size of the city. But that's just the first solution that came into my mind, there are possibly better algorithms for this task. – scai Nov 30 '14 at 18:13
  • I didn't mean in Berlin, necessarily, I said within some distance. So, using the center of each city, use random in conjunction with make point, and a distance parameter, to create points in and near each city. – John Powell Nov 30 '14 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.