furuhashilab / youth_UN-EC_OSS4SDG_hachathon2022

Creative Commons Attribution 4.0 International
2 stars 0 forks source link

Import manual (Japanese/English) draft #1

Open ibuki76 opened 1 year ago

ibuki76 commented 1 year ago
SotaSuzuki-1327 commented 1 year ago

PLATEAU 建物データ: OpenStreetMap へのインポート手順(下書き)

1. 対象地域の citygml ファイルをダウンロードする

作業対象のファイルを、G空間情報センターからダウンロードします。

ファイルのダウンロードが終わったら、 zip ファイルを展開します。建物データは、展開したディレクトリの udx/bldg 配下に格納されています。

gml ファイルをテキストエディタで開き、 <uro:surveyYear>2017</uro:surveyYear> のように、測量年を確認する。

197338720-6f6e3df3-bac8-4aa3-a5e5-ad65b9654ce0

2. 変換スクリプトのダウンロード

yuuhayashi / citygml-osm より変換スクリプトをダウンロードします。

ダウンロードしたファイルを展開し、citygml-osm-jar-with-dependencies.jar を、 PLATEAU の建物データ( citygml 形式, デフォルトでは udx/bldg 配下)を展開したファイルに格納します。

3. 1st-3rdまでのスクリプトを回す

ターミナル(あるいはコマンドラインや Powershell など)を起動し、citygml を展開したフォルダに移動します。

移動したら、以下のコマンドを入力します。

$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 1st
$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 2nd
$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 3rd

それぞれのコマンドでは、以下の処理が行われます。

この処理により、同じ名称で拡張子の異なるファイルが4種類 ( .gml , .osm , .org.osm そして .mrg.osm ) できあがることになります。

8154E449-C5CD-4CC4-975F-B42CBE551525

なお上記のコマンドは、配布されているスクリプトに同梱されている run.sh (あるいは run.bat )をキックしても、同じ結果が得られます。

スクリプトは、同じディレクトリに格納されているすべての gml ファイルに対して実行されます。そのため、ファイル数が多いとそれなりに処理時間がかかります。必要に応じて、適宜ディレクトリを分けるなどの対応を行ってください。

4. .mrg.osm ファイルをJOSMで開く

拡張子 .mrg.osm のファイルを JOSM で読み込みます。 mrg.osm ファイルをJOSMでインポート後、背景に OSM画像レイヤを表示するとわかりやすくなります。

JOSM を使う以下の作業は、読み込まれたファイルを編集して、インポートしたくないオブジェクトを削除することが目的です。

5. todo プラグインのインストール

以下の手順で todo プラグインを使用可能にします。

6. フィルタの設定

JOSM のフィルタに、以下4つのフィルタを設定します。

スクリーンショット 2022-10-31 10 35 00

合成されたファイルである .mrg.osm では、既存の OSM データと PLATEAU データが同じ領域で重なる部分があった場合、対象のオブジェクトに "MLIT_PLATEAU:fixme" タグが付与されています。この対象のオブジェクトをインポートすべきか人間が確認し、適切に処理する必要があります。

基本的に、この "MLIT_PLATEAU:fixme"=* を処理してゆくことで、アップロード可能な状態のファイルを作成することができます。 JOSM のフィルタを利用することで、対象のオブジェクトを発見しやすくしましょう。

"MLIT_PLATEAU:fixme"=*に含まれる値の解説

7. .mrg.osmの編集

JOSM で .mrg.osm を編集します。

"MLIT_PLATEAU:fixme" が付与されていないデータの確認

"MLIT_PLATEAU:fixme"=* のフィルタを有効化し、タグがついていないデータ(つまり、PLATEAU データそのままのオブジェクト)だけを表示させます。

スクリーンショット 2022-10-31 10 03 59

背景画像に Bing や Maxar など、なるべく撮影年度の新しい衛星写真をセットし、明らかに現状存在しない建物オブジェクトがある場合、そのオブジェクトを削除します。このとき、 1. の手順で確認した gml データの測量年と背景画像の撮影年を比較し、常に新しいほうに合わせてオブジェクトの削除を行ってください。

*`"MLIT_PLATEAU:fixme"=` が付与されたデータへの対応**

type:node"MLIT_PLATEAU:fixme"="delete 削除されます" のフィルタを有効化した状態で、"MLIT_PLATEAU:fixme"="delete 削除されます" をインバース(反転)し、ショートカットキー <Ctrl + A> を押し、レイヤー内のオブジェクトを全選択します。

これにより、オブジェクトを選択する際にノードが選択されないようになります。

"MLIT_PLATEAU:fixme"="PLATEAUデータで更新されています" に関する処理

"MLIT_PLATEAU:fixme"="delete 削除されます" に関する処理

迷ったときは?

多くの場合、 PLATEAU の建物データは非常に優秀で、形状の置き換えに問題はありません。

ただし、 PLATEAU データも完璧ではありません。現在の建物の状況がどうなっているか、 PLATEAU データセットの建物形状が本当に正しいものなのかどうか、 Bing などの航空写真では判別が付きづらい場合、以下の手がかりを参考に情報を集めてください。

なお、 PLATEAU データのインポートを行った地域は、作業完了後、 Tasking Manager を使って形状などの事後確認プロセスを設ける予定です。大きな間違いの場合は、事後確認プロセスの段階でチェックすることも可能です。

8. チェックしたファイルを 名前をつけて保存

チェックが完了したファイルを、名前を付けて保存します。

JOSM のメニューから、あるいは JOSM のレイヤー一覧から、対象のレイヤーを保存します。

保存する際は、ファイル名を checked.osm としてください。

9. アップロード用ファイルへの変換(4thスクリプトを回す)

checked.osm ファイルを、アップロード用ファイルに変換します。

ターミナルから、以下のコマンドを入力します。

$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 4th

これにより、 checked.osm を元にした upload.osm が生成されます。

10. osm.org へのアップロード

JOSM で upload.osm を開き、 osm.org へアップロードします。

レイヤで upload.osm を開いた状態で 妥当性検証 を行います。

妥当性検証の結果として表示される警告やエラーを確認し、その上でデータのアップロードを行ってください。 例えば、縁の部分で重複するノードのエラー処理や、メンバーが存在しないリレーションなどが発生することがあります。

アップロードする際には、変更セットに対して以下のタグを付与してください。

 source = MLIT_PLATEAU
 source_ref = https://wiki.openstreetmap.org/wiki/MLIT_PLATEAU/imports_outline

また、変更セットのコメントとして、以下のフォーマットを推奨します。 メッシュ番号は、作業を行っているファイルの先頭8桁の数字です。

Plateau import: [対象の市町村] [メッシュ番号]

例: Plateau import: 新座市 53395404

11. OSM wiki の対象リストを編集する

OSM wiki に、インポート対象となる各市町村ごとのファイル名一覧を作成しています。

インポートが完了したメッシュ番号に対し、インポート済みであることを記載してください。 また、申し送り事項がある場合は、備考欄にその内容を記載してください。


以上ですべての工程の終了です。

SotaSuzuki-1327 commented 1 year ago

Plateau building data: Import procedure into OpenStreetMap (Draft)

English Ver.

1. Download the Citygml file of the target area.

Download the file to be worked on from the G-Spatial Information Center .

After downloading the file, extract the zip file. The building data is stored under udx/bldg in the extracted directory.

Open the gml file in a text editor and confirm the survey year, as in <uro:surveyYear>2017</uro:surveyYear> .

2. Download the conversion script

Download yuuhayashi / citygml-osm .

Extract the downloaded file and store citygml-osm-osm-jar-with-dependencies.jar in the file where the Plateau building data (in citygml format, under udx/bldg by default) is extracted.

3. Run scripts from 1st to 3rd

Start a Terminal (or Command Line, Powershell, etc.) and navigate to the folder where citygml was extracted.

Once there, type the following command.

$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 1st
$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 2nd
$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 3rd

In each command, the following processes are performed.

This process will result in four files with the same name but different file extensions ( .gml, .osm, .org.osm , and .mrg.osm ). The above commands will produce the same results as if you had kicked in run.sh (or run.bat ), which is included in the distributed scripts.

The script will run against all gml files stored in the same directory. Therefore, if the number of files is large, it will take some processing time. If necessary, please separate directories accordingly.

4. Open .mrg.osm file with JOSM

Load a file with the extension .mrg.osm into JOSM. After importing the .mrg.osm file in JOSM, display the OSM image layer in the background for clarity.

The goal of this process is to edit the imported file and remove any objects that you do not want to import.

5. Install the todo plugin

Follow these steps to enable the todo plugin.

6. Filter settings

Set the following four filters in the JOSM filters.

In the composite file .mrg.osm , if there is an overlap between existing OSM data and PLATEAU data in the same area, the target object is given the tag "MLIT_PLATEAU:fixme" . A human must check if this object should be imported and handle it appropriately.

Basically, by processing the "MLIT_PLATEAU:fixme"=* , you can create a file that is ready for uploading. Use the JOSM filter to make it easier to find the target object.

Explanation of the values contained in "MLIT_PLATEAU:fixme"=*

7 Edit .mrg.osm

Edit .mrg.osm in JOSM.

Checking data to which "MLIT_PLATEAU:fixme" is not assigned

Activate the filter "MLIT_PLATEAU:fixme"=* to display only untagged data (i.e., objects with PLATEAU data as is).

Set the background image to a satellite photo taken as recently as possible, such as Bing or Maxar, and delete any building objects that clearly do not exist. At this time, compare the survey year of the gml data confirmed in step 1. with the year the background image was taken, and always delete objects according to the newer year.

Correspondence to data with "MLIT_PLATEAU:fixme"=*

With the filters type:node and "MLIT_PLATEAU:fixme"="delete 削除されます" activated, inverse "MLIT_PLATEAU:fixme"="delete 削除されます" , press <Ctrl + A> and select all objects in the layer Select all objects in the layer.

This will ensure that no nodes are selected when selecting objects.

Processing of "MLIT_PLATEAU:fixme"="PLATEAUデータで更新されています"

Processing for "MLIT_PLATEAU:fixme"="delete 削除されます"

In case you are not sure what to do?

In most cases, PLATEAU building data is very superior and there is no need to worry about replacing the geometry.

However, PLATEAU data is not perfect either. If it is difficult to determine from aerial photos such as Bing what the current building conditions are and whether the building shape in the PLATEAU dataset is indeed correct, use the following clues to gather information.

For areas where PLATEAU data has been imported, we plan to use the Tasking Manager to perform a post-check process for geometry, etc., after the work is complete. Any major mistakes can be checked during the post-verification process.

8. Save the checked file

Save the checked file as a file with a name.

Save the target layer from the JOSM menu or from the JOSM layer list.

When saving, name the file checked.osm .

9. Conversion to a file for upload (run 4th script)

Convert the checked.osm file to a file for uploading.

From the Terminal (or Command Line, Powershell, etc.), enter the following command.

$ java -Dfile.encoding=utf-8 -jar citygml-osm-jar-with-dependencies.jar 4th

This will generate upload.osm based on checked.osm .

10. Upload to osm.org

Open upload.osm in JOSM and upload to osm.org .

Validation is performed with upload.osm opened in the layer.

Review any warnings or errors that appear as a result of the validation, and then upload the data. For example, there may be error handling of duplicate nodes at the edges, or relationships where no members exist.

When uploading, please add the following tags to the change set

 source = MLIT_PLATEAU
 source_ref = https://wiki.openstreetmap.org/wiki/MLIT_PLATEAU/imports_outline

The following format is also recommended as a comment on the change set The mesh number is the first 8 digits of the file you are working on.

Plateau import: [target municipality] [mesh number].

Example: Plateau import: Niiza-shi 53395404

11. Edit the target list in OSM wiki

OSM wiki has a list of file names for each municipality to be imported.

For each mesh number that has been imported, please note that it has been imported. If there are any remarks, please state them in the remarks field.


This is the end of the process.