Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 LINESTRING geometries. I know both share a common point. Using PostGIS for Postgres, what is the cleanest way to extract the common point?

Example with illustration:

How do I extract the intersection of the green and blue line, assuming the points at the crossing are equal?

share|improve this question
up vote 7 down vote accepted

You can use st_intersection

Examples 1:

test=# select st_astext(st_intersection('LINESTRING ( 0 0, 0 2 )'::geometry, 'LINESTRING ( 0 0, 2 0 )'::geometry));

 POINT(0 0)
(1 fila)

Example 2:

test=# select st_astext(st_intersection('LINESTRING ( 1 0,  0 2 )'::geometry, 'LINESTRING ( 0 0,  2 0 )'::geometry));
 POINT(1 0)
(1 fila)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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