tags:

views:

272

answers:

2

Hi!

I'm trying to generate some points at random distances away from a fixed point using GPS.

How can I add distance in meters to a GPS coordinate? I've looked at UTM to GPS conversion but is there a simpler method to achieve this?

I'm working on Android platform just in case.

Cheers, fgs

+1  A: 
  • P0(lat0,lon0) : initial position (unit : degrees)
  • dx,dy : random offsets from your initial position in meters

You can use an approximation to compute the position of the randomized position:

 lat = lat0 + (180/pi)*(dy/6378137)
 lon = lon0 + (180/pi)*(dx/6378137)/cos(lat0)

This is quite precise as long as the random distance offset is below 10-100 km

Stéphane
Hi, is 6378137 the radius of the earth? Thanks!
fgs
Yes (in meters as always). More precisely it is the semi-major axis of the WGS84 ellipsoid, so the radius of the Earth at the equator.
Stéphane
+2  A: 

A detailed outline is given at http://www.movable-type.co.uk/scripts/latlong.html.

If you, somewhere, need to interconvert longitude/latitude to UTM coordinates (the ones used in GPS) you may want to have a look at http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.htm

Ashish Jindal
Hi! thank you so much, the links are indeed what i need. Thank you. :D
fgs