方法
フィーチャの重心は複数の方法で計算できます。 重心を計算する必要がある状況に応じて、複数の方法 (フィーチャの中心の XY 座標を計算する、[フィーチャ → ポイント (Feature To Point)] ツールを使用する、または Python を使用して、重心を表す座標を取得する) を使用できます。 下記の手順では、これらの方法について説明します。
注意: このツールは、Advanced Desktop または ArcInfo ライセンス レベルでのみ使用できます。
注意: データ アクセス カーソルは、ArcGIS 10.1 以降でのみ利用できます。 バージョン 10 用の代わりのワークフローについては、「ジオメトリの読み取り」および「ジオメトリの作成」をご参照ください。
コード: import arcpy input_fc = "C:\\temp\\geodatabase.gdb\\states" output_fc = "C:\\temp\\geodatabase.gdb\\state_centroids" cursor = arcpy.da.SearchCursor(input_fc, "SHAPE@XY") centroid_coords = [] for feature in cursor: centroid_coords.append(feature[0]) point = arcpy.Point() pointGeometryList = [] for pt in centroid_coords: point.X = pt[0] point.Y = pt[1] pointGeometry = arcpy.PointGeometry(point) pointGeometryList.append(pointGeometry) arcpy.CopyFeatures_management(pointGeometryList, output_fc)
記事 ID: 000011754
ArcGIS エキスパートのサポートを受ける
Esri Support アプリのダウンロード
You can also download the app to access the chatbot anytime! Download it now.