I need to draw a line between two points and create a buffer around this line. The only difficulty is that I need to draw not a "cartesian" line but a line that is laying on the spheroid.

I tried to use ST_MakeLine but it has only geometry parameters so it draws only a straight line, not a curve (which is a straight line on spheroid).

Unfortunately ST_LineFromText also does the same.

Here is an example from http://postgis.net/workshops/postgis-intro/geography.html.

I want to draw the red curve. (Btw the length of this curve can be calculated by the ST_Distance(geography, geography))


1 Answer 1


The later versions of PostGIS have ST_Segmentize(geography) that will densify a line in geographic space. Start with a two-point line (start, end) and densify it. Now run a ST_Buffer(geography, radius) on that line. For really long lines you still might have imperfect results, as ST_Buffer(geography) just wraps a transform to planar space, but you will get a result at least.


Your Answer

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

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