此代码快照到点。任何想法如何修改代码以将点捕捉到行。感谢。
DROP TABLE IF EXISTS test_gps_point2;
SELECT D.ordinality As sub_id, D.geom::geometry(LINESTRING,3414) AS
geom INTO test_table
FROM
gtd1304_line_2a AS L
LEFT JOIN LATERAL
( -- form a multipoint of all the nodes
-- close enough to line to be considered on the line
SELECT
ST_Union(N.geom ORDER BY L.matched_line <-> N.geom) AS geom
FROM gtd1304_point_2 AS N
WHERE ST_DWithin(L.matched_line, N.geom, 10000)
) AS MP ON TRUE
CROSS JOIN LATERAL
-- snap the LINE to the MP which forces nodes to be injected to the line
-- then split at these node location and dump multilinestring into individual lines
ST_Dump(
COALESCE(ST_Split(ST_Snap(MP.geom, L.matched_line, 10), matched_line), MP.geom)
) WITH ORDINALITY AS D;
答案 0 :(得分:0)
据我所知,您至少不能使用ST_Snap做到这一点。我认为原因是因为既然您将A捕捉到B上并取回类型B并贴紧了B的东西,那么您就无法取回上面贴有类型点的类型点的东西,因为它变成了一条线。