I'm trying to calculate the intersection point between a segment and the exterior ring of a polygon. But I'm not sure how to do it correctly when dealing with geography types.

The segment is a line connecting two geographic locations and I specifically know in advance that the start-point coordinates are outside of the polygon and the finish-point coordinates intersect the polygon.

ST_Intersection supports both geometry and geography and I already have the polygon as geography

Building the line as geography it's easy as:

LINESTRING(start-point, finish-point)'::geography

maybe I can even use ST_Makeline and cast its result to geography?? (I'm not sure)

But what about the exterior ring of the polygon geography? I was advised to use ST_Boundary however ST_Boundary only accepts geometry and returns geometry. I am not sure if the output of


is actually geographically correct? For example if the polygon has very large edges would they be segmentized (as great-circles) in the output of ST_Boundary? If not (as I suspect) then how can I obtain the correct geography boundary ?

  • 1
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Commented Feb 15, 2023 at 11:51
  • 1
    What have you tried so far? what is wrong with the result you have?
    – Ian Turton
    Commented Feb 15, 2023 at 11:52
  • 1
    Check what you get by casting geography into geometry, and if segmentation does not happen automatically, use ST_Segmentize first.
    – user30184
    Commented Feb 15, 2023 at 12:05
  • 1
    related gis.stackexchange.com/questions/451981/…
    – JGH
    Commented Feb 15, 2023 at 13:54

1 Answer 1


Functions on geometry do not segmentize their output. This also applies when using them against geography inputs cast to geometry. So ST_MakeLine and ST_Boundary do not automatically segmentize output.

Edge segments of geography objects are assume to be great-circle arcs, and functions with variants taking geography inputs automatically take this into account. However, as described in Using PostGIS to calculate where lines intersect using Geography objects the internal computation may not be very accurate for geography objects with very long segments.

ST_Segmentize is geography-aware, so it can be used to add more vertices to allow line segments to more closely follow great circle arcs.

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.