Great Circle Flight Lines in PostGIS

There is an excellent post by Anita Graser about creating Great Circles in PostGIS.

However as of PostGIS version 2.1 this can be done in a different (better) way, using the geography functions.

PostGIS Great Circles

For more information about geography, see:
Introduction to PostGIS – Geography

This allows us to create the great circles without having to add in a new projection.

So we first need to create our three tables in PostGIS:

The data itself can be found at:

We can then load our data through PGAdminIII. You can just right click on a table and select import. Remember to not load the “uid” column, because it is our primary key which will be populated automatically and not in the original data. You will also want to define it as the primary key.

Now we need a geometry column in the airports dataset.

We can define our geometry in the airports dataset from the Latitude and Longitude columns.

And create a spatial index.

Then we can create a flights table.

This table will have a source geometry and a destination geometry along with a few other attributes. I added a primary key to this table as well.

To filter out a specific airport, for example Honolulu we use the “Airport ID”.

Then we add in the actual line geometry column.

And populating the great circle geomtrey:

This is works great to an extent, but QGIS still has some trouble with lines that cross the date-line.


We can fix this using a Pacific centered projection like EPSG:3832.


We can either set QGIS to the projection. Or we can set our geometry to this projection when creating the flight lines.

Thanks to:
The World Is A Village – PostGIS: using latitude and longitude to create geometry

34 thoughts on “Great Circle Flight Lines in PostGIS

  1. Pingback: Uçuş ağını görselleştirmek: PostGIS Örneği | mete ercan pakdil

  2. Pingback: My Homepage

  3. Pingback: Download Free Beats

  4. Pingback: The Christ Gospel Church Cult 2017

  5. Pingback: my review here

  6. Pingback: optimalizace nakladu

  7. Pingback: Sony vtc4

  8. Pingback: netfly

  9. Pingback: Shemale escorts London

  10. Pingback: arched floor lamp

  11. Pingback: dental implants croatia

  12. Pingback:

  13. Pingback: Trade on forex

  14. Pingback: how to make money with a iphone

  15. Pingback: laptop coupon codes

  16. Pingback: proteinpulver

  17. Pingback: pre workout

  18. Pingback: Kata Kata Ucapan Lebaran Idul Fitri 2017/2018

  19. Pingback: beste proteinpulver

  20. Pingback: babes babe porn

  21. Pingback: flamingo costa rica

  22. Pingback: Naudas kredīts uzņēmumiem

  23. Pingback: pax 3 dynamic modes

  24. Pingback: paidika tragoudia

  25. Pingback: copy trading binary options

  26. Pingback: the future of bitcoin

  27. Pingback: cpns kemenkumham 2017

  28. Pingback: robux hack

  29. Pingback: free binary options signals

  30. Pingback: buying steroids online safe

  31. Pingback: wealthy affiliate reviews

  32. Pingback: Yacht Delivery

  33. Pingback: Quiz/bollywood/travel/health/fitness/entertainment/news

  34. Pingback: powerballdrawing

Leave a Reply

Your email address will not be published.