wdtinc / mapbox-vector-tile-java

Java Mapbox Vector Tile Library for Encoding/Decoding
Apache License 2.0
147 stars 73 forks source link

Upgrade to JTS 1.17.0 #48

Open jericks opened 4 years ago

jericks commented 4 years ago

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

devemux86 commented 4 years ago

Please see https://github.com/wdtinc/mapbox-vector-tile-java/issues/32#issuecomment-479069089

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

Related to https://github.com/locationtech/jts/issues/145

jericks commented 4 years ago

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?

ShibaBandit commented 4 years ago

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

electricsam commented 3 years ago

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

i23098 commented 2 years ago

There's a pull request for JTS 1.18 - https://github.com/wdtinc/mapbox-vector-tile-java/pull/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.

i23098 commented 2 years ago

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...

CodeK1988 commented 1 year ago

pls update. thank you

ggyyso commented 1 year ago

这是来自QQ邮箱的自动回复邮件。   您好,您的邮件已收到。

ralmeida-espatial commented 1 year ago

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

CodeK1988 commented 1 year ago

thank you,mate