Skip to main content
added 585 characters in body
Source Link

My problem is that I have lines that I want to lengthen and tied them to a point enter image description here

And in case that I have two line one in continuous and the other is cutted I want only the cutted one to be tied( attached or snaped) to the point and the other to stay at its place.

enter image description here

I've tried this code but in the result the two lines has snapped to the point.

SELECT f.gid as gid, 
   ST_Snap(f.Geom, g.Geom, 2) as geom 
FROM cablen as f,  
    (SELECT ST_Collect(Geom) as Geom FROM boiten) as g

enter image description here

enter image description here

In the last case the line has snapped to the point and become tow so like you see i have three line and in the result i found four ones but I want them to be like this

enter image description here

Update

after editing my code to this ,i Found the result geom Null

SELECT f.gid AS gid,
   ST_Snap(
       ST_StartPoint(f.geom),
       ST_ClosestPoint(g.Geom,  ST_StartPoint(f.geom) ),
       ST_Distance(
           ST_StartPoint(f.geom)  ,
           ST_ClosestPoint(g.Geom, ST_StartPoint(f.geom) )
        ) * 1.2
    ) AS geom
FROM (
   SELECT ST_Collect(Geom) as Geom
   FROM bt_sout
   ) AS g,
   cablen AS f

enter image description here

My problem is that I have lines that I want to lengthen and tied them to a point enter image description here

And in case that I have two line one in continuous and the other is cutted I want only the cutted one to be tied( attached or snaped) to the point and the other to stay at its place.

enter image description here

I've tried this code but in the result the two lines has snapped to the point.

SELECT f.gid as gid, 
   ST_Snap(f.Geom, g.Geom, 2) as geom 
FROM cablen as f,  
    (SELECT ST_Collect(Geom) as Geom FROM boiten) as g

enter image description here

enter image description here

In the last case the line has snapped to the point and become tow so like you see i have three line and in the result i found four ones but I want them to be like this

enter image description here

My problem is that I have lines that I want to lengthen and tied them to a point enter image description here

And in case that I have two line one in continuous and the other is cutted I want only the cutted one to be tied( attached or snaped) to the point and the other to stay at its place.

enter image description here

I've tried this code but in the result the two lines has snapped to the point.

SELECT f.gid as gid, 
   ST_Snap(f.Geom, g.Geom, 2) as geom 
FROM cablen as f,  
    (SELECT ST_Collect(Geom) as Geom FROM boiten) as g

enter image description here

enter image description here

In the last case the line has snapped to the point and become tow so like you see i have three line and in the result i found four ones but I want them to be like this

enter image description here

Update

after editing my code to this ,i Found the result geom Null

SELECT f.gid AS gid,
   ST_Snap(
       ST_StartPoint(f.geom),
       ST_ClosestPoint(g.Geom,  ST_StartPoint(f.geom) ),
       ST_Distance(
           ST_StartPoint(f.geom)  ,
           ST_ClosestPoint(g.Geom, ST_StartPoint(f.geom) )
        ) * 1.2
    ) AS geom
FROM (
   SELECT ST_Collect(Geom) as Geom
   FROM bt_sout
   ) AS g,
   cablen AS f

enter image description here

Source Link

How to attach lines to points QGIS using Postgis?

My problem is that I have lines that I want to lengthen and tied them to a point enter image description here

And in case that I have two line one in continuous and the other is cutted I want only the cutted one to be tied( attached or snaped) to the point and the other to stay at its place.

enter image description here

I've tried this code but in the result the two lines has snapped to the point.

SELECT f.gid as gid, 
   ST_Snap(f.Geom, g.Geom, 2) as geom 
FROM cablen as f,  
    (SELECT ST_Collect(Geom) as Geom FROM boiten) as g

enter image description here

enter image description here

In the last case the line has snapped to the point and become tow so like you see i have three line and in the result i found four ones but I want them to be like this

enter image description here