Re: earthdistance compass bearing - Mailing list pgsql-general

From Paul Ramsey
Subject Re: earthdistance compass bearing
Date
Msg-id 6562BD8BEB964F078F2A8B122C4FDF41@cleverelephant.ca
Whole thread Raw
In response to Re: earthdistance compass bearing  (Jeff Herrin <jeff@openhotel.com>)
List pgsql-general
The code for azimuth on a sphere isn't so gnarly you couldn't whip it up in plpgsql,

http://trac.osgeo.org/postgis/browser/trunk/liblwgeom/lwgeodetic.c#L924

P.

--
Paul Ramsey
http://cleverelephant.ca
http://postgis.net


On Tuesday, June 18, 2013 at 11:16 AM, Jeff Herrin wrote:

> I don't need it to be too accurate. We're pushing hotel info into the GDS (sabre, expedia, orbitz, etc). They require
airportinfo relative to the hotel. Example: DFW is 25 miles NW of the property. I thought about just faking
it...comparingthe hotel's lat/long from the airports. I can probably get N,S,E,W reliably enough, but i'm not sure at
whatpoint N becomes NW, etc. That just seems like a really crude bad way to do it, but the alternatives seem
unnecessarilycomplex. I found some examples that use bearing but they all take headings in degrees (which im not seeing
inearthdistance). I guess I'm going to have to either setup postGIS or brush up on my trig. 
>
> thanks,
> altimage
>
> From: "Steve Crawford" <scrawford@pinpointresearch.com (mailto:scrawford@pinpointresearch.com)>
> To: "Jeff Herrin" <jeff@openhotel.com (mailto:jeff@openhotel.com)>
> Cc: pgsql-general@postgresql.org (mailto:pgsql-general@postgresql.org)
> Sent: Tuesday, June 18, 2013 11:37:10 AM
> Subject: Re: [GENERAL] earthdistance compass bearing
>
> On 06/18/2013 10:42 AM, Jeff Herrin wrote:
> > I'm trying to get a compass bearing (N,S,NW,etc) using earthdistance. I can successfully get the distance between 2
pointsusing either the point or cube method, but I've been struggling with getting the bearing. Any tips? 
>
>
> PostGIS has some functions that may be of use but might be overkill depending on your use but I don't see anything in
earthdistance.
>
> What are you trying to solve?
>
> It's one thing if you are looking for a one-degree-accurate magnetic-variation-compensated great-circle heading for a
6,000kmflight using WGS84 projection (initial-heading, of course, as it will vary over the course of your travel). 
>
> If you just want to be accurate to eight compass-points over a few city-blocks then simple trig is probably more than
sufficient.
>
> Cheers,
> Steve





pgsql-general by date:

Previous
From: Jeff Herrin
Date:
Subject: Re: earthdistance compass bearing
Next
From: John R Pierce
Date:
Subject: Re: earthdistance compass bearing