diff --git a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/JobScheduler.java b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/JobScheduler.java index 1b05b3b..5ec635b 100644 --- a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/JobScheduler.java +++ b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/JobScheduler.java @@ -185,7 +185,7 @@ public void calculateGtfs() throws Exception { GTFSWriter.writeRoutes(gtfsRoutes); GTFSWriter.writeTrips(gtfsTrips); GTFSWriter.writeFeedInfo(gtfsFeedInfos); - GTFSWriter.writeShape(gtfsShapes); + GTFSWriter.writeShapes(gtfsShapes); uploadToS3(); } @@ -196,7 +196,7 @@ private static double haversineDist(double lat1, double lon1, double lat2, doubl Math.sin(lat1 * (Math.PI/180)) * Math.sin(lat2 * (Math.PI/180)) + Math.cos(lat1 * (Math.PI/180)) * Math.cos(lat2 * (Math.PI/180)) * Math.cos(theta * (Math.PI/180)) ); - return distance * 1.609344; + return distance * 1609.344; } private void uploadToS3() throws Exception { diff --git a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/file/GTFSWriter.java b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/file/GTFSWriter.java index 115aef5..bf14aa2 100644 --- a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/file/GTFSWriter.java +++ b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/file/GTFSWriter.java @@ -174,9 +174,9 @@ public static void writeFeedInfo(List feedInfos) throws Exception writeCsv("feed_info.txt", csv); } - public static void writeShape(List shapes) throws Exception { + public static void writeShapes(List shapes) throws Exception { var csv = newCsv(); - addRow(csv, " shape_id", "shape_pt_lat", "shape_pt_lon", "shape_pt_sequence", "shape_dist_traveled"); + addRow(csv, "shape_id", "shape_pt_lat", "shape_pt_lon", "shape_pt_sequence", "shape_dist_traveled"); shapes.stream() // shapes unique per ID/sequence @@ -195,6 +195,6 @@ public static void writeShape(List shapes) throws Exception { String.valueOf(shape.shape_pt_sequence()), shape.shape_dist_traveled())); - writeCsv("shape.txt", csv); + writeCsv("shapes.txt", csv); } }