I'm racking my brains (and google) trying to figure out how to get RGeo to do the following geospatial calculation:

Imagine I start off at some arbitrary geographic point (let's say (45, 45) which happens to be in Russia), then I point 30 degrees east of true north, and fly for 5000km, and then want to know my position.

How can I do this with RGeo? Also, is there a way of neatly expressing this in WKT assuming a geographic coordinate system? For instance "POINT(45, 45) + POLAR_VECTOR_THIS_CONSTRUCTOR_IS_MADE_UP(30, 5000000)"

Also, any good references, tutorials, and docs for this sort of thing would be much appreciated.

  • RGeo's geographic point factory uses spherical geometry, whereas GPS coordinates are expressed in WGS84. I know there's only supposed to be 0.3% error, but if I can do the calculation perfectly, I don't need to worry about any error. – user1158559 Feb 26 '13 at 22:37
  • I'd be very grateful if someone could verify that my proj4 definitions are good enough (please forgive the ruby string interpolation): WGS84: "+proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees +no_defs" And azimuthal equidistant: "+proj=aeqd +lat_0=#{start_point.x} +lon0=#{start_point.y} +units=meters +no_defs" – user1158559 Feb 26 '13 at 22:38

How about transforming your starting coordinate to one on an azimuthal projection centered at the starting point. Then move at the appropriate azimuth for the desired distance, and transform back to geographic coordinates?

A few resources:

  • Thankyou very much! I think I see what to do. I can define the new azimuthal equidistant coordinate system using proj4, but I can't yet see how to map the new point back to RGeo's geographic coordinate system. – user1158559 Feb 24 '13 at 11:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.