[postgis-users] Great circle as a linestring

Colin Wetherbee cww at denterprises.org
Fri Feb 22 07:45:15 PST 2008

Colin Wetherbee wrote:
> I'm looking for a function to approximate a partial great circle (eg. 
> the route taken when flying from London to Tokyo) as a LINESTRING or 
> something similar.
> Does such a beast exist?  If not, do you have any pointers on how to go 
> about implementing that kind of a function in, say, PL/pgSQL?

To follow up, Dane and I had some unsuccessful ideas last night about this.

We tried casting the points to a spherical projection, creating the 
line, and then casting back to the native projection, SRID 4326.  We 
also tried other combinations of the same tactic.  The spherical 
projections we tried had SRIDs 53027, 4047, and 2163.

I'm still looking for a method of doing this.

My application uses OpenLayers to display MapServer-generated data, and 
MapServer uses PostgreSQL/PostGIS as a back-end.  The routes I'd like to 
see on the map connect airports, and right now, they just look like a 
piece of string pulled across a flat map.  I'd like them to look more 
like a piece of string pulled across a globe.

The ideal case would be a projection that could give me a perfectly 
curved line, which I could then project onto the flat map.  However, I 
would settle for some sort of function that gives me a LINESTRING that 
approximates that curved route.  London to New York could have 20 
segments or something like that.



More information about the postgis-users mailing list