Questions  /  Working with Data  /  PostGIS

How to convert straight lines to great circles

Learn how to transform straight lines into great circles.

You can use the ST_Segmentize PostGIS function to emulate flight routes or great circles.

 SELECT ST_Transform(
            ST_Segmentize(
                the_geom::geography,
                10000
            )::geometry,
            3785
        ) as the_geom_webmercator,
        cartodb_id
   FROM table_name

great-circles

Notice that when any of these routes crosses the dateline, some horizontal lines will appear. To solve this issue, you can check this blog post and apply it’s workaround.