Groups
Groups
Sign in
Groups
Groups
QGIS初心者質問グループ
Conversations
About
Send feedback
Help
フィールド計算機で標高順など、順番を計算させる方法
2,057 views
Skip to first unread message
sakuya_izayoi
unread,
May 8, 2018, 1:49:24 AM
5/8/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to QGIS初心者質問グループ
こちらsakuya_izayoiのizayoiです。
お世話になります。
フィールド計算機を使っての順位付けをやりたいです。
意味合いとしては、フィールド計算機に「標高」というフィールドがあったならば、それに
高い順から1、2、3、4、5といった数字をつけたいといったことであります。
重複データの問題もありますが、大きい順、小さい順などに番号をつけたいと思っております。
(エクセルで言うとrank関数が近いです)
よい方法があれば教えていただきたいです。
きた
unread,
May 8, 2018, 10:35:32 AM
5/8/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to QGIS初心者質問グループ
QGISにそのような機能があればいいと思いますが、無いのであれば、やはりExcelでやるのが良いのではないでしょうか。
まずQGISのフィールド計算機で、「$ID」または「uuid」関数でフィールドの固有IDを作り、属性データをコピーするか、CSVなどで保存して、Excelのrank関数で計算してから、ふたたびQGISのレイヤに追加して、先に作成した固有IDで結合すれば、順序の番号を付けれると思います。
ただしレコードが数千~数万レコードくらいなら良いですが、数十万レコードととかなると、Excelで計算できるかもわかりません。
きた
sakuya_izayoi
unread,
May 8, 2018, 8:08:31 PM
5/8/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to QGIS初心者質問グループ
きた 様
こちらizayoiです。ご返答ありがとうございます。
やはりExcelやcalcなどの表計算ソフトに頼る方が手っ取り早いですようですね。
今後とも。よろしくお願いします。
追伸
132bit版のExcelでも0万までは計算できること確認しましたが、それ以上となると、動いているのか動いていないのか分からない状態になりますね。
行数が多くても、64bit版のExcelなら少し楽に動きます。
福岡
unread,
May 8, 2018, 10:38:25 PM
5/8/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to QGIS初心者質問グループ
izayoi 様
こんにちは
私もこのようなことをするのなら、Excelで処理して属性テーブルにくっつけるという方法をとると思います。
ただ例によってググってみたところ、QGISの機能のみで行う方法として、Pythonでコードを記述するという情報がありました。
Create new attribute ranking polygons by size in QGIS
https://gis.stackexchange.com/questions/148161/create-new-attribute-ranking-polygons-by-size-in-qgis
内容をみてみると、属性テーブルにあるareaという列の値を使って地物をソートし、IDを振っていくような手法のようです。
私にはちょっと敷居が高い手法ですが、データ数等の関連でExcelを使えない時には役立つと思われますので、念のため投稿いたします。
tonaok...@gmail.com
unread,
May 11, 2018, 7:32:44 AM
5/11/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to QGIS初心者質問グループ
こんにちは
QGIS 2.x だと Sort and Number プラグインが該当すると思います。
https://plugins.qgis.org/plugins/QGISSortAndNumber-master/
最大3つの属性列で並び替えが行え、順番を新規列として追加します。
やっていることは単純なので、早く QGIS 3.x も対応してほしいものです。
ちなみに、エクセル等を使って手作業を行う場合でも、 RANK 関数は使わず
条件で並び替えを行ってオートフィル等で連番をふる方が低負荷で
処理できると思います。( RANK 関数は全地物に対して毎回順序を計算する)
Reply all
Reply to author
Forward
0 new messages