I have a list of longitudes and latitudes which forms boundary for a geographical area. I would like to generate some random co-ordinates inside this geographical area . Could you suggest some approaches I can take in any language?
Like any problem, there are many ways to solve it, the first thing came into my mind is
x=rand()%(maxX-minX)+minX
(and same for Y)http://en.wikipedia.org/wiki/Point_in_polygon
Edit : As Jan Dvorak suggested, it might be problematic to use it technique on huge areas, i believe that if your polygon is close to the equator and his size is less the 100km, it will work just fine.
Also you will run into problems if you are near the 180° line because right next to it is the -180°.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With