1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数の二次元多角形領域を調整修正(互いに素で、平面を余さず被覆)

Last updated at Posted at 2016-03-25

こんにちは。
「複数の二次元多角形領域(polygon)が互いに素で、平面を余さず被覆」の集合となるよう調整修正を施す方法を探してみました。

目的は polygon同士のギャップや重なりを無くすことです。これらは検出が容易ではないですが、結合させてみるとギャップの存在が分かります1

polygon の集合は GeoJSON 形式を仮定しました(入出力ファイル)。

  • ogr2ogr (GDAL) で、ST_MakeValidを施し、各 polygon の self-intersection を修正する。
$ ogr2ogr -f GeoJSON -explodecollections output.json input.json -dialect sqlite -sql "select ST_MakeValid(geometry) as geometry from OGRGeoJSON"
  • pprepair (planar partition repair) :入力形式は自動的に各種に対応しますが、出力形式は今のところ、 cmake の引数で指定した一種類です。入力ファイル内で "properties": {} のように空になっていると segment fault になります。
$ cmake -DDRIVER="GeoJSON" .
$ make
$ ./pprepair -h
$ ./pprepair -i input.json -v
$ ./pprepair -i input.json -o output.json -rrlb

  1. 実例は、「結合でできた「隙間」を排除する」。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?