💥 All location points provided by backend are in EPSG:3857
This commit is contained in:
@@ -58,8 +58,6 @@ async def shutdown():
|
||||
await db.disconnect()
|
||||
|
||||
|
||||
# /addwidget https://localhost:4443/static/#?widgetId=$matrix_widget_id&userId=$matrix_user_id
|
||||
# /addwidget https://localhost:3000/widget?widgetId=$matrix_widget_id&userId=$matrix_user_id
|
||||
STATIC_ROOT = "../frontend/"
|
||||
app.mount("/widget", StaticFiles(directory=STATIC_ROOT, html=True), name="widget")
|
||||
|
||||
@@ -94,22 +92,16 @@ async def get_line(line_id: str) -> LineSchema:
|
||||
|
||||
|
||||
def _format_stop(stop: Stop) -> StopSchema:
|
||||
# print(stop.__dict__)
|
||||
return StopSchema(
|
||||
id=stop.id,
|
||||
name=stop.name,
|
||||
town=stop.town_name,
|
||||
# xepsg2154=stop.xepsg2154,
|
||||
# yepsg2154=stop.yepsg2154,
|
||||
lat=stop.latitude,
|
||||
lon=stop.longitude,
|
||||
epsg3857_x=stop.epsg3857_x,
|
||||
epsg3857_y=stop.epsg3857_y,
|
||||
lines=[line.id for line in stop.lines],
|
||||
)
|
||||
|
||||
|
||||
# châtelet
|
||||
|
||||
|
||||
@app.get("/stop/")
|
||||
async def get_stop(
|
||||
name: str = "", limit: int = 10
|
||||
@@ -142,8 +134,6 @@ async def get_stop(
|
||||
id=stop_area.id,
|
||||
name=stop_area.name,
|
||||
town=stop_area.town_name,
|
||||
# xepsg2154=stop_area.xepsg2154,
|
||||
# yepsg2154=stop_area.yepsg2154,
|
||||
type=stop_area.type,
|
||||
lines=[line.id for line in stop_area.lines],
|
||||
stops=formatted_stops,
|
||||
@@ -187,8 +177,9 @@ async def get_next_passages(stop_id: str) -> NextPassagesSchema | None:
|
||||
|
||||
dst_names = call.DestinationDisplay
|
||||
dsts = [dst.value for dst in dst_names] if dst_names else []
|
||||
|
||||
print(f"{call.ArrivalPlatformName = }")
|
||||
arrivalPlatformName = (
|
||||
call.ArrivalPlatformName.value if call.ArrivalPlatformName else None
|
||||
)
|
||||
|
||||
next_passage = NextPassageSchema(
|
||||
line=line_id,
|
||||
@@ -197,9 +188,7 @@ async def get_next_passages(stop_id: str) -> NextPassagesSchema | None:
|
||||
atStop=call.VehicleAtStop,
|
||||
aimedArrivalTs=optional_datetime_to_ts(call.AimedArrivalTime),
|
||||
expectedArrivalTs=optional_datetime_to_ts(call.ExpectedArrivalTime),
|
||||
arrivalPlatformName=call.ArrivalPlatformName.value
|
||||
if call.ArrivalPlatformName
|
||||
else None,
|
||||
arrivalPlatformName=arrivalPlatformName,
|
||||
aimedDepartTs=optional_datetime_to_ts(call.AimedDepartureTime),
|
||||
expectedDepartTs=optional_datetime_to_ts(call.ExpectedDepartureTime),
|
||||
arrivalStatus=call.ArrivalStatus.value,
|
||||
@@ -250,7 +239,10 @@ async def get_stop_shape(stop_id: int) -> StopShapeSchema | None:
|
||||
and (shape := await StopShape.get_by_id(connection_area.id)) is not None
|
||||
):
|
||||
return StopShapeSchema(
|
||||
id=shape.id, type=shape.type, bbox=shape.bounding_box, points=shape.points
|
||||
id=shape.id,
|
||||
type=shape.type,
|
||||
epsg3857_bbox=shape.epsg3857_bbox,
|
||||
epsg3857_points=shape.epsg3857_points,
|
||||
)
|
||||
|
||||
msg = f"No shape found for stop {stop_id}"
|
||||
|
Reference in New Issue
Block a user