wdtinc / mapbox-vector-tile-java

Java Mapbox Vector Tile Library for Encoding/Decoding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade to JTS 1.17.0

jericks opened this issue · comments

JTS 1.17.0 changed the signature of the Polygon.getExteriorRing() method and it now returns a LinearRing instead of a LineString. This leads to this error when you try to use a current version of this library with JTS 1.17.0:

java.lang.NoSuchMethodError: org.locationtech.jts.geom.Polygon.getExteriorRing()Lorg/locationtech/jts/geom/LineString;

at com.wdtinc.mapbox_vector_tile.adapt.jts.JtsAdapter.toFeature(JtsAdapter.java:357)
at com.wdtinc.mapbox_vector_tile.adapt.jts.JtsAdapter.toFeatures(JtsAdapter.java:300)
at com.wdtinc.mapbox_vector_tile.adapt.jts.JtsAdapter$toFeatures$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:157)

The upgrade is pretty easy. There is only one code change in a test (in MvtReaderTest PackedCoordinateSequenceFactory constructor now only takes one parameter not two). I will follow up with a PR.

Thanks!
Jared

commented

Please see #32 (comment)

Android JTS 1.16+ compatibility remains the same(?) forcing Java 8 and Android 7 Nougat (--min-api 24).

Related to locationtech/jts#145

That is a problem. Projects like GeoTools have already upgraded JTS. I wonder, could we create a 3.x branch that stays on JTS 1.15 and a 4.x branch that upgrades to 1.17?

Yes this has come up before. Either need to provide two versions at the library level or have applications shade the dependencies.

I am also running into this issue. All of the projects that I work on use JTS 1.18.

There's a pull request for JTS 1.18 - #52

Would be great if the dependency could be upgraded even if it meant 2 versions of the library. As other projects (like GeoTools) upgrade JTS, starts to become a big issue.

Since it seems there's no development being done in this project :( I raised an issue in Java - https://bugs.openjdk.java.net/browse/JDK-8276963

If Java fixes it, we could upgrade JTS dependency without getting the exception... They set it as a P4, so, not that much hope :(

Edit: Seems it works as specified by the Java Specification, so, the only way we can have this fixed is by upgrading the JTS dependency and rebuild...

pls update. thank you

commented

Just so others hitting this issue know, there's a fork that is being updated - https://github.com/sebasbaumh/mapbox-vector-tile-java

thank you,mate