Skip to content

Commit

Permalink
[7.17] Fix mvt polygon orientation (#86555) (#86853)
Browse files Browse the repository at this point in the history
* Fix mvt polygon orientation (#86555)

This commit forks the method we use in JTSAdapter to generate the vector tile feature containing the right logic
for polygon orientation.
# Conflicts:
#	x-pack/plugin/vector-tile/src/test/java/org/elasticsearch/xpack/vectortile/feature/FeatureFactoryTests.java

* compile error
  • Loading branch information
iverase authored May 17, 2022
1 parent 4bb6119 commit e9d4304
Show file tree
Hide file tree
Showing 6 changed files with 520 additions and 7 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/86555.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 86555
summary: Fix mvt polygon orientation
area: Geo
type: bug
issues:
- 86560
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ private static byte[] box(int minX, int maxX, int minY, int maxY) throws IOExcep
commands[2] = BitUtil.zigZagEncode(minY);
commands[3] = encodeCommand(LINETO, 3);
// 1
commands[4] = BitUtil.zigZagEncode(maxX - minX);
commands[5] = BitUtil.zigZagEncode(0);
commands[4] = BitUtil.zigZagEncode(0);
commands[5] = BitUtil.zigZagEncode(maxY - minY);
// 2
commands[6] = BitUtil.zigZagEncode(0);
commands[7] = BitUtil.zigZagEncode(maxY - minY);
commands[6] = BitUtil.zigZagEncode(maxX - minX);
commands[7] = BitUtil.zigZagEncode(0);
// 3
commands[8] = BitUtil.zigZagEncode(minX - maxX);
commands[9] = BitUtil.zigZagEncode(0);
commands[8] = BitUtil.zigZagEncode(0);
commands[9] = BitUtil.zigZagEncode(minY - maxY);
// close
commands[10] = encodeCommand(CLOSEPATH, 1);
return writeCommands(commands, 3, 11);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mapbox-vector-tile (https://github.com/wdtinc/mapbox-vector-tile-java), with modifications
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public List<byte[]> getFeatures(Geometry geometry) {
// convert coordinates to MVT geometry
convertToMvtGeometry(flatGeometries, sequenceFilter);
// MVT geometry to MVT feature
final List<VectorTile.Tile.Feature> features = JtsAdapter.toFeatures(flatGeometries, layerProps, userDataIgnoreConverter);
final List<VectorTile.Tile.Feature> features = PatchedJtsAdapter.toFeatures(flatGeometries, layerProps, userDataIgnoreConverter);
final List<byte[]> byteFeatures = new ArrayList<>(features.size());
features.forEach(f -> byteFeatures.add(f.toByteArray()));
return byteFeatures;
Expand Down
Loading

0 comments on commit e9d4304

Please sign in to comment.