openmove / odh-mentor-otp

https://mobility.meran.eu
1 stars 3 forks source link

meran bikesharing without badge number #69

Closed stefanocudini closed 3 years ago

zabuTNT commented 3 years ago

In order to show bikesharing station we call this otp endpoint:

https://otp.opendatahub.testingmachine.eu/otp/routers/openmove/bike_rental

Station has this structure:

<stations>
<id>"1371339801"</id> <----- station code
<name>Via Piave Terme/Piavestraße Therme</name>
<x>11.1596901128485</x>
<y>46.6691707274645</y>
<allowDropoff>true</allowDropoff>
<allowPickup>true</allowPickup>
<networks>
<networks>ME</networks> <---- network, in this case MERAN
</networks>
<bikesAvailable>0</bikesAvailable>
<spacesAvailable>1000</spacesAvailable>
<isFloatingBike>false</isFloatingBike> <----it's a station
<isCarStation>false</isCarStation>
<realTimeData>true</realTimeData>
</stations>
  1. Floating Bike must be hidden.
  2. In case of Meran network bikesAvailable will be always equal to 0 because they are virtual stations. In order to know how many bicycle are available in the station must be performed a call to

https://gbfs.otp.opendatahub.testingmachine.eu/me/1/free_bike_status.json

a floating bike object is something like this:

{
"bike_id": "1063205539",
"lat": 46.672608,
"lon": 11.150585,
"is_reserved": true,
"is_disabled": true,
"vehicle_type_id": "bike",
"station_id": "304968321"
},

in this case the bike is in the virtual station 304968321. So we must sum all the bicycle and show the real number in the badge.