From 2954f961684548416d46198d38b6ba0650d7b992 Mon Sep 17 00:00:00 2001 From: Daniel Franklin Date: Mon, 15 Dec 2025 16:39:23 +0000 Subject: [PATCH] Fix missing place lon/lat IntegrationTest::plan checked that Place::point was nonnull, so I think the fact that lon and lat were always zero was a bug. --- .../org/opentripplanner/client/OtpApiClient.java | 8 +++++++- .../java/org/opentripplanner/IntegrationTest.java | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/org/opentripplanner/client/OtpApiClient.java b/client/src/main/java/org/opentripplanner/client/OtpApiClient.java index 789d1e9..1bcbee9 100644 --- a/client/src/main/java/org/opentripplanner/client/OtpApiClient.java +++ b/client/src/main/java/org/opentripplanner/client/OtpApiClient.java @@ -67,7 +67,13 @@ public class OtpApiClient { public static final StopResponseProjection STOP_PROJECTION = new StopResponseProjection().gtfsId().name().code(); public static final PlaceResponseProjection PLACE_PROJECTION = - new PlaceResponseProjection().name().departureTime().arrivalTime().stop(STOP_PROJECTION); + new PlaceResponseProjection() + .name() + .departureTime() + .arrivalTime() + .stop(STOP_PROJECTION) + .lat() + .lon(); private final CloseableHttpClient httpClient = HttpClientBuilder.create().build(); diff --git a/client/src/test/java/org/opentripplanner/IntegrationTest.java b/client/src/test/java/org/opentripplanner/IntegrationTest.java index 29ae0b1..9af47a4 100644 --- a/client/src/test/java/org/opentripplanner/IntegrationTest.java +++ b/client/src/test/java/org/opentripplanner/IntegrationTest.java @@ -1,6 +1,7 @@ package org.opentripplanner; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -68,6 +69,9 @@ public void plan() throws IOException { // First leg should not interline with previous leg (since there is no previous leg) assertFalse(leg.interlineWithPreviousLeg()); + assertEquals(OSLO_WEST.lat(), leg.from().lat(), 0.01); + assertEquals(OSLO_WEST.lon(), leg.from().lon(), 0.01); + var transitLeg = result.transitItineraries().stream() .filter(i -> i.legs().stream().anyMatch(l -> l.intermediatePlaces().isPresent())) @@ -76,11 +80,11 @@ public void plan() throws IOException { .transitLegs() .get(0); assertFalse(transitLeg.from().stop().isEmpty()); - assertNotNull(transitLeg.from().coordinate()); - assertNotNull(transitLeg.from().point()); + assertNotEquals(0, transitLeg.from().coordinate().getX()); + assertNotEquals(0, transitLeg.from().point().getX()); assertFalse(transitLeg.to().stop().isEmpty()); - assertNotNull(transitLeg.to().coordinate()); - assertNotNull(transitLeg.to().point()); + assertNotEquals(0, transitLeg.to().coordinate().getY()); + assertNotEquals(0, transitLeg.to().point().getY()); assertNotNull(transitLeg.from().stop().get().id()); assertTrue(transitLeg.trip().headsign().isPresent()); assertNotNull(transitLeg.agency());