Skip to main content
3 of 3
edited title
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Pretty-printing WKT strings?

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.

user55284