こんにちは。
ModelBuilderを使っていますが、データを個別のフィーチャとしてエクスポートするのに苦労しています。
属性テーブルには50万件を超えるポリラインがあり、それらを約250のグループに分けました。各グループをそれぞれ個別のフィーチャとしてエクスポートしたいと考えています。「属性でレイヤーを選択」ツールを使うつもりでしたが、すべてのフィーチャを一括でエクスポートするには、これをどのように実行すればよいでしょうか?
Sounds like the Split by Attributes tool.
R_
Yes, I understand that Rhett. But what I am struggling with would be how to I run a 'Select by Attribute Tool' for each unique value in my field?
I don't mess with models much, but suspect an interator would work here.
I'd use python and:
create an empty list
use search cursor to populate the list with all the values of the field
turn that list into a set (so is uniuqe without duplicates)
iterate through the list and pass that to the Select By Attributes
export.
fc = r'Database Connections\pathtofeatureclass' search_field = 'AttField' AttList = [] with arcpy.da.SearchCursor(fc, [search_field]) as cursor: for row in cursor: AttList.append(row[0]) AttSet = set(AttList) for att in AttSet: where = f"{search_field} = '{att}'" arcpy.management.SelectLayerByAttribute(fc, "NEW_SELECTION", where) ## Export or other stuff
Should work if running in Pro with fc loaded. If not, will probably have to make feature layer first as the SelectByAttributes needs a view/layer not a feature class. If so, could skip the SelectByAttributes and just pass the same where clause to the MakeFeatureLayer GP tool, then export the feature layer.
ログインすると、投稿したり、更新をフォローしたりできます。初めてですか?無料アカウントを登録しましょう。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.