4

Is there a tool that will pretty-print well-known-text strings? One that would accept for instance

MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 20 35)))

and output something like

MULTIPOLYGON (
  (
    (
      40 40,
      20 45,
      45 30,
      40 40
    ),
  ),
  (
    (
      20 35,
      45 20,
      30  5,
      20 35
    )
  )

Ideally this would be an online tool that runs in a browser (along the lines of the many JSON formatters that exist), but an offline tool would still be useful.

There are a number of online tools for viewing and editing WKT-format data, but none that seem to offer any support for reformatting. The OpenLayers vector-formats example app has a checkbox tantalizingly labelled "Pretty print", but selecting it seems not to do anything when WKT is set as the output format.

5

OpenJUMP http://openjump.org can do that on desktop.

Compressed format that is good for copy-paste

enter image description here

Beautified format that helps visual interpretation

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy