I executed a query to know where a MultiLineString touches itself using st_touches from postgis as shown here :

select a.id,b.id ,a.geom,b.geom, ST_Touches(a.geom, b.geom) 
from pipe AS a , pipe AS b 
where b.id > a.id and ST_Touches(a.geom, b.geom) = true

yet the result is boolean (true or false).

I want to generate a point layer in each touching location. I tried to do create as select but it returned a table without geometry column.

How can I generate the point locations?

  • You did not include the b.id > a.id constraint from the answer to your previous question. – Vince Sep 27 '17 at 10:14
  • yes you're right. I'll edit my question – zakaria mouqcit Sep 27 '17 at 10:18
  • 1
    you need to use a function that does return a geometry in conjunction with the (boolean) st_touches; try replacing st_touches in your SELECT with st_intersection – ThingumaBob Sep 27 '17 at 11:16
  • thanks for your answer I used st_intersection with st_touches in condition this way : create table touching_point3 as SELECT ST_intersection(a.geom, b.geom) FROM pipe AS a INNER JOIN pipe AS b ON ST_Touches(a.geom, b.geom) WHERE b.id > a.id and ST_Touches(a.geom, b.geom) = true – zakaria mouqcit Sep 27 '17 at 11:24
  • You would need to restrict the dimension of the result, as st_intersection can return a line – JGH Sep 27 '17 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.