Class JTSOpCmd

java.lang.Object
org.locationtech.jtstest.cmd.JTSOpCmd

public class JTSOpCmd extends Object
A CLI to run JTS TestBuilder operations. Allows easier execution of JTS functions on test data for debugging purposes.

Examples:

--- Compute the area of a WKT geometry, output it
jtsop -a some-file-with-geom.wkt area 

--- Validate geometries from a WKT file using limit and offset
jtsop -a some-file-with-geom.wkt -limit 100 -offset 40 isValid 

--- Compute the unary union of a WKT geometry, output as WKB
jtsop -a some-file-with-geom.wkt -f wkb Overlay.unaryUnion 

--- Compute the union of two geometries in WKT and WKB, output as WKT
jtsop -a some-file-with-geom.wkt -b some-other-geom.wkb Overlay.Union

--- Compute the buffer of distance 10 of a WKT geometry, output as GeoJSON
jtsop -a some-file-with-geom.wkt -f geojson Buffer.buffer 10

--- Compute the buffer of a literal geometry, output as WKT
jtsop -a "POINT (10 10)" Buffer.buffer 10

--- Compute buffers of multiple sizes
jtsop -a "POINT (10 10)" Buffer.buffer 1,10,100

--- Run op for each A 
jtsop -a "MULTIPOINT ((10 10), (20 20))" -eacha Buffer.buffer

--- Output a literal geometry as GeoJSON
jtsop -a "POINT (10 10)" -f geojson

--- Run op but don't output result (quiet mode) 
jtsop -a "MULTIPOINT ((10 10), (20 20))" -q Buffer.buffer

Author:
Martin Davis
  • Field Details

  • Constructor Details

    • JTSOpCmd

      public JTSOpCmd()
  • Method Details

    • main

      public static void main(String[] args)
    • captureOutput

      public void captureOutput()
    • captureResult

      public void captureResult()
    • getResultGeometry

      public List<Geometry> getResultGeometry()
    • replaceStdIn

      public void replaceStdIn(InputStream inStream)
    • getOutput

      public String getOutput()
    • getOutputLines

      public String[] getOutputLines()
    • isFilename

      public static boolean isFilename(String arg)