Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch up the latest JTS update #3

Merged
merged 60 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
29135c9
Add XML test TestOverlay-geos-1051 in robust/overlay
dr-jts Sep 29, 2020
d73c798
Fix StackOverflowError in HotPixelIndex (#605)
FObermaier Sep 30, 2020
5b8bfca
Javadoc
dr-jts Sep 30, 2020
c1977c8
Fix HotPixel intersects test (#608)
dr-jts Oct 1, 2020
3105164
Add performance tests using Snap-Rounding
dr-jts Oct 1, 2020
9d40973
Remove superceded PolygonOverlayFunctions
dr-jts Oct 2, 2020
ed79127
Change GeometryNoder to use SnapRoundingNoder
dr-jts Oct 3, 2020
d78919a
Update JTS_Version_History.md
dr-jts Oct 4, 2020
1aefddb
Remove Lab snap-rounding code
dr-jts Oct 4, 2020
a1d3ec3
Add OverlayTestFunction edgesUnionAll
dr-jts Oct 5, 2020
845e28f
Update junit to v4.13 (#607) (#609)
FObermaier Oct 6, 2020
a4f27be
Add tests for SegmentNode ordering. (#610)
dr-jts Oct 8, 2020
f2f096f
Disable JtsOpCmd check for missing B argument (since some functions a…
dr-jts Oct 8, 2020
228ec49
Add TestBuilder function metadata for isRequired
dr-jts Oct 8, 2020
43b6a64
Remove redundant code
dr-jts Oct 8, 2020
e1f8e67
Add TestBuilder translate function
dr-jts Oct 9, 2020
58b5ea3
Add TestBuilder randomSegmensRectilinear function
dr-jts Oct 9, 2020
6367610
Improve TestBuilder Layer style UI
dr-jts Oct 9, 2020
5b0606d
Fixed javadoc of Geometry.getEnvelope(): polygon vertices order (#612)
artaban Oct 12, 2020
7864347
Javadoc
dr-jts Oct 13, 2020
5b3d8f2
Javadoc
dr-jts Oct 13, 2020
63654d6
Bump junit from 4.13 to 4.13.1 (#613)
dependabot[bot] Oct 14, 2020
6ba3105
Fix CoverageUnion to use overlay strict mode (#614)
dr-jts Oct 16, 2020
cc29c30
Javadoc
dr-jts Oct 16, 2020
2202344
Fix WKTFileReader lookahead (#616)
dr-jts Oct 19, 2020
8a4df28
Update JTS_Version_History.md
dr-jts Oct 19, 2020
fa8941a
Add JtsOpCmd limit and offset options (#617)
dr-jts Oct 19, 2020
0bf6899
Update JTS_Version_History.md
dr-jts Oct 19, 2020
fea8b54
Update JTSOp.md
dr-jts Oct 19, 2020
31cb7b6
Control Geometry overlay algorithm via system property (#615)
dr-jts Oct 20, 2020
f7bec0d
Update JTS_Version_History.md
dr-jts Oct 20, 2020
5c586c1
Update USING.md
dr-jts Oct 20, 2020
ea2ec1e
Add PolygonOverlay and IteratedOverlay functions
dr-jts Oct 23, 2020
6ef89b0
Fix OverlayNGRobust self-snapping to prevent heterogeneous results (#…
dr-jts Oct 23, 2020
6455849
Rename IteratedOverlay functions
dr-jts Oct 24, 2020
b095010
Fix JtsOp to handle null B inputs to binary functions
dr-jts Oct 26, 2020
bb820b8
Add PolygonOverlay overlaySR function
dr-jts Oct 26, 2020
5e94049
Minor SnappingNoder performance enhancement by moving test up
dr-jts Oct 26, 2020
a7b7ee5
Fix TestBuilder to read json files
dr-jts Oct 26, 2020
b9cf9ad
Improve TestBuilder function metadata
dr-jts Oct 26, 2020
ead0071
Fix GeometryPrecisionReducer to throw an IllegalArgumentException for…
dr-jts Oct 26, 2020
96a44bf
Add TestBuilder function metadata
dr-jts Oct 26, 2020
40d15ac
Add TestBuilder Inspector sorting by Area and Length
dr-jts Oct 27, 2020
edb2319
Update JTS_Version_History.md
dr-jts Oct 27, 2020
516fafa
Add PolygonOverlay function with Iterated snapping, hole removal
dr-jts Oct 27, 2020
d0aa121
Fix WKBWriter to handle POINT EMPTY in 3D (#622)
dr-jts Oct 27, 2020
074a6be
Improve WKBWriter to write empty polygons with no rings (#623)
dr-jts Oct 27, 2020
71ee132
Update JTS_Version_History.md
dr-jts Oct 27, 2020
1942b8f
Fix Geometry.reverse bugs (#628)
dr-jts Oct 29, 2020
10f657f
Update JTS_Version_History.md
dr-jts Oct 29, 2020
8319f0d
Move class to test.perf package
dr-jts Oct 29, 2020
0043766
Rename GeometryTestCase isEqual methods
dr-jts Nov 6, 2020
04bf807
Add TestBuilder Sorting functions
dr-jts Nov 11, 2020
56c4984
Improve TestBuilder indicator API
dr-jts Nov 15, 2020
12d3a56
Add TestBuilder isShowingIndicators function
dr-jts Nov 15, 2020
902168e
Fix TestBuilder spinner value type consistency
dr-jts Nov 16, 2020
6d6a15a
Add IndexedFacetDistance perf test
dr-jts Nov 16, 2020
9c824aa
Improve DistanceGeomPairPerfTest - add cached test
dr-jts Nov 16, 2020
e3ee769
Allow TestBuilder to repeat functions with no numeric arg
dr-jts Nov 17, 2020
402acb6
Improve TestBuilder showingIndicators logic
dr-jts Nov 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions USING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ module org.foo.baz {
requires org.locationtech.jts.io.sde; // jts-io-sde
}
```
## JTS System Properties

* `-Djts.overlay=ng` enables the use of OverlayNG in `Geometry` overlay methods. (*Note: in a future release this will become the default behaviour*)

## JTS Tools

Expand Down
16 changes: 14 additions & 2 deletions doc/JTSOp.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* Execute JTS operations on geometry to produce the results, in various spatial formats
* Chain together sequences of JTS operations to accomplish a spatial processing task
* Extract and transform geometry from data files
* Extract, subset, validate and transform geometry from data files
* Convert geometry from one format into another
* Generate geometry for testing or display purposes
* Summarize the contents of geometry datafiles
Expand All @@ -19,12 +19,16 @@
* standard input (WKT or WKB)
* files in various formats (WKT, WKB, GeoJSON, GML, SHP)
* a single input containing two geometries can supply both A and B (option `-ab`)
* Apply a limit and/or offset when reading from some file formats:
* `-limit` specifies a limit
* `-offseet` specified an offset
* supported for WKT, WKB, SHP file formats
* Execute any spatial or scalar function available in the JTS TestBuilder
* "spread" execution over each geometry component from one or both inputs
* `-each [ a | b | ab | aa ]`
* the `-each aa` parameter uses the A input for both arguments for binary operations
* the `-index` parameter uses a spatial index for binary operations
* Run an operation multiple times using a sequence of different argument values
* Run an operation multiple times using a set of different argument values
* `-args v1,v2,v3 ...`
* Repeat operation execution multiple times, to provide better timing results
* `-repeat n`
Expand All @@ -36,8 +40,12 @@
* `-explode`
* Display information about the input geometries and function timing
* `-v`
* Display timing information
* `-time`
* Load external spatial functions dynamically (as a Java class with static methods)
* `-geomfunc classname`
* List all available functions
* `-help`
* chain operations together by writing/reading input from `stdin` and using shell piping

## Examples
Expand Down Expand Up @@ -86,6 +94,10 @@

jtsop -a "POINT (10 10)" -f geojson

* Validate geometries from a WKT file using limit and offset

jtsop -a some-file-with-geom.wkt -limit 100 -offset 40 -f txt Geometry.isValid

* Compute an operation on a geometry and output only geometry metrics and timing

jtsop -v -a some-geom.wkt Buffer.buffer 10
Expand Down
20 changes: 20 additions & 0 deletions doc/JTS_Version_History.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,29 @@ Distributions for older JTS versions can be obtained at the
* Add `KMLReader` (#593)
* Add `Densifier.setValidated` method to allow disabling expensive polygon validation (#595)
* Add `OverlayNG` codebase (#599)
* Add system property `jts.overlay=ng` to enable use of OverlayNG in `Geometry` methods (#615)
* Add `SnapRoundingNoder` (#599)
* Add `SnappingNoder` (#599)
* Change `GeometryPrecisionReducer` to use OverlayNG with Snap-Rounding
* Change `GeometryNoder` to use `SnapRoundingNoder`
* Add `KdTree` `size` and `depth` methods (#603)
* Improve `WKBWriter` to write empty Polygons using a more compact representation (#623)

### Bug Fixes

* Fix `RayCrossingCounter` to handle XYZM coordinates (#589)
* Fix `PackedCoordinateSequence` to always use XYZM coordinates when dimension is 4 (#591)
* Fix `OrdinateFormat` to work around a JDK issue with the minus sign character in `Locale.NO` (#596)
* Fix `GeoJsonReader` to throw a `ParseException` for empty arrays (#600)
* Fix `WKTFileReader` handling of files with large amount of whitespace (#616)
* Fix `WKBWriter` to output 3D empty Points with 3 ordinates (#622)
* Fix `Geometry.reverse` to handle all geometry structures (#628)

## JTS TestBuilder

### Functionality Improvements

* Add Geometry Inspector sorting by Area or Length

<!-- ================================================================ -->

Expand Down Expand Up @@ -71,6 +86,11 @@ Distributions for older JTS versions can be obtained at the
* Enhance `-geomfunc` to load multiple function classes
* Fix function registry to replace matching loaded functions (#569)

## JtsOp

* Added `-limit` and `-offset` options for reading from file inputs (#617)


<!-- ================================================================ -->

# Version 1.17.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ public class CommandOptions {
public static final String FORMAT_GEOJSON = "geojson";
public static final String FORMAT_SVG = "svg";
public static final String TIME = "time";
public static final String LIMIT = "limit";
public static final String OFFSET = "offset";

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKTConstants;
import org.locationtech.jtstest.cmd.JTSOpRunner.OpParams;
import org.locationtech.jtstest.command.CommandLine;
import org.locationtech.jtstest.command.Option;
import org.locationtech.jtstest.command.OptionSpec;
Expand All @@ -37,6 +38,9 @@
* --- Compute the area of a WKT geometry, output it
* jtsop -a some-file-with-geom.wkt -f txt area
*
* --- Validate geometries from a WKT file using limit and offset
* jtsop -a some-file-with-geom.wkt -limit 100 -offset 40 -f txt isValid
*
* --- Compute the unary union of a WKT geometry, output as WKB
* jtsop -a some-file-with-geom.wkt -f wkb Overlay.unaryUnion
*
Expand Down Expand Up @@ -75,7 +79,7 @@ public static void main(String[] args)
JTSOpCmd cmd = new JTSOpCmd();
int rc = 1;
try {
JTSOpRunner.OpParams cmdArgs = cmd.parseArgs(args);
OpParams cmdArgs = cmd.parseArgs(args);
cmd.execute(cmdArgs);
rc = 0;
}
Expand Down Expand Up @@ -104,12 +108,14 @@ private static CommandLine createCmdLine() {
.addOptionSpec(new OptionSpec(CommandOptions.GEOMA, 1))
.addOptionSpec(new OptionSpec(CommandOptions.GEOMB, 1))
.addOptionSpec(new OptionSpec(CommandOptions.GEOMAB, 1))
.addOptionSpec(new OptionSpec(CommandOptions.SRID, 1))
.addOptionSpec(new OptionSpec(CommandOptions.EACH, 1))
.addOptionSpec(new OptionSpec(CommandOptions.INDEX, 0))
.addOptionSpec(new OptionSpec(CommandOptions.EXPLODE, 0))
.addOptionSpec(new OptionSpec(CommandOptions.FORMAT, 1))
.addOptionSpec(new OptionSpec(CommandOptions.LIMIT, 1))
.addOptionSpec(new OptionSpec(CommandOptions.OFFSET, 1))
.addOptionSpec(new OptionSpec(CommandOptions.REPEAT, 1))
.addOptionSpec(new OptionSpec(CommandOptions.SRID, 1))
.addOptionSpec(new OptionSpec(CommandOptions.VALIDATE, 0))
.addOptionSpec(new OptionSpec(OptionSpec.OPTION_FREE_ARGS, OptionSpec.NARGS_ONE_OR_MORE));
return commandLine;
Expand All @@ -121,37 +127,45 @@ private static CommandLine createCmdLine() {
" [ -a <wkt> | <wkb> | stdin | <filename.ext> ]",
" [ -b <wkt> | <wkb> | stdin | <filename.ext> ]",
" [ -ab <wkt> | <wkb> | stdin | <filename.ext> ]",
" [ -srid <SRID> ]",
" [ -limit <n> ]",
" [ -offset <n> ]",
" [ -each ( a | b | ab | aa ) ]",
" [ -index ]",
" [ -repeat <num> ]",
" [ -validate ]",
" [ -explode",
" [ -srid <SRID> ]",
" [ -f ( txt | wkt | wkb | geojson | gml | svg ) ]",
" [ -geomfunc <classname> ]",
" [ -time ]",
" [ -v, -verbose ]",
" [ -help ]",
" [ -geomfunc <classname> ]",
" [ -op ]",
" [ op [ args... ]]",
" op name of the operation (Category.op)",
" op name of the operation (in format Category.op)",
" args one or more scalar arguments to the operation",
" - To run over multiple arguments use v1,v2,v3 OR val(v1,v2,v3,..)",
"",
"===== Input options:",
" -a Geometry A: literal, stdin (WKT or WKB), or filename (extension: WKT, WKB, GeoJSON, GML, SHP)",
" -b Geometry A: literal, stdin (WKT or WKB), or filename (extension: WKT, WKB, GeoJSON, GML, SHP)",
" -srid Sets the SRID on output geometries",
" -limit Limits the number of geometries read from A, or B if specified",
" -offset Uses an offset to read geometries from A, or B if specified",
"===== Operation options:",
" -each execute op on each component of A, B, both A & B, or A & A",
" -index index geometry B",
" -repeat repeat the operation N times",
" -validate validate the result of each operation",
" -geomfunc specifies class providing geometry operations",
" -op separator to delineate operation arguments",
"===== Output options:",
" -srid Sets the SRID on output geometries",
" -explode output atomic geometries",
" -f output format to use. If omitted output is silent",
" -geomfunc specifies class providing geometry operations",
"===== Logging options:",
" -time display execution time",
" -v, -verbose display information about execution",
" -help print a list of available operations",
" -op separator for op arguments"
" -help print a list of available operations"
};

private void printHelp(boolean showFunctions) {
Expand Down Expand Up @@ -243,7 +257,7 @@ private static boolean isWKT(String arg) {
if (arg.toUpperCase().endsWith(" " + WKTConstants.EMPTY)) return true;
return false;
}

void execute(JTSOpRunner.OpParams cmdArgs) {
if (isHelp || isHelpWithFunctions) {
printHelp(isHelpWithFunctions);
Expand All @@ -261,7 +275,7 @@ JTSOpRunner.OpParams parseArgs(String[] args) throws ParseException, ClassNotFou
}
commandLine.parse(args);

JTSOpRunner.OpParams cmdArgs = new JTSOpRunner.OpParams();
OpParams cmdArgs = new JTSOpRunner.OpParams();

String argA = commandLine.getOptionArg(CommandOptions.GEOMA, 0);
if (argA != null) {
Expand Down Expand Up @@ -294,6 +308,14 @@ JTSOpRunner.OpParams parseArgs(String[] args) throws ParseException, ClassNotFou

cmdArgs.isExplode = commandLine.hasOption(CommandOptions.EXPLODE);

int paramLimit = commandLine.hasOption(CommandOptions.LIMIT)
? commandLine.getOptionArgAsInt(CommandOptions.LIMIT, 0)
: -1;

int paramOffset = commandLine.hasOption(CommandOptions.OFFSET)
? commandLine.getOptionArgAsInt(CommandOptions.OFFSET, 0)
: 0;

cmdArgs.format = commandLine.getOptionArg(CommandOptions.FORMAT, 0);

cmdArgs.srid = commandLine.hasOption(CommandOptions.SRID)
Expand Down Expand Up @@ -358,9 +380,28 @@ else if (each.equalsIgnoreCase("aa")) {
cmdArgs.argList = parseOpArg(freeArgs[1]);
}
}

/**
* ====== Apply extra parameter logic
*/
//--- apply limit to A if no B, or else to B
// This allows applying a binary op with a fixed LHS to a limited set of RHS geoms
if (OpParams.isGeometryInput(cmdArgs.fileB, cmdArgs.geomB)) {
cmdArgs.limitB = paramLimit;
cmdArgs.offsetB = paramOffset;
}
else {
cmdArgs.limitA = paramLimit;
cmdArgs.offsetA = paramOffset;
}

return cmdArgs;
}

private void applyParameters() {

}

private String[] parseOpArg(String arg) {
if (isArgMultiValues(arg)) {
return parseValues(arg);
Expand Down Expand Up @@ -420,7 +461,4 @@ private String[] parseMacroArgs(String macroTerm) {
String args = macroTerm.substring(indexLeft + 1, indexRight);
return args.split(",");
}



}
Loading