landtransportsg.active_mobility

Active Mobility module.

Example usage:

# get the bicycle parking locations
from landtransportsg import ActiveMobility
client = ActiveMobility(API_KEY)
bicycle_parking_locations = client.bicycle_parking(1.364897, 103.766094)

Methods

class landtransportsg.active_mobility.Client(account_key: str, cache_backend: str | BaseCache = 'sqlite')

Bases: LandTransportSg

Interact with the active mobility-related endpoints.

References: https://datamall.lta.gov.sg/content/dam/datamall/datasets/LTA_DataMall_API_User_Guide.pdf

Parameters:
  • account_key (str)

  • cache_backend (str | BaseCache)

bicycle_parking(**kwargs: Unpack[BicycleParkingArgsDict]) list[BicycleParkingDict]

Get bicycle parking locations within a radius.

Parameters:

kwargs (BicycleParkingArgsDict) – Key-value arguments to be passed as parameters to the endpoint URL.

Raises:

ValueError – distance is a negative float.

Returns:

Available bicycle parking locations at the specified location.

Return type:

list[BicycleParkingDict]

Argument Types

class landtransportsg.active_mobility.BicycleParkingArgsDict

Bases: TypedDict

Type definition for bicycle_parking() input arguments

latitude: float

Latitude map coordinates of location.

Example:

1.364897

longitude: float

Longitude map coordinates of location.

Example:

103.766094

distance: NotRequired[float]

Radius in kilometre.

Example:

0.5

Default:

0.5

Types

class landtransportsg.active_mobility.BicycleParkingDict

Bases: TypedDict

Type definition for bicycle_parking()

Description: str

Brief description of bicycle parking location.

Example:

“Bus Stop 43267”

Latitude: float

Latitude map coordinates of bicycle parking location.

Example:

1.3927176306916775

Longitude: float

Longitude map coordinates of bicycle parking location.

Example:

103.82618266340947

RackType: str

Type of bicycle parking facility.

Example:

“Racks or Yellow Box”

RackCount: int

Total number of bicycle parking lots.

Example:

10

ShelterIndicator: str

Indicate whether the bicycle parking lots are sheltered.

Example:

“Y”