LoginSignup
0
0

More than 5 years have passed since last update.

【SpatiaLite】2頂点からなるLINESTRINGの頂点座標を求める

Posted at
-- 2頂点p1(x1, y1), p2(x2, y2)を結ぶ線分(LINESTRING)の頂点座標を求める。
SELECT
    X(p1) AS x1,
    Y(p1) AS y1,
    X(p2) AS x2,
    Y(p2) AS y2
FROM
(
    SELECT
        PointN(geom, 1) AS p1,
        PointN(geom, 2) AS p2
    FROM
    (
        SELECT
            GeomFromText('LINESTRING(0 1, 2 3)', 0) AS geom
    )
)

GeomFromText('LINESTRING(0 1, 2 3)', 0)のところを任意のLINESTRINGジオメトリで置き換えればOKです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0