ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

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

ArcGIS Online

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

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS Developers

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

ArcGIS Solutions

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

ArcGIS Marketplace

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

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

ArcMap

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • エクステンション

ST_DWithin

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

メモ:

Oracle と PostgreSQL のみ

定義

ST_DWithin は入力として 2 つのジオメトリを取得し、互いが指定した距離内にある場合に true を返し、そうでない場合に false を返します。ジオメトリの空間参照系は、指定した距離に適用される計測単位を決定します。そのため、ST_DWithin に指定するジオメトリは、同じ座標投影と SRID を使用する必要があります。

構文

sde.st_dwithin (st_geometry geometry1, st_geometry geometry2, double_precision distance);

戻り値のタイプ

ブール型

例

次の例では、2 つのテーブルを作成し、それらにフィーチャを挿入します。次に、ST_DWithin 関数を使用して、最初のテーブル内のポイントが 2 つ目のテーブル内のポリゴンから 100 メートル以内にあるかどうかを判定します。

--Create table to store points.
CREATE TABLE dwithin_test_pt (id INT, geom sde.st_geometry);
--Create table to store polygons.
CREATE TABLE dwithin_test_poly (id INT, geom sde.st_geometry);
--Insert features into each table.
INSERT INTO dwithin_test_pt 
 VALUES
 (
  1,
  sde.st_geometry('point (1 2)', 4326)
 )
;
INSERT INTO dwithin_test_pt
 VALUES
 (
  2,
  sde.st_geometry('point (10.02 20.01)', 4326)
 )
;
INSERT INTO dwithin_test_poly
 VALUES
 (
  1,
  sde.st_geometry('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 4326)
 )
;
INSERT INTO dwithin_test_poly
 VALUES
 (
  2,
  sde.st_geometry('polygon ((101.02 200.01, 111.92 350.64, 250.02 340.15, 190.15 330.94, 101.02 200.01))', 4326)
 )
;
次に、ST_DWithin を使用して、各テーブル内で互いに 100 メートル以内にあるフィーチャとそうでないフィーチャを判定します。このステートメントには、フィーチャ間の実際の距離を表示する ST_Distance 関数が含まれています。

--Determine which features in the point table are within 100 meters of the features in the polygon table. SELECT pt.id, poly.id, sde.st_distance(pt.geom, poly.geom) distance_meters, sde.st_dwithin(pt.geom, poly.geom, 100) DWithin
 FROM dwithin_test_pt pt, dwithin_test_poly poly;

SELECT ステートメントを PostgreSQL 内のデータに対して実行すると、以下が返されます。

id     id     distance_meters        dwithin
1      1      20.1425048094819       t
1      2      221.837689538996       f
2      1      0                      t
2      2      201.69531476958        f

このステートメントを Oracle 内のデータに対して実行すると、以下が返されます。

ID     ID   DISTANCE_METERS   DWITHIN 1      1         20.1425048         1 1      2          221.83769         0 2      1                  0         1
2      2         201.695315         0

次の例では、ST_DWithin を使用して、互いに 300 メートル以内にあるフィーチャを検索します。

--Determine which features in the point table are within 300 meters of the features in the polygon table.
SELECT pt.id, poly.id, sde.st_distance(pt.geom, poly.geom) distance_meters, sde.st_dwithin(pt.geom, poly.geom, 300) DWithin
 FROM dwithin_test_pt pt, dwithin_test_poly poly;

この 2 番目の SELECT ステートメントを PostgreSQL 内のデータに対して実行すると、以下が返されます。

id     id     distance_meters        dwithin
1      1      20.1425048094819       t
1      2      221.837689538996       t
2      1      0                      t
2      2      201.69531476958        t

2 番目の SELECT ステートメントを Oracle 内のデータに対して実行すると、以下が返されます。

ID     ID   DISTANCE_METERS    DWITHIN 1      1         20.1425048          1 1      2          221.83769          1 2      1                  0          1
2      2         201.695315          1

ArcGIS Desktop

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

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

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