-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Bumps jts version to 1.20.0 #138351
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
Merged
Merged
Bumps jts version to 1.20.0 #138351
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
44b0ba4
Updates jts version to 1.20.0
ncordon 40c0f3e
Update docs/changelog/138351.yaml
ncordon 6c6c61a
Small tweak to one of the tests
ncordon 00ec3f6
Merge branch 'main' into update-jts
ncordon 5e8a4f9
Temp
ncordon 509cf29
Adds tests to avoid bugs due to using the same reference
ncordon e188b77
Merge branch 'main' into update-jts
ncordon e66f065
Addresses pr review comments
ncordon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 138351 | ||
| summary: Bumps jts version to 1.20.0 | ||
| area: Geo | ||
| type: upgrade | ||
| issues: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,7 @@ public byte[] points(List<GeoPoint> multiPoint) { | |
| * Returns a List {@code byte[]} containing the mvt representation of the provided geometry | ||
| */ | ||
| public List<byte[]> getFeatures(Geometry geometry) { | ||
| // Get geometry in pixel coordinates | ||
| // Get clipped and simplified geometry in pixel coordinates | ||
| final org.locationtech.jts.geom.Geometry mvtGeometry = geometry.visit(mvtGeometryBuilder); | ||
| if (mvtGeometry == null) { | ||
| return List.of(); | ||
|
|
@@ -127,6 +127,15 @@ public List<byte[]> getFeatures(Geometry geometry) { | |
| return byteFeatures; | ||
| } | ||
|
|
||
| /** | ||
| * Testing purposes only, allowing us to test the impact of the geometry clipping and simplification | ||
| * without needing to parse the protobuffer results. | ||
| */ | ||
| org.locationtech.jts.geom.Geometry getMvtGeometry(Geometry geometry) { | ||
| // Get clipped and simplified geometry in pixel coordinates | ||
| return geometry.visit(mvtGeometryBuilder); | ||
| } | ||
|
|
||
| private record MVTGeometryBuilder( | ||
| GeometryFactory geomFactory, | ||
| org.locationtech.jts.geom.Geometry clipTile, | ||
|
|
@@ -332,8 +341,13 @@ private MvtCoordinateSequenceFilter(Envelope tileEnvelope, int extent) { | |
|
|
||
| @Override | ||
| public void filter(CoordinateSequence seq, int i) { | ||
| seq.setOrdinate(i, 0, lon(seq.getOrdinate(i, 0))); | ||
| seq.setOrdinate(i, 1, lat(seq.getOrdinate(i, 1))); | ||
| // JTS can sometimes close polygons using references to the starting coordinate, which can lead to that coordinate | ||
| // being converted twice. We need to detect if the end is the same actual Coordinate, and not do the conversion again. | ||
| if (i != 0 && i == seq.size() - 1 && seq.getCoordinate(0) == seq.getCoordinate(i)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a comment here might be useful. It is especially not clear why we need to do reference equality vs contents equality. We could add a comment like: |
||
| return; | ||
| } | ||
| seq.setOrdinate(i, CoordinateSequence.X, lon(seq.getOrdinate(i, CoordinateSequence.X))); | ||
| seq.setOrdinate(i, CoordinateSequence.Y, lat(seq.getOrdinate(i, CoordinateSequence.Y))); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the verification data for the old JTS (line 4264 above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think this is a good idea, to remove the old line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please remove the unused line.