eurostat / searoute

Compute shortest maritime routes between ports
European Union Public License 1.2
157 stars 33 forks source link

exception at finer resolutions #45

Closed giuliohome closed 3 years ago

giuliohome commented 3 years ago

I'm getting Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.locationtech.jts.geom.Geometry.getGeometryType()" because "g" is null for all resolutions (50, 20) under 100. For 100 it correctly saves the output. My command is

C:\FreightProj2020\code\searoute-2.1>jdk-15.0.1\bin\java -jar searoute.jar -i  routes\real_routes_2020-12-19_MR1.csv -res 100 -panama 1 -suez 1 -o routes\real_routes_2020-12-19_MR1.geojson
Build maritime network (resolution: 100km)...
2021-01-14 19:06:22 INFO  ENGINE:-1 - dataFileCache open start
Compute maritime routes (nb: 217)...
Save...

C:\FreightProj2020\code\searoute-2.1>jdk-15.0.1\bin\java -jar searoute.jar -i  routes\real_routes_2020-12-19_MR1.csv -res 20 -panama 1 -suez 1 -o routes\real_routes_2020-12-19_MR1.geojson
Build maritime network (resolution: 20km)...
2021-01-14 19:06:38 INFO  ENGINE:-1 - dataFileCache open start
Compute maritime routes (nb: 217)...
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.locationtech.jts.geom.Geometry.getGeometryType()" because "g" is null
        at eu.europa.ec.eurostat.searoute.GeoDistanceUtil.getLengthGeoKM(GeoDistanceUtil.java:37)
        at eu.europa.ec.eurostat.searoute.SeaRouteJarMain.main(SeaRouteJarMain.java:152)

Is it a bug or a wrong usage (but where in the latter case?)

jgaffuri commented 3 years ago

Could you find more precisely in your "real_routes_2020-12-19_MR1.csv" file for which route this error occurs?

giuliohome commented 3 years ago

Found this (for example, after a binary search)

route name,olon,olat,dlon,dlat
route46,37.3516,44.3101,53.3833,46.1528
giuliohome commented 3 years ago

it looks like my coordinates for the caspian pipeline consortium terminal are wrong

giuliohome commented 3 years ago

Sorry, this is clearly my fault. Thank you