2017-03-15 3 views
0

を使用して、ポイントがラインの頂点の1つであるかどうかを見つける方法PostgreSQLクエリとPostGis関数を使用してポイントがラインの頂点の1つであるかどうかを調べるには?postgresSQLクエリ

ありがとうございます!

答えて

0

ポイントは複数行の一部である場合、あなたは

SELECT 
    /* this will count the number of occurrences of the point in the linestring */ 
    count(
     /* this will be NULL if the point is not equal to the n-th point */ 
     CASE WHEN st_pointn(g.geom, n) = st_geomfromtext('POINT(10 0)') 
      THEN 1 
     END 
    ) > 0 /* result is TRUE if the point is on the multiline */ 
FROM (VALUES(st_geomfromtext('LINESTRING(0 0,10 0,10 10)'))) g(geom) 
    /* this is a table containing all vertex numbers of the linestring */ 
    CROSS JOIN LATERAL generate_series(1, st_numpoints(geom)) n(n); 
のようなものを使用することができます確認するには
関連する問題