複数の GeoJSON ファイルをマージ(jq 利用)
こんにちは。
複数の GeoJSON ファイルのデータをマージ(合体、連結)させて一つのファイルを作りました(jq
コマンドを利用、対象ファイル例は *geo.json
)。
$ jq '.features[]' *geo.json | jq -s '{"type":"FeatureCollection", "features":.}' > merged_geo.json
- また条件抽出も加えてみました(この例は
properties.name != ""
)。
$ jq '.features[]' *geo.json | jq -s -c 'map(select(.properties.name != ""))[] ' | jq -s '{"type":"FeatureCollection", "features":.}' > merged_geo.json
GeoJSONL(cat コマンド利用)
なお Newline-delimited GeoJSON (GeoJSONL) ファイルならばcat
コマンドで実現できます(対象ファイル例は *geo.jsonl
)。
$ cat *geo.jsonl > merged_geo.jsonl
- また条件抽出も加えてみました(この例は
properties.name != ""
)。
$ cat *geo.jsonl | jq -s -c 'map(select(.properties.name != ""))[] ' > merged_geo.jsonl
Author And Source
この問題について(複数の GeoJSON ファイルをマージ(jq 利用)), 我々は、より多くの情報をここで見つけました https://qiita.com/kkdd/items/70e75d114421d745f2d7著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .