From 71ab5dfa81d3879df000b365ca69f160bda74370 Mon Sep 17 00:00:00 2001 From: vingerha <44190435+vingerha@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:48:34 +0100 Subject: [PATCH] Re-on fix GeoJSON reducing to two digits of trip_id, assuming there may be more that 10 and less than 100 on the same route at the same time --- custom_components/gtfs2/gtfs_rt_helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/gtfs2/gtfs_rt_helper.py b/custom_components/gtfs2/gtfs_rt_helper.py index 1b6b898..de43b79 100644 --- a/custom_components/gtfs2/gtfs_rt_helper.py +++ b/custom_components/gtfs2/gtfs_rt_helper.py @@ -370,8 +370,8 @@ def get_rt_vehicle_positions(self): geojson_element["geometry"]["coordinates"] = [] geojson_element["geometry"]["coordinates"].append(vehicle.position.longitude) geojson_element["geometry"]["coordinates"].append(vehicle.position.latitude) - geojson_element["properties"]["id"] = str(vehicle.trip.route_id) + "(" + str(vehicle.trip.direction_id) + ")" + str(vehicle.trip.trip_id)[-3:] - geojson_element["properties"]["title"] = str(vehicle.trip.route_id) + "(" + str(vehicle.trip.direction_id) + ")" + str(vehicle.trip.trip_id)[-3:] + geojson_element["properties"]["id"] = str(vehicle.trip.route_id) + "(" + str(vehicle.trip.direction_id) + ")" + str(vehicle.trip.trip_id)[-2:] + geojson_element["properties"]["title"] = str(vehicle.trip.route_id) + "(" + str(vehicle.trip.direction_id) + ")" + str(vehicle.trip.trip_id)[-2:] geojson_element["properties"]["trip_id"] = vehicle.trip.trip_id geojson_element["properties"]["route_id"] = vehicle.trip.route_id geojson_element["properties"]["direction_id"] = vehicle.trip.direction_id