ワークフロー: 既存のフィーチャクラスでの SQL の使用

このトピックは、ArcEditor および ArcInfo にのみ適用されます。

複雑さ: 中級者 データ要件: ArcGIS チュートリアル データのセットアップ

ArcGIS で空間タイプを使用する際の主要機能の 1 つに、SQL 経由でのジオメトリの追加と編集があります。このトピックでは、ArcGIS Desktop でフィーチャクラスを作成し、SQL でフィーチャクラスを編集する方法を説明します。また、結果が同じであることを示すために、フィーチャクラスからの空間検索を SQL と ArcGIS Desktop で行います。

ArcCatalog での空のフィーチャクラスの作成

次の例では、ArcCatalog で空のフィーチャクラスを作成する方法を説明します。

手順:
  1. ArcCatalog を起動し、カタログ ツリーの [データベース コネクション] フォルダを展開します。
  2. ST_Geometry 列が含まれた空のフィーチャクラスの作成先となるジオデータベースに接続します。
  3. ジオデータベースを右クリックし、[新規作成] をポイントし、[フィーチャクラス] をクリックします。
  4. [名前] テキスト ボックスに「buildings」と入力します。
  5. この場合のフィーチャクラスのタイプはポリゴンなので、[タイプ] として [ポリゴン フィーチャ] が選択されていることを確認して [次へ] をクリックします。
  6. 座標系には、[NAD_1983_UTM_Zone_13N] を選択します。この選択を行うには、[Projected Coordinate Systems] → [UTM] → [NAD 1983] フォルダの順に展開してから、[NAD 1983 UTM Zone 13N] をクリックします。

    座標系を参照して選択します。

  7. [次へ] をクリックします。
  8. デフォルトの XY 許容値を受け入れ、[次へ] をクリックします。
  9. どのコンフィグレーション キーワードを使用するかは、DBTUNE テーブルにある DEFAULTS キーワードの GEOMETRY_STORAGE パラメータの設定によって異なります。
    • IBM DB2 または Informix でジオデータベースのフィーチャクラスを作成している場合や、デフォルトのジオメトリ格納に ST_Geometry を使用する Oracle や PostgreSQL でジオデータベースのフィーチャクラスを作成している場合は、デフォルトのコンフィグレーション キーワードを受け入れて、[次へ] をクリックしてかまいません。
    • デフォルトのジオメトリ格納タイプが ST_Geometry 以外の Oracle または PostgreSQL でジオデータベースのフィーチャクラスを作成している場合は、[コンフィグレーション キーワードを使用] を選択し、ドロップダウン リストから ST_GEOMETRY の GEOMETRY_STORAGE タイプを格納するコンフィグレーション キーワードを選択してから、[次へ] をクリックします。
  10. [フィールド名] テキスト ボックスにフィールド名を入力し、[データ タイプ] ドロップダウン リストからデータ タイプを選択してから、必要に応じて長さを入力して、これらの定義を持つ次の属性フィールドを追加します。
    注意注意:

    [ObjectID] フィールドと [SHAPE] フィールドは、自動的にフィーチャクラスに追加されます。それ以外のフィールドは手動で追加する必要があります。フィールドの追加は、記載どおりの順序で行ってください。

    フィールド名

    データ タイプ

    フィールド プロパティ

    FID

    Long Integer

    Null 値を許可

    TYPE

    Text

    長さ = 3

    Null 値を許可

    SUBTYPE

    Text

    長さ = 6

    Null 値を許可

  11. [完了] をクリックします。

これで、buildings という名前の空のフィーチャクラスができました。次に、SQL を使って、空間参照 ID を確認し、フィーチャクラスにフィーチャを追加します。

フィーチャクラスの SRID の確認

フィーチャクラスにフィーチャを追加する前に、フィーチャクラスの SRID 値を確認する必要があります。SRID はフィーチャクラスをジオデータベースで作成したときに割り当てられ、各種の ArcSDE ジオデータベース システム テーブルに格納されます。

作成したフィーチャクラスの ST_Geometry SRID を確認するには、SQL SELECT ステートメントを使用します。Oracle の場合は ST_GEOMETRY_COLUMNS テーブルから、Informix および DB2 の場合は geometry_columns テーブルから、PostgreSQL の場合は sde_geometry_columns テーブルから SRID 値を選択します。

手順:
  1. Oracle の SQL*Plus や PostgreSQL の psql など、SQL エディタを起動します。

    必ず、ArcGIS Desktop で Buildings フィーチャクラスを作成したときと同じユーザとしてログインしてください。

  2. 次の SQL ステートメントを実行してフィーチャクラスの SRID を確認します。
    • Oracle
      SELECT table_name, srid 
      FROM sde.st_geometry_columns 
      WHERE table_name = 'BUILDINGS'
      AND owner_name = 'NEYES';
    • PostgreSQL
      SELECT f_table_name, srid
      FROM sde.sde_geometry_columns
      WHERE f_table_name = 'buildings'
      AND owner_name = 'neyes';
    • DB2
      SELECT layer_table, srid
      FROM db2gse.geometry_columns
      WHERE layer_table = 'BUILDINGS'
      AND owner_name = 'NEYES';
    • Informix
      SELECT f_table_name, srid
      FROM sde.geometry_columns
      WHERE f_table_name = 'buildings'
      AND owner_name = 'neyes';

フィーチャクラスへのレコードの挿入には、これらのクエリで返される SRID が使用されます。

フィーチャクラスの REGISTRATION_ID の確認

また、SQL でフィーチャクラスにレコードを挿入する前に、TABLE_REGISTRY テーブルを検索してフィーチャクラスの REGISTRATION_ID を取得する必要があります。

Oracle

SELECT registration_id
FROM sde.table_registry
WHERE table_name = 'BUILDINGS'
AND owner_name = 'NEYES';

REGISTRATION_ID
40

PostgreSQL

SELECT registration_id
FROM sde.sde_table_registry
WHERE table_name = 'buildings'
AND owner_name = 'neyes';

REGISTRATION_ID
40

DB2

SELECT registration_id
FROM sde.table_registry
WHERE table_name = 'BUILDINGS'
AND owner_name = 'NEYES';

REGISTRATION_ID
40

Informix

SELECT registration_id
FROM sde.table_registry
WHERE table_name = 'buildings'
AND owner_name = 'neyes';

REGISTRATION_ID
40

ObjectID 値の取得には、このクエリで返される数値を使用します。

どのフィーチャクラスにも ObjectID 列が含まれています。この列の値はジオデータベースによって生成されます。このため、SQL で既存のフィーチャクラスにレコードを挿入する際には、SQL コマンドの一部としてユーティリティを実行したうえで、利用可能な次の ObjectID 値を取得して ObjectID 列に挿入する必要があります。

SQL を使用したフィーチャクラスへのフィーチャの挿入

SQL エディタを使用してフィーチャクラス ビジネス テーブルにレコードを追加し、ArcCatalog でフィーチャをプレビューします。

フィーチャクラスにレコードを挿入する際には、前の 2 つのセクションで取得した SRID と REGISTRATION_ID を使用します。

ObjectID 値の取得には、DBMS に応じたユーティリティを使用します。Oracle と PostgreSQL の場合は、ObjectID 値の取得にサブクエリのユーティリティを使用できます。DB2 と Informix の場合は、ユーティリティを実行して Object ID 値を取得し、その値を INSERT ステートメントで使用します。

注意注意:

DB2 でジオデータベースにデータを挿入する際には、db2gse. で空間タイプ関数を修飾する必要があります。たとえば、以下の例の場合、ST_Geometry は db2gse.ST_Geometry になります。その他の DBMS の場合は、空間タイプ関数を sde. で修飾します。

手順:
  1. 次のコマンドを発行して、フィーチャクラスにフィーチャを挿入します。

    INSERT ステートメントの末尾の 17 を実際のフィーチャクラスの SRID で置き換え、tbl_owner をフィーチャクラス所有者のユーザ名で、ユーティリティ クエリの 40 を実際のフィーチャクラスの REGISTRATION_ID で置き換えてください。

    • Oracle
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      18907, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219520.56768649 387051.66985716, 
      2219525.34823696 387079.52399077, 2219536.03133855 387077.71905252, 
      2219539.05578917 387095.47546386, 2219528.17754562 387097.32910505, 
      2219528.61661291 387099.81695550, 2219489.00622816 387106.54876471, 
      2219480.81097279 387058.40167483, 2219520.56768649 387051.66985716))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19053, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219612.86639158 386903.72709265, 
      2219612.86832175 386907.20474822, 2219619.82528792 386906.03131444, 
      2219624.05814397 386930.50637511, 2219602.30717225 386934.19443199, 
      2219602.68435556 386936.33176596, 2219595.81121637 386937.54715132, 
      2219595.51783041 386935.61930861, 2219582.14872687 386937.88243384, 
      2219577.95779702 386913.07208642, 2219595.22446985 386910.09649113, 
      2219593.59000886 386900.45735373, 2219612.86269632 386897.06148069, 
      2219612.86639158 386903.72709265))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19136, 'BLD', 'BLD', sde.st_geoometry 
      ('polygon (( 2219733.93687411 386826.88586815, 
      2219735.30274506 386834.88599003, 2219725.20502702 386836.59337847, 
      2219723.83915606 386828.59325658, 2219733.93687411 386826.88586815))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      18822, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219318.56450844 387185.37926723, 
      2219320.27185454 387197.62335210, 2219311.29614139 387198.94049048, 
      2219309.58880798 387186.69635058, 2219318.56450844 387185.37926723))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19095, 'BLD', 'BLD', sde.st_geometry
      ('polygon (( 2219357.88220142 386887.66730143, 
      2219360.46761861 386898.54553227, 2219350.56500020 386900.98462474, 
      2219347.97961264 386890.10638120, 2219357.88220142 386887.66730143))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      18863, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219640.86224883 387097.71935934, 
      2219658.37473060 387147.67138324, 2219620.66681275 387160.89111018, 
      2219609.69104055 387129.67108043, 2219619.00825848 387126.35393804, 
      2219612.47155737 387107.67078229, 2219640.86224883 387097.71935934))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19038, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219498.86004627 386911.32623002, 
      2219505.93331369 386953.22930633, 2219453.63980640 386962.05871170, 
      2219448.56655992 386931.86309469, 2219465.10339963 386929.08257787, 
      2219463.15216206 386917.37511856, 2219498.86004627 386911.32623002))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40),  
      18859, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219537.93380545 387110.93908628, 
      2219546.81201112 387161.33014361, 2219498.76248799 387169.86682333, 
      2219493.68920765 387140.93957403, 2219516.07980240 387136.98828165, 
      2219512.32366468 387115.52454135, 2219537.93380545 387110.93908628))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40),  
      18921, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219630.32549736 387032.49884228, 
      2219638.42319022 387080.93859854, 2219602.27627682 387087.03625775, 
      2219599.44695969 387070.06042272, 2219594.95910946 387070.84088050, 
      2219589.69069987 387039.32824786, 2219630.32549736 387032.49884228))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40),  
      18000, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219428.55884565 386927.35910468, 
      2219434.90911597 386965.59318031, 2219412.50672431 386969.25340210, 
      2219412.90361568 386971.59064420, 2219405.49494299 386972.82544978, 
      2219405.18625535 386970.70870430, 2219391.47137188 386973.00185724, 
      2219387.14966448 386946.93921840, 2219404.70113486 386944.07272009, 
      2219402.67258040 386931.63676100, 2219428.55884565 386927.35910468))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19116, 'BLD', 'BLD', sde.st_geometry ('polygon (( 2219672.66761980 386847.66674281, 
      2219676.37499955 386866.54504475, 2219663.35040187 386869.13042807, 
      2219659.64303058 386850.25207534, 2219672.66761980 386847.66674281))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40),  
      18962, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219556.03164537 387046.25513130, 
      2219557.49509154 387055.03576599, 2219547.05591105 387056.74309940, 
      2219545.59246912 387047.96251973, 2219556.03164537 387046.25513130))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      18833, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219383.93139678 387137.86633157, 
      2219389.05343086 387190.74523511, 2219359.00421054 387193.57452260, 
      2219353.93090903 387140.69568256, 2219383.93139678 387137.86633157))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      18884, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219373.44344985 387075.37756489, 
      2219382.32162166 387124.54907598, 2219362.80911894 387128.11010561, 
      2219359.44323973 387109.62200293, 2219339.54046156 387113.28058238, 
      2219333.97942791 387082.54840752, 2219373.44344985 387075.37756489))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19071, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219682.28129249 386891.68291590, 
      2219686.92111827 386918.49082923, 2219640.56580254 386926.48163888, 
      2219635.92597252 386899.67372556, 2219682.28129249 386891.68291590))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19044, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219553.98285375 386902.15533258, 
      2219555.78774544 386913.03356343, 2219560.95856289 386912.15551350, 
      2219565.78790520 386940.83886287, 2219517.98226930 386948.93658960, 
      2219513.15292276 386920.20440606, 2219516.17736068 386919.66779319, 
      2219514.37246900 386908.88714178, 2219553.98285375 386902.15533258))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19027, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219363.11822986 386945.42381000, 
      2219367.93141545 386973.32232908, 2219320.06718025 386981.52254956, 
      2219315.29857060 386953.62397969, 2219363.11822986 386945.42381000))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19082, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219744.18548833 386871.29585958, 
      2219746.55761318 386884.95597445, 2219743.44931865 386885.52860025, 
      2219747.49828784 386908.59539393, 2219704.96369012 386916.03897901, 
      2219700.42393269 386890.23190579, 2219729.62557524 386885.11957759, 
      2219727.74423440 386874.19963643, 2219744.18548833 386871.29585958))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19105, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219424.32229434 386872.05730772, 
      2219426.12719873 386882.05749711, 2219416.56607240 386883.81360119, 
      2219414.76116801 386873.81342026, 2219424.32229434 386872.05730772))', 
      17)
      );
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (sde.version_user_ddl.next_row_id('tbl_owner', 40), 
      19120, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219553.73895382 386851.52038802, 
      2219555.25115373 386859.91077266, 
      2219545.25100667 386861.81323532, 
      2219543.69000222 386853.42285069, 
      2219553.73895382 386851.52038802))', 
      3)
      );
      
      COMMIT;
    • PostgreSQL

      関数名の gis を、Buildings フィーチャクラスを作成したユーザ名に置き換えてください。

      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18907, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219520.56768649 387051.66985716, 
      2219525.34823696 387079.52399077, 2219536.03133855 387077.71905252, 
      2219539.05578917 387095.47546386, 2219528.17754562 387097.32910505, 
      2219528.61661291 387099.81695550, 2219489.00622816 387106.54876471, 
      2219480.81097279 387058.40167483, 2219520.56768649 387051.66985716))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19053, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219612.86639158 386903.72709265, 
      2219612.86832175 386907.20474822, 2219619.82528792 386906.03131444, 
      2219624.05814397 386930.50637511, 2219602.30717225 386934.19443199, 
      2219602.68435556 386936.33176596, 2219595.81121637 386937.54715132, 
      2219595.51783041 386935.61930861, 2219582.14872687 386937.88243384, 
      2219577.95779702 386913.07208642, 2219595.22446985 386910.09649113, 
      2219593.59000886 386900.45735373, 2219612.86269632 386897.06148069, 
      2219612.86639158 386903.72709265))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19136, 'BLD', 'BLD', sde.st_geoometry 
      ('polygon (( 2219733.93687411 386826.88586815, 
      2219735.30274506 386834.88599003, 2219725.20502702 386836.59337847, 
      2219723.83915606 386828.59325658, 2219733.93687411 386826.88586815))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18822, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219318.56450844 387185.37926723, 
      2219320.27185454 387197.62335210, 2219311.29614139 387198.94049048, 
      2219309.58880798 387186.69635058, 2219318.56450844 387185.37926723))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19095, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219357.88220142 386887.66730143, 
      2219360.46761861 386898.54553227, 2219350.56500020 386900.98462474, 
      2219347.97961264 386890.10638120, 2219357.88220142 386887.66730143))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18863, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219640.86224883 387097.71935934, 
      2219658.37473060 387147.67138324, 2219620.66681275 387160.89111018, 
      2219609.69104055 387129.67108043, 2219619.00825848 387126.35393804, 
      2219612.47155737 387107.67078229, 2219640.86224883 387097.71935934))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19038, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219498.86004627 386911.32623002, 
      2219505.93331369 386953.22930633, 2219453.63980640 386962.05871170, 
      2219448.56655992 386931.86309469, 2219465.10339963 386929.08257787, 
      2219463.15216206 386917.37511856, 2219498.86004627 386911.32623002))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18859, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219537.93380545 387110.93908628, 
      2219546.81201112 387161.33014361, 2219498.76248799 387169.86682333, 
      2219493.68920765 387140.93957403, 2219516.07980240 387136.98828165, 
      2219512.32366468 387115.52454135, 2219537.93380545 387110.93908628))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18921, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219630.32549736 387032.49884228, 
      2219638.42319022 387080.93859854, 2219602.27627682 387087.03625775, 
      2219599.44695969 387070.06042272, 2219594.95910946 387070.84088050, 
      2219589.69069987 387039.32824786, 2219630.32549736 387032.49884228))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18000, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219428.55884565 386927.35910468, 
      2219434.90911597 386965.59318031, 2219412.50672431 386969.25340210, 
      2219412.90361568 386971.59064420, 2219405.49494299 386972.82544978, 
      2219405.18625535 386970.70870430, 2219391.47137188 386973.00185724, 
      2219387.14966448 386946.93921840, 2219404.70113486 386944.07272009, 
      2219402.67258040 386931.63676100, 2219428.55884565 386927.35910468))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19116, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219672.66761980 386847.66674281, 
      2219676.37499955 386866.54504475, 2219663.35040187 386869.13042807, 
      2219659.64303058 386850.25207534, 2219672.66761980 386847.66674281))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18962, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219556.03164537 387046.25513130, 
      2219557.49509154 387055.03576599, 2219547.05591105 387056.74309940, 
      2219545.59246912 387047.96251973, 2219556.03164537 387046.25513130))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18833, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219383.93139678 387137.86633157, 
      2219389.05343086 387190.74523511, 2219359.00421054 387193.57452260, 
      2219353.93090903 387140.69568256, 2219383.93139678 387137.86633157))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      18884, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219373.44344985 387075.37756489, 
      2219382.32162166 387124.54907598, 2219362.80911894 387128.11010561, 
      2219359.44323973 387109.62200293, 2219339.54046156 387113.28058238, 
      2219333.97942791 387082.54840752, 2219373.44344985 387075.37756489))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19071, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219682.28129249 386891.68291590, 
      2219686.92111827 386918.49082923, 2219640.56580254 386926.48163888, 
      2219635.92597252 386899.67372556, 2219682.28129249 386891.68291590))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19044, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219553.98285375 386902.15533258, 
      2219555.78774544 386913.03356343, 2219560.95856289 386912.15551350, 
      2219565.78790520 386940.83886287, 2219517.98226930 386948.93658960, 
      2219513.15292276 386920.20440606, 2219516.17736068 386919.66779319, 
      2219514.37246900 386908.88714178, 2219553.98285375 386902.15533258))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19027, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219363.11822986 386945.42381000, 
      2219367.93141545 386973.32232908, 2219320.06718025 386981.52254956, 
      2219315.29857060 386953.62397969, 2219363.11822986 386945.42381000))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19082, 'BLD', 'RES', sde.st_geometry 
      ('polygon (( 2219744.18548833 386871.29585958, 
      2219746.55761318 386884.95597445, 2219743.44931865 386885.52860025, 
      2219747.49828784 386908.59539393, 2219704.96369012 386916.03897901, 
      2219700.42393269 386890.23190579, 2219729.62557524 386885.11957759, 
      2219727.74423440 386874.19963643, 2219744.18548833 386871.29585958))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19105, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219424.32229434 386872.05730772, 
      2219426.12719873 386882.05749711, 2219416.56607240 386883.81360119, 
      2219414.76116801 386873.81342026, 2219424.32229434 386872.05730772))', 
      17)
      );
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      ((SELECT o_base_id FROM gis.i40_get_ids(2,1)), 
      19120, 'BLD', 'BLD', sde.st_geometry 
      ('polygon (( 2219553.73895382 386851.52038802, 
      2219555.25115373 386859.91077266, 2219545.25100667 386861.81323532, 
      2219543.69000222 386853.42285069, 2219553.73895382 386851.52038802))', 
      17)
      );
    • DB2

      ObjectID 値は挿入する各レコードごとに必要です。next_row_id プロシージャを呼び出して値を取得します。

      CALL SDE.next_row_id('tbl_owner',40,?,?,?)
      Value of output parameters
      
      Parameter Name : O_ROWID
      Parameter Value : 43
      
      Parameter Name : O_MSGCODE
      Parameter Value : 0
      
      Parameter Name : O_MESSAGE
      Parameter value : Procedure successfully completed.
      
      Return status = 1

      各 INSERT ステートメントについて、この操作を繰り返します。20 件のレコードを挿入するため、20 個の値が必要です。

      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (43, 18907, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219520.56768649 387051.66985716, 2219525.34823696 387079.52399077, 
      2219536.03133855 387077.71905252, 2219539.05578917 387095.47546386, 
      2219528.17754562 387097.32910505, 2219528.61661291 387099.81695550, 
      2219489.00622816 387106.54876471, 2219480.81097279 387058.40167483, 
      2219520.56768649 387051.66985716))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (44, 19053, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219612.86639158 386903.72709265, 2219612.86832175 386907.20474822, 
      2219619.82528792 386906.03131444, 2219624.05814397 386930.50637511, 
      2219602.30717225 386934.19443199, 2219602.68435556 386936.33176596, 
      2219595.81121637 386937.54715132, 2219595.51783041 386935.61930861, 
      2219582.14872687 386937.88243384, 2219577.95779702 386913.07208642, 
      2219595.22446985 386910.09649113, 2219593.59000886 386900.45735373, 
      2219612.86269632 386897.06148069, 2219612.86639158 386903.72709265))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (45, 19136, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219733.93687411 386826.88586815, 2219735.30274506 386834.88599003, 
      2219725.20502702 386836.59337847, 2219723.83915606 386828.59325658, 
      2219733.93687411 386826.88586815))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (46, 18822, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219318.56450844 387185.37926723, 2219320.27185454 387197.62335210, 
      2219311.29614139 387198.94049048, 2219309.58880798 387186.69635058, 
      2219318.56450844 387185.37926723))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (47, 19095, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219357.88220142 386887.66730143, 2219360.46761861 386898.54553227, 
      2219350.56500020 386900.98462474, 2219347.97961264 386890.10638120, 
      2219357.88220142 386887.66730143))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (48, 18863, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219640.86224883 387097.71935934, 2219658.37473060 387147.67138324, 
      2219620.66681275 387160.89111018, 2219609.69104055 387129.67108043, 
      2219619.00825848 387126.35393804, 2219612.47155737 387107.67078229, 
      2219640.86224883 387097.71935934))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (49, 19038, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219498.86004627 386911.32623002, 2219505.93331369 386953.22930633, 
      2219453.63980640 386962.05871170, 2219448.56655992 386931.86309469, 
      2219465.10339963 386929.08257787, 2219463.15216206 386917.37511856, 
      2219498.86004627 386911.32623002))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (50, 18859, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219537.93380545 387110.93908628, 2219546.81201112 387161.33014361,
      2219498.76248799 387169.86682333, 2219493.68920765 387140.93957403, 
      2219516.07980240 387136.98828165, 2219512.32366468 387115.52454135, 
      2219537.93380545 387110.93908628))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (51, 18921, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219630.32549736 387032.49884228, 2219638.42319022 387080.93859854, 
      2219602.27627682 387087.03625775, 2219599.44695969 387070.06042272, 
      2219594.95910946 387070.84088050, 2219589.69069987 387039.32824786, 
      2219630.32549736 387032.49884228))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, subtype, shape)
      VALUES
      (52, 18000, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219428.55884565 386927.35910468, 2219434.90911597 386965.59318031, 
      2219412.50672431 386969.25340210, 2219412.90361568 386971.59064420, 
      2219405.49494299 386972.82544978, 2219405.18625535 386970.70870430, 
      2219391.47137188 386973.00185724, 2219387.14966448 386946.93921840,
      2219404.70113486 386944.07272009, 2219402.67258040 386931.63676100, 
      2219428.55884565 386927.35910468))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (53, 19116, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219672.66761980 386847.66674281, 2219676.37499955 386866.54504475, 
      2219663.35040187 386869.13042807, 2219659.64303058 386850.25207534, 
      2219672.66761980 386847.66674281))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (54, 18962, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219556.03164537 387046.25513130, 2219557.49509154 387055.03576599, 
      2219547.05591105 387056.74309940, 2219545.59246912 387047.96251973, 
      2219556.03164537 387046.25513130))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (55, 18833, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219383.93139678 387137.86633157, 2219389.05343086 387190.74523511, 
      2219359.00421054 387193.57452260, 2219353.93090903 387140.69568256, 
      2219383.93139678 387137.86633157))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (56, 18884, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219373.44344985 387075.37756489, 2219382.32162166 387124.54907598, 
      2219362.80911894 387128.11010561, 2219359.44323973 387109.62200293, 
      2219339.54046156 387113.28058238, 2219333.97942791 387082.54840752, 
      2219373.44344985 387075.37756489))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (57, 19071, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219682.28129249 386891.68291590, 2219686.92111827 386918.49082923, 
      2219640.56580254 386926.48163888, 2219635.92597252 386899.67372556, 
      2219682.28129249 386891.68291590))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (58, 19044, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219553.98285375 386902.15533258, 2219555.78774544 386913.03356343, 
      2219560.95856289 386912.15551350, 2219565.78790520 386940.83886287, 
      2219517.98226930 386948.93658960, 2219513.15292276 386920.20440606, 
      2219516.17736068 386919.66779319, 2219514.37246900 386908.88714178, 
      2219553.98285375 386902.15533258))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (59, 19027, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219363.11822986 386945.42381000, 2219367.93141545 386973.32232908, 
      2219320.06718025 386981.52254956, 2219315.29857060 386953.62397969, 
      2219363.11822986 386945.42381000))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (60, 19082, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219744.18548833 386871.29585958, 2219746.55761318 386884.95597445, 
      2219743.44931865 386885.52860025, 2219747.49828784 386908.59539393, 
      2219704.96369012 386916.03897901, 2219700.42393269 386890.23190579, 
      2219729.62557524 386885.11957759, 2219727.74423440 386874.19963643, 
      2219744.18548833 386871.29585958))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (61, 19105, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219424.32229434 386872.05730772, 2219426.12719873 386882.05749711, 
      2219416.56607240 386883.81360119, 2219414.76116801 386873.81342026, 
      2219424.32229434 386872.05730772))', 17));
      
      INSERT INTO BUILDINGS
      (objectid, fid, type, subtype, shape)
      VALUES
      (62, 19120, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219553.73895382 386851.52038802, 2219555.25115373 386859.91077266, 
      2219545.25100667 386861.81323532, 2219543.69000222 386853.42285069, 
      2219553.73895382 386851.52038802))', 17));
      
      COMMIT;
    • Informix

      ObjectID 値は挿入する各レコードごとに必要です。next_row_id 関数を実行して値を取得します。

      EXECUTE FUNCTION "sde".next_row_id('tbl_owner',40);
      
      ret_code 0
      err_msg
      rowid 31
      
      1 row(s) retrieved.

      各 INSERT ステートメントについて、この操作を繰り返します。20 件のレコードを挿入するため、20 個の値が必要です。

      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (31, 18907, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219520.56768649 387051.66985716, 2219525.34823696 387079.52399077, 
      2219536.03133855 387077.71905252, 2219539.05578917 387095.47546386, 
      2219528.17754562 387097.32910505, 2219528.61661291 387099.81695550, 
      2219489.00622816 387106.54876471, 2219480.81097279 387058.40167483, 
      2219520.56768649 387051.66985716))', 
      17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (32, 19053, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219612.86639158 386903.72709265, 2219612.86832175 386907.20474822, 
      2219619.82528792 386906.03131444, 2219624.05814397 386930.50637511, 
      2219602.30717225 386934.19443199, 2219602.68435556 386936.33176596, 
      2219595.81121637 386937.54715132, 2219595.51783041 386935.61930861, 
      2219582.14872687 386937.88243384, 2219577.95779702 386913.07208642, 
      2219595.22446985 386910.09649113, 2219593.59000886 386900.45735373, 
      2219612.86269632 386897.06148069, 2219612.86639158 386903.72709265))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (33, 19136, 'BLD', 'BLD', db2gse.st_geoometry 
      ('polygon (( 2219733.93687411 386826.88586815, 2219735.30274506 386834.88599003, 
      2219725.20502702 386836.59337847, 2219723.83915606 386828.59325658, 
      2219733.93687411 386826.88586815))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (34, 18822, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219318.56450844 387185.37926723, 2219320.27185454 387197.62335210, 
      2219311.29614139 387198.94049048, 2219309.58880798 387186.69635058, 
      2219318.56450844 387185.37926723))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (35, 19095, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219357.88220142 386887.66730143, 2219360.46761861 386898.54553227, 
      2219350.56500020 386900.98462474, 2219347.97961264 386890.10638120, 
      2219357.88220142 386887.66730143))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (36, 18863, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219640.86224883 387097.71935934, 2219658.37473060 387147.67138324, 
      2219620.66681275 387160.89111018, 2219609.69104055 387129.67108043, 
      2219619.00825848 387126.35393804, 2219612.47155737 387107.67078229, 
      2219640.86224883 387097.71935934))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (37, 19038, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219498.86004627 386911.32623002, 2219505.93331369 386953.22930633, 
      2219453.63980640 386962.05871170, 2219448.56655992 386931.86309469, 
      2219465.10339963 386929.08257787, 2219463.15216206 386917.37511856, 
      2219498.86004627 386911.32623002))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (38, 18859, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219537.93380545 387110.93908628, 2219546.81201112 387161.33014361,
      2219498.76248799 387169.86682333, 2219493.68920765 387140.93957403, 
      2219516.07980240 387136.98828165, 2219512.32366468 387115.52454135, 
      2219537.93380545 387110.93908628))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (39, 18921, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219630.32549736 387032.49884228, 2219638.42319022 387080.93859854, 
      2219602.27627682 387087.03625775, 2219599.44695969 387070.06042272, 
      2219594.95910946 387070.84088050, 2219589.69069987 387039.32824786, 
      2219630.32549736 387032.49884228))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (40, 18000, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219428.55884565 386927.35910468, 2219434.90911597 386965.59318031, 
      2219412.50672431 386969.25340210, 2219412.90361568 386971.59064420, 
      2219405.49494299 386972.82544978, 2219405.18625535 386970.70870430, 
      2219391.47137188 386973.00185724, 2219387.14966448 386946.93921840,
      2219404.70113486 386944.07272009, 2219402.67258040 386931.63676100, 
      2219428.55884565 386927.35910468))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (41, 19116, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219672.66761980 386847.66674281, 2219676.37499955 386866.54504475, 
      2219663.35040187 386869.13042807, 2219659.64303058 386850.25207534, 
      2219672.66761980 386847.66674281))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (42, 18962, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219556.03164537 387046.25513130, 2219557.49509154 387055.03576599, 
      2219547.05591105 387056.74309940, 2219545.59246912 387047.96251973, 
      2219556.03164537 387046.25513130))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (43, 18833, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219383.93139678 387137.86633157, 2219389.05343086 387190.74523511, 
      2219359.00421054 387193.57452260, 2219353.93090903 387140.69568256, 
      2219383.93139678 387137.86633157))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (44, 18884, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219373.44344985 387075.37756489, 2219382.32162166 387124.54907598, 
      2219362.80911894 387128.11010561, 2219359.44323973 387109.62200293, 
      2219339.54046156 387113.28058238, 2219333.97942791 387082.54840752, 
      2219373.44344985 387075.37756489))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (45, 19071, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219682.28129249 386891.68291590, 2219686.92111827 386918.49082923, 
      2219640.56580254 386926.48163888, 2219635.92597252 386899.67372556, 
      2219682.28129249 386891.68291590))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (46, 19044, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219553.98285375 386902.15533258, 2219555.78774544 386913.03356343, 
      2219560.95856289 386912.15551350, 2219565.78790520 386940.83886287, 
      2219517.98226930 386948.93658960, 2219513.15292276 386920.20440606, 
      2219516.17736068 386919.66779319, 2219514.37246900 386908.88714178, 
      2219553.98285375 386902.15533258))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (47, 19027, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219363.11822986 386945.42381000, 2219367.93141545 386973.32232908, 
      2219320.06718025 386981.52254956, 2219315.29857060 386953.62397969, 
      2219363.11822986 386945.42381000))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (48, 19082, 'BLD', 'RES', db2gse.st_geometry 
      ('polygon (( 2219744.18548833 386871.29585958, 2219746.55761318 386884.95597445, 
      2219743.44931865 386885.52860025, 2219747.49828784 386908.59539393, 
      2219704.96369012 386916.03897901, 2219700.42393269 386890.23190579, 
      2219729.62557524 386885.11957759, 2219727.74423440 386874.19963643, 
      2219744.18548833 386871.29585958))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (49, 19105, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219424.32229434 386872.05730772, 2219426.12719873 386882.05749711, 
      2219416.56607240 386883.81360119, 2219414.76116801 386873.81342026, 
      2219424.32229434 386872.05730772))', 17));
      
      INSERT INTO buildings
      (objectid, fid, type, subtype, shape)
      VALUES
      (50, 19120, 'BLD', 'BLD', db2gse.st_geometry 
      ('polygon (( 2219553.73895382 386851.52038802, 2219555.25115373 386859.91077266, 
      2219545.25100667 386861.81323532, 2219543.69000222 386853.42285069, 
      2219553.73895382 386851.52038802))', 17));
      COMMIT;
  2. ここで、ArcMap を起動して、挿入したレコードをプレビューします。
  3. [スタート] [すべてのプログラム] [ArcGIS] [ArcMap 10] の順にクリックして、ArcMap を起動します。
  4. [カタログ ウィンドウ] ボタン カタログ ウィンドウ をクリックし、カタログ ウィンドウを表示します。
  5. Buildings フィーチャクラスを作成したジオデータベースに接続します。
  6. Buildings フィーチャクラスを ArcMap のコンテンツ ウィンドウにドラッグします。

    これにより、SQL でフィーチャクラスに挿入したフィーチャが表示されるようになります。

フィルタ設定の適用

特定の属性を持つフィーチャが表示されるよう、レイヤにはフィルタ設定を適用できます。たとえば、人口が特定の閾値を超える都市だけを表示したい場合があります。この場合は、独自の条件式を入力するか、[検索条件設定] を使用してクエリ条件式を設定することができます。すべてのフィーチャを再度表示する場合は、フィルタ設定を削除します。


空間タイプを使用すれば、ArcMap で実行するフィルタ設定に空間的要素を含めることができます。
ストアド プロシージャにはさらに空間コンポーネントが含まれている場合がありますが、フィルタ設定には、このストアド プロシージャの呼び出しを含めることができます。
この機能によって、クライアントに対する処理の負荷がサーバに移るので、システム リソースの管理の選択肢が 1 つ増えることになります。

通常、空間検索では、1 つのデータセットのフィーチャと別のデータセットのフィーチャの関係が比較されます。このため、別のフィーチャクラスをジオデータベースに追加してこれを Buildings フィーチャクラスと比較する必要があります。

次の一連の手順では、2 つ目のフィーチャクラスをインポートしたうえでフィルタ設定を使って、給水本管から 50 メートル以内の建物フィーチャのサブセットを表示します。

ArcGIS チュートリアルのインストールを実行して、water_lines フィーチャクラスが含まれたジオデータベースをインストールする必要があります。

手順:
  1. ArcGIS チュートリアル データをインストールします。
  2. 完全インストールを選択するか、カスタム インストールを選択し、ArcGIS チュートリアル データ インストール ウィザードの [フィーチャ選択] ダイアログ ボックスにある [アプリケーション] リストで SQL の例のデータだけをインストールします。

    [ArcGIS] [ArcTutor] [SQL Examples] に sql_examples という名前のジオデータベースがインストールされます。

  3. [スタート] [すべてのプログラム] [ArcGIS] [ArcMap 10] の順にクリックして、ArcMap を起動します。
  4. [カタログ ウィンドウ] ボタン カタログ ウィンドウ をクリックします。
  5. [ArcGIS] [ArcTutor] [SQL Examples] にある sql_examples ジオデータベースにフォルダ コネクションを追加します。
    1. [フォルダに接続] ボタンフォルダに接続 をクリックします。
    2. [ArcGIS] [ArcTutor] [SQL Examples] の順に移動します。
    3. [OK] をクリックします。

これで sql_example ジオデータベースに接続できたので、water_lines フィーチャクラスを ArcSDE ジオデータベースにインポートします。

手順:
  1. カタログ ウィンドウで、Buildings フィーチャクラスを作成した ArcSDE ジオデータベースを右クリックします。
  2. [インポート] をポイントして、[フィーチャクラス(シングル)] をクリックします。

    [フィーチャクラス → フィーチャクラス] ジオプロセシング ツールが表示されます。

  3. [入力フィーチャ] テキスト ボックスの横にある [参照] ボタンをクリックします。

    [入力フィーチャ] ダイアログ ボックスが開きます。

  4. sql_example ジオデータベースに移動します。
  5. water_lines フィーチャクラスをクリックし、[追加] をクリックします。
  6. [出力フィーチャクラス] テキスト ボックスに、「water」と入力します。
  7. フィーチャクラスの格納の定義に使用するコンフィグレーション キーワードを指定します。
    • デフォルトのジオメトリ格納タイプが ST_Geometry になっていれば、ジオデータベースの設定を変更する必要はありません。DEFAULTS キーワードの値が使用されます。
    • Oracle または PostgreSQL のジオデータベースで、デフォルトのジオメトリ格納が ST_Geometry 以外になっている場合は、[ジオデータベース設定(オプション)] をクリックし、[コンフィグレーション キーワード(オプション)] テキスト ボックスの横の矢印をクリックして、ドロップダウン リストから [ST_GEOMETRY](または ST_GEOMETRY 格納用に作成したカスタムのコンフィグレーション キーワード)を選択します。
  8. [OK] をクリックして、データをインポートします。

前提条件:

ArcMap に Buildings と Water のフィーチャクラス追加し、給水本管から 25 メートル以内にある建物フィーチャのサブセットを表示するためのクエリを定義します。

手順:
  1. ArcSDE ジオデータベースへの接続から Buildings と Water のフィーチャクラスを選択し、コンテンツ ウィンドウにドラッグしてマップに追加します。
  2. コンテンツ ウィンドウで Buildings レイヤを右クリックし、[プロパティ] をクリックします。
  3. [フィルタ設定] タブをクリックします。
  4. 表示するレイヤの特定のフィーチャを識別するための条件式を作成します。以下のクエリでは、給水本管から 25 メートル以内にあるすべての建物が特定されます。[レイヤ プロパティ][フィルタ設定] ボックスに、DBMS に応じた条件式を入力します。
    • Oracle の場合:
      objectid IN (SELECT b.objectid FROM BUILDINGS b, WATER w
      WHERE w.watertype = 'MAIN' 
      AND sde.st_intersects (b.shape, sde.st_buffer (w.shape, 25)) = 1)
    • PostgreSQL の場合:
      objectid IN (SELECT b.objectid FROM buildings b, water w
      WHERE w.watertype = 'MAIN' 
      AND sde.st_intersects (b.shape, sde.st_buffer (w.shape, 25)) = 't')
    • DB2 の場合:
      objectid IN (SELECT b.objectid FROM BUILDINGS b, WATER w
      WHERE w.watertype = 'MAIN' 
      AND db2gse.st_intersects (b.shape, db2gse.st_buffer (w.shape, 25)) = 1)
    • Informix の場合:
      objectid IN (SELECT b.objectid FROM buildings b, water w
      WHERE w.watertype = 'MAIN' 
      AND st_intersects (b.shape, st_buffer (w.shape, 25)))
  5. [OK] をクリックします。

フィルタ設定結果の属性検索および空間検索との比較

ArcMap の [属性検索] ツールですべての給水本管を検索してから、[空間検索] ツールで給水本管から 25 メートル以内にある建物を検索した場合にも、同じ結果が返されます。これはフィルタ設定で指定した SQL の方法と同じです。

手順:
  1. ArcMap が終了されている場合は、再起動します。
  2. 先程のセクションで作成したフィルタ設定を削除します。
    1. コンテンツ ウィンドウで Buildings レイヤを右クリックし、[プロパティ] をクリックします。
    2. [フィルタ設定] タブをクリックします。
    3. [フィルタ設定] テキスト ボックスのクエリをハイライト表示し、[削除] をクリックします。
    4. [OK] をクリックして [レイヤ プロパティ] ダイアログ ボックスを閉じます。
  3. ここで、[属性検索] ダイアログ ボックスを表示します
  4. [選択] ドロップダウン メニューをクリックします。
  5. [属性検索] をクリックします。
  6. [レイヤ] リストで Water フィーチャクラスを選択します。
  7. [選択セットの新規作成] メソッドが設定されていることを確認します。
  8. クエリ ボックスに「WATERTYPE = 'MAIN'」と入力します。
  9. [確認] をクリックして SQL ステートメントが有効であることを確認します。
  10. [OK] をクリックします。
  11. [OK] をクリックして [属性検索] ダイアログ ボックスを閉じます。
  12. ここで、[空間検索] ダイアログ ボックスを表示します。
  13. [選択] ドロップダウン メニューをクリックします。
  14. [空間検索] をクリックします。
  15. [ターゲット レイヤ] ボックスの Buildings フィーチャクラスをオンにします。
  16. [ソース レイヤ] ドロップダウン リストで Water フィーチャクラスを選択します。
  17. [選択フィーチャを使用] をオンにして、給水本管フィーチャだけを使用するようにします。
  18. [空間選択方法] ドロップダウン リストから [ターゲット レイヤのフィーチャがソース レイヤのフィーチャと重なっている] を選択します。
  19. [検索距離の適用] ボックスをオンにします。
  20. 25」と入力して、ドロップダウン リストから [メートル] を選択します。
  21. [OK] をクリックします。

フィルタ設定を使用した場合に返されたものと同じ Buildings フィーチャクラスのフィーチャが選択セットに表示されます。


7/10/2012