I'm using Spatialite + ST_Project to extrapolate a line with an implied bearing between two points to some distance beyond those two points. Here's an example sql snippet:

    GeomFromText('POINT (-73.87172699 40.76195099)'),
        ST_GeomFromText('POINT (-73.87172699 40.76195099)'), ST_GeomFromText('POINT (-73.887831 40.804936)')

The third point produced from this reflects a geodesic, at least according to the PostGIS documentation for ST_Project. And you can see in the images below that the "bearing" as illustrated on a spherical projection looks to be in line with the original two points. But when I try to create a line string from joining these three points — either using ST_MakeLine or by manually assembling the new point with the existing two points in WKT text — the resulting line appears to use a great circle, and on a spherical projection it looks wrong, and doesn't align with the original two points' bearing:

as GeoJSON
Two original points two original points {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.87172698999998,40.76195099]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.887831,40.80493599999999]}}]}
Projected third point. Azimuth looks good! projected geodesic to third point {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.87172698999998,40.76195099]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.887831,40.80493599999999]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[155.052772,71.177753]}}]}
Linestring between all three points. Wha happened? line between all three points {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[-73.87172698999998,40.76195099],[-73.887831,40.80493599999999],[155.052772,71.177753]]}}]}

Is there a way to draw a line, with Spatialite or PostGIS, that would follow the projected geodesic used by ST_Project? I'm trying to illustrate what it would look like to walk in a visually straight line between the two original points to some arbitrary distance beyond those two points; I understand the great circle line here to be the shorter path, but I'm not sure I understand if they also reflect the path you'd take were you to walk along the earth from the azimuth/bearing between the two original points. Is there a different PostGIS/Spatialite function I should be using to illustrate this geodesic? Am I thinking about this illustration wrong, and somehow the great circle line here is somehow more "correct" to reflect the path you'd take were you to walk in a straight line from the original two points?

  • Can you expand a bit more on how you gererated the line we see in your 3rd screenshot, and what software you are using to display it ?
    – Kasper
    Dec 17, 2022 at 18:10
  • @Kasper these were rendered as GeoJSON, on geojson.io. I just updated the question with the sample GeoJSON in case it's helpful! Dec 17, 2022 at 19:23
  • From what I can see, it's an issue with geojson.io in earth view. Any line draw with their own edit tools is warped around the poles. Your geometry as such is fine. In the end, in which tool to you want to generate the rendering?
    – Kasper
    Dec 17, 2022 at 20:19
  • Thinking of one approach which might work, I have not tried. Making sure you are using geographies, you could use ST_Segmentize to provide many more reference points along your line: postgis.net/docs/ST_Segmentize.html.
    – Kasper
    Dec 17, 2022 at 20:40

1 Answer 1


The problem is not in your data, it's the rendering. Depending of the tool you use, you will have potentially different results. For example, if you use a planar projection like with QGIS in 3857, you will have something like this (with straight arrow):

Result with QGIS

But the result is not what you want, this path is the shortest path along the projected map, not on the earth. You can instead use a map around the north pole, like the projection 102016 for example, you will have a more straight line and you can more easily see that it's the shortest path:

102016 projection

It's a general rule to use a projection centered on the center of your data if you want it to be easily readable and representative.

But if you want a 3D representation, I think that can be obtained with Google Earth. Save your geojson as a file, convert it in KML (you can find tools to do that quite easily), go to Google Earth, in project import your KML file and you can have this kind of result:

Result with google earth

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.