Home - OverQuantum/path_ortho GitHub Wiki

Table of Contents

About

path_ortho is a command-line tool for orthogonalization of paths (polygones and polylines).
path_ortho gets some path as an input as produces path with right angles and minimum amount of nodes.
Orthogonalization could be useful for adjusting result of vectorization of rectangular objects as many vectorization algorithms does not detect right angles.
Details of orthogonalization algorithm is explained on separate page.

Usage

path_ortho [params] "{data}"

Example:

  path_ortho a2 c10 "6218 8805, 6295 8675, 6501 8798, 6425 8927, 6218 8805"

params:

  • aN - accuracy of output, N - integer from 0 to 20, 0 by default
  • cF - collapse len, F - float >=0, 0 by default
{data} - source path
  • format: x y (,x y)
  • space delimits coordinates from each other, comma delimits nodes
  • one or zero coordinates between commas are ignored (node not created)
  • third and further coordinates are also ignored
output, either:
  • result path, format same as {data}
  • error text, starts with ERROR:
  • nothing (in case of complete collapse of path)

Binaries

v1.01 for Windows x86 32 bit - on ge.tt

Older versions

RC3 for Windows x86 32 bit - on ge.tt

test3_<*>.bat should produce file equal to corresponding test3_out_[P].txt

Tests

Tests 5-6 with results for v1.01 - on ge.tt

Content:

  • test[N]_seq.bat - test sequence for Win32
  • test[N]_seq.sh - test sequence for Linux
  • test[N]_obj.bat and test[N]_obj.sh - lists of objects, called by test[N]_seq.*
  • test[N].txt - simple list of objects, one per line
  • results_win32\test[N]_out_[P].txt - results of path_ortho v1.01 on Windows x86 32 bit
Where [N]:
  • 5 - different objects (closed paths)
  • 5u - same as 5, but not closed paths
  • 6 - few objects having not right angles (buildings from Maa-amet)
  • 5u - same as 6, but not closed paths
and [P] is params of path_ortho

References

path_ortho is used in OpenStreetMap Project: Estonia by SviMik for import of buildings and performs orthogonalization an output of potrace utility.

Analogues

In JOSM there is a tool doing similar task, but with keeping all nodes. Performed by OrthogonalizeAction.java code. In case of several angles far from right, JOSM tool use wrong direction as a base vector.

License

Code is licensed under GPL v3
Algorithm is licensed under CC BY 3.0

⚠️ **GitHub.com Fallback** ⚠️