Skip to content

Commit

Permalink
Merge pull request #340 from conveyal/fix-stop-times-rounding
Browse files Browse the repository at this point in the history
Remove rounding to 2 decimals in stop_times.shape_dist_traveled
  • Loading branch information
miles-grant-ibigroup authored Feb 3, 2022
2 parents 4a8393b + 6f20ed6 commit f840040
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/conveyal/gtfs/loader/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public Table (String name, Class<? extends Entity> entityClass, Requirement requ
new ShortField("drop_off_type", OPTIONAL, 3),
new ShortField("continuous_pickup", OPTIONAL, 3),
new ShortField("continuous_drop_off", OPTIONAL, 3),
new DoubleField("shape_dist_traveled", OPTIONAL, 0, Double.POSITIVE_INFINITY, 2),
new DoubleField("shape_dist_traveled", OPTIONAL, 0, Double.POSITIVE_INFINITY, -1),
new ShortField("timepoint", OPTIONAL, 1),
new IntegerField("fare_units_traveled", EXTENSION) // OpenOV NL extension
).withParentTable(TRIPS);
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/com/conveyal/gtfs/GTFSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ public void canLoadAndExportSimpleAgencyWithOnlyCalendarDates() {
new RecordExpectation("shape_dist_traveled", 0.0, 0.01)
}
),
// Check that the shape_dist_traveled values in stop_times are not rounded.
new PersistenceExpectation(
"stop_times",
new RecordExpectation[]{
new RecordExpectation("shape_dist_traveled", 341.4491961, 0.00001)
}
),
new PersistenceExpectation(
"trips",
new RecordExpectation[]{
Expand Down

0 comments on commit f840040

Please sign in to comment.