ArcGIS Desktop

  • ドキュメント
  • サポート

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ヘルプ

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • その他...

ST_Distance

  • 定義
  • 構文
  • 戻り値のタイプ
  • 例

定義

ST_Distance は、2 つのジオメトリ間の距離を返します。距離は、2 つのジオメトリの最も近い頂点から測定されます。

構文

Oracle および PostgreSQL

sde.st_distance (geometry1 sde.st_geometry, geometry2 sde.st_geometry)

SQLite

st_distance (geometry1 geometryblob, geometry2 geometryblob)

st_distance (geometry1 geometryblob, geometry2 geometryblob, unit_name text)

有効な単位名は次のとおりです。

ミリメートル

Inch

ヤード

リンク

センチメートル

Inch_US

ヤード (US)

リンク (US)

デシメートル

Foot

ヤード (Clarke)

リンク (Clarke)

メートル

Foot_US

ヤード (Sears)

リンク (Sears)

メートル (German)

Foot_Clarke

ヤード (Sears_1922_Truncated)

リンク (Sears_1922_Truncated)

キロメートル

Foot_Sears

ヤード (Benoit_1895_A)

リンク (Benoit_1895_B)

50 キロメートル

Foot_Sears_1922_Truncated

ヤード (Indian)

チェーン

150 キロメートル

Foot_Benoit_1895_A

ヤード (Indian_1937)

チェーン (US)

Vara (US)

Foot_1865

ヤード (Indian_1962)

チェーン (Clarke)

スムート

Foot_Indian

ヤード (Indian_1975)

チェーン (Sears)

Foot_Indian_1937

ファゾム

チェーン (Sears_1922_Truncated)

Foot_Indian_1962

マイル (US)

チェーン (Benoit_1895_A)

Foot_Indian_1975

法定マイル

ロッド

Foot_Gold_Coast

海里

ロッド (US)

Foot_British_1936

海里 (US)

海里 (UK)

戻り値のタイプ

Double precision

例

2 つのテーブル (study1 および zones) が作成され、レコードが追加されます。ST_Distance 関数を使用して、各サブエリアの境界と、study1 エリアにある利用コード 400 のポリゴン間の距離を測定します。このシェープには 3 つのゾーンがあるため、3 レコードが返されます。

Oracle および PostgreSQL では、単位は使用している投影座標系で定義されます。この例では、10 進の度になります。SQLite では、単位を指定できます。SQLite の例では、キロメートルが指定されています。このため、距離はキロメートル単位で返されます。

Oracle

--Create tables and insert values.
CREATE TABLE zones (
 sa_id integer,
 usecode integer,
 shape sde.st_geometry
);

CREATE TABLE study1 (
 code integer unique,
 shape sde.st_geometry
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 1,
 400,
 sde.st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 4326)
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 2,
 400,
 sde.st_polygon ('polygon ((12 3, 12 6, 15 6, 15 3, 12 3))', 4326)
); 

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 3,
 400,
 sde.st_polygon ('polygon ((20 0, 20 10, 30 10, 30 0, 20 0))', 4326)
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 4,
 402,
 sde.st_polygon ('polygon ((40 0, 40 10, 50 10, 50 0, 40 0))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 400,
 sde.st_polygon ('polygon ((-1 -1, -1 11, 11 11, 19 11, 31 11, 31 -1, 19 -1, 11 -1, -1 -1))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 402,
 sde.st_polygon ('polygon ((39 -1, 39 11, 51 11, 51 -1, 39 -1))', 4326)
);
SELECT UNIQUE s.code, z.sa_id, sde.st_distance(z.shape, sde.st_boundary(s.shape)) DISTANCE
 FROM zones z, study1 s
 WHERE z.usecode = s.code AND s.code = 400
 ORDER BY DISTANCE;

code		sa_id      DISTANCE

400		       1					    1
400   			   3					    1
400    			  3					    4

PostgreSQL

--Create tables and insert values.
CREATE TABLE zones (
 sa_id integer,
 usecode integer,
 shape sde.st_geometry
);

CREATE TABLE study1 (
 code integer unique,
 shape sde.st_geometry
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 1,
 400,
 sde.st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 4326)
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 2,
 400,
 sde.st_polygon ('polygon ((12 3, 12 6, 15 6, 15 3, 12 3))', 4326)
); 

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 3,
 400,
 sde.st_polygon ('polygon ((20 0, 20 10, 30 10, 30 0, 20 0))', 4326)
);

INSERT INTO zones (sa_id, usecode, shape) VALUES (
 4,
 402,
 sde.st_polygon ('polygon ((40 0, 40 10, 50 10, 50 0, 40 0))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 400,
 sde.st_polygon ('polygon ((-1 -1, -1 11, 11 11, 19 11, 31 11, 31 -1, 19 -1, 11 -1, -1 -1))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 402,
 sde.st_polygon ('polygon ((39 -1, 39 11, 51 11, 51 -1, 39 -1))', 4326)
);
--
SELECT DISTINCT s.code, z.sa_id, sde.st_distance(z.shape, sde.st_boundary(s.shape))
 AS Distance
 FROM zones z, study1 s
 WHERE z.usecode = s.code AND s.code = 400
 ORDER BY Distance;

code	     sa_id		distance

400            1				  1
400            3			  	1
400     	      2			  	4

SQLite

--Create tables, add geometry columns, and insert values.
CREATE TABLE zones (
 sa_id integer primary key autoincrement not null,
 usecode integer
);

SELECT AddGeometryColumn (
 NULL,
 'zones',
 'shape',
 4326,
 'polygon',
 'xy',
 'null'
);

CREATE TABLE study1 (
 code integer unique
);

SELECT AddGeometryColumn (
 NULL,
 'study1',
 'shape',
 4326,
 'polygon',
 'xy',
 'null'
);

INSERT INTO zones (usecode, shape) VALUES (
 400,
 st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 4326)
);

INSERT INTO zones (usecode, shape) VALUES (
 400,
 st_polygon ('polygon ((12 3, 12 6, 15 6, 15 3, 12 3))', 4326)
); 

INSERT INTO zones (usecode, shape) VALUES (
 400,
 st_polygon ('polygon ((20 0, 20 10, 30 10, 30 0, 20 0))', 4326)
);

INSERT INTO zones (usecode, shape) VALUES (
 402,
 st_polygon ('polygon ((40 0, 40 10, 50 10, 50 0, 40 0))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 400,
 st_polygon ('polygon ((-1 -1, -1 11, 11 11, 19 11, 31 11, 31 -1, 19 -1, 11 -1, -1 -1))', 4326)
);

INSERT INTO study1 (code, shape) VALUES (
 402,
 st_polygon ('polygon ((39 -1, 39 11, 51 11, 51 -1, 39 -1))', 4326)
);
SELECT DISTINCT s.code, z.sa_id, st_distance(z.shape, st_boundary(s.shape), "kilometer") 
 AS "Distance(km)"
 FROM zones z, study1 s
 WHERE z.usecode = s.code AND s.code = 400
 ORDER BY "Distance(km)";

code  		sa_id      Distance(km)

400		       1					 109.63919620267
400   			   3					 109.63919620267
400    			  2					 442.30025845408

関連トピック

  • SQLite の ST_Geometry ライブラリの読み込み

ArcGIS Desktop

  • ホーム
  • ドキュメント
  • サポート

ArcGIS プラットフォーム

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • スタッフ ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
Copyright © 2017 Esri. | プライバシー | リーガル