Commit 4896d9d1 authored by Alice Salsé's avatar Alice Salsé
Browse files

improve lnode trigger when update pipe geom

parent c396131a
......@@ -90,11 +90,15 @@ begin
ELSE ST_ClosestPoint(%3$L, coalesce(lp.geom, p.geom)) END
ELSE
CASE
WHEN ST_DWithin(ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)), ST_StartPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)), %5$s)
THEN st_lineinterpolatepoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), 0.1/st_length(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)))
WHEN ST_DWithin(ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)), ST_EndPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)), %5$s)
THEN st_lineinterpolatepoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), 1-(0.1/st_length(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154))))
ELSE ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)) END
WHEN ST_DWithin(ST_ClosestPoint(%3$L, coalesce(lp.geom, p.geom)), ST_StartPoint(%3$L), %5$s)
OR ST_DWithin(ST_ClosestPoint(%3$L, coalesce(lp.geom, p.geom)), ST_EndPoint(%3$L), %5$s) THEN
CASE
WHEN ST_DWithin(ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)), ST_StartPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)), %5$s)
THEN st_lineinterpolatepoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), 0.1/st_length(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)))
WHEN ST_DWithin(ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)), ST_EndPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154)), %5$s)
THEN st_lineinterpolatepoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), 1-(0.1/st_length(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154))))
ELSE ST_ClosestPoint(ST_SetSRID(St_GeomFromGeoJSON((tp->>''geom'')), 2154), coalesce(lp.geom, p.geom)) END
ELSE ST_ClosestPoint(%3$L, coalesce(lp.geom, p.geom)) END
END ugeom
FROM %1$I.%2$I p
LEFT OUTER JOIN %1$I.lpipe lp ON lp.end_node=p.id
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment