Hey! This content applies only to previous CARTO products

Please check if it's relevant to your use case. On October 2021 we released a new version of our platform.
You can learn more and read the latest documentation at docs.carto.com

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.