landtransportsg.geospatial

Geospatial module.

Example usage:

# get a geospatial whole island layer
from landtransportsg import Geospatial
client = Geospatial(API_KEY)
geospatial_whole_island = client.geospatial_whole_island('ArrowMarking')

Methods

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

Bases: LandTransportSg

Interact with the geospatial-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)

geospatial_layer_ids() tuple[str, ...]

Return the tuple of valid geospatial layer IDs.

Returns:

Tuple of valid geospatial layer IDs.

Return type:

tuple[str, …]

geospatial_whole_island(**kwargs: Unpack[GeospatiaWholeIslandArgsDict]) str

Get the SHP files of the requested geospatial layer.

Parameters:

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

Raises:

ValueError – geospatial_layer_id is not a valid ID.

Returns:

Link for downloading the requested SHP file.

Return type:

Url

Argument Types

class landtransportsg.geospatial.GeospatiaWholeIslandArgsDict

Bases: TypedDict

Type definition for geospatial_whole_island() input arguments

geospatial_layer_id: str

Name of Geospatial Layer. Use geospatial_layer_ids() for the list of Geospatial layers.

Example:

“ArrowMarking”

Types

landtransportsg.geospatial.Url

alias of str