mapbox-vector-tile-java icon indicating copy to clipboard operation
mapbox-vector-tile-java copied to clipboard

Upgrade to JTS 1.17.0

Open jericks opened this issue 4 years ago • 10 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

jericks avatar Jul 22 '20 23:07 jericks

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

devemux86 avatar Jul 23 '20 06:07 devemux86

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?

jericks avatar Jul 24 '20 01:07 jericks

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

ShibaBandit avatar Jul 24 '20 04:07 ShibaBandit

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

electricsam avatar Jul 04 '21 20:07 electricsam

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 avatar Oct 23 '21 09:10 i23098

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

i23098 avatar Nov 11 '21 10:11 i23098

pls update. thank you

CodeK1988 avatar Feb 20 '23 08:02 CodeK1988

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

ggyyso avatar Feb 20 '23 08:02 ggyyso

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

ralmeida-espatial avatar Feb 20 '23 08:02 ralmeida-espatial

thank you,mate

CodeK1988 avatar Feb 20 '23 08:02 CodeK1988