Skip to main content

Wrapper around transit.land API

Project description

Transit.land API wrapper

Simple Python wrapper around <transit.land> API.

Install

pip install transitland_wrapper

CLI

All CLI commands write a list of GeoJSON Features to stdout. This way minimal results are kept in memory at once. If a geometry is passed, the geometry's bounding box is given to the transit.land API, and results are tested for intersection with the original geometry. The geometry file must be readable by GeoPandas and will automatically be reprojected to EPSG 4326 if necessary. The geometry type must be either Point, Polygon, MultiPolygon, LineString, or MultiLineString.

Operators

Usage: transitland operators [OPTIONS]

  Request operators info

Options:
  -b, --bbox TEXT      Bounding box to search within
  -g, --geometry PATH  File with geometry to use. Must be readable by
                       geopandas
  -r, --radius FLOAT   radius in meters to search around, default 100m for
                       Point geometries. Used only for Point geometries.
  --gtfs-id TEXT       ID used in a GTFS feed's agencies.txt file
  --help               Show this message and exit.

Routes

Usage: transitland routes [OPTIONS]

  Request routes info

Options:
  -b, --bbox TEXT      Bounding box to search within
  -g, --geometry PATH  File with geometry to use. Must be readable by
                       geopandas
  -r, --radius FLOAT   radius in meters to search around, default 100m for
                       Point geometries. Used only for Point geometries.
  --operated-by TEXT   search by operator onestop_id or route onestop_id
  --vehicle-type TEXT  find all routes with vehicle type(s) by integer or
                       string. Possible values defined by the GTFS spec for
                       the route_type column and the Extended GTFS Route Types
  --gtfs-id TEXT       ID used in a GTFS feed's routes.txt file
  --include-geometry   Include route geometry
  --help               Show this message and exit.

Stops

Usage: transitland stops [OPTIONS]

  Request stops info

Options:
  -b, --bbox TEXT      Bounding box to search within
  -g, --geometry PATH  File with geometry to use. Must be readable by
                       geopandas
  -r, --radius FLOAT   radius in meters to search around, default 100m for
                       Point geometries. Used only for Point geometries.
  --served-by TEXT     search by operator onestop_id or route onestop_id
  --gtfs-id TEXT       ID used in a GTFS feed's stops.txt file
  --help               Show this message and exit.

Python API

import transitland_wrapper
transitland_wrapper.stops()
transitland_wrapper.operators()
transitland_wrapper.routes()

Stops

- geometry: either Point, to search a radius around a point, or a
  Polygon or MultiPolygon, to search for stops within the geometry. If a
  Polygon or MultiPolygon is provided, the search will be done by
  bounding box, and then results will be filtered for intersection.
- radius: radius in meters to search around, default 100m for Point
  geometries. Not used for Polygon geometries.
- served_by: search by operator onestop_id or route onestop_id
- gtfs_id: ID used in a GTFS feed's stops.txt file

Operators

- geometry: either Point, to search a radius around a point, or a
  Polygon or MultiPolygon, to search for stops within the geometry. If a
  Polygon or MultiPolygon is provided, the search will be done by
  bounding box, and then results will be filtered for intersection.
- radius: radius in meters to search around, default 100m for Point
  geometries. Not used for Polygon geometries.
- gtfs_id: ID used in a GTFS feed's agencies.txt file

Routes

- geometry: either Point, to search a radius around a point, or a
  Polygon or MultiPolygon, to search for stops within the geometry. If a
  Polygon or MultiPolygon is provided, the search will be done by
  bounding box, and then results will be filtered for intersection.
- radius: radius in meters to search around, default 100m for Point
  geometries. Not used for Polygon geometries.
- operated_by: search by operator onestop_id
- vehicle_type: find all routes with vehicle type(s) by integer or
  string. Possible values defined by the GTFS spec for the route_type
  column and the Extended GTFS Route Types.
- include_geometry: If True, includes route geometry. Default: True
- gtfs_id: ID used in a GTFS feed's routes.txt file

Contributing

To release to PyPI:

bumpversion minor
python setup.py sdist
twine upload dist/transitland_wrapper-0.1.0.tar.gz

Changelog

[0.1.1] - 2020-02-08

  • Try to fix PyPI bundle

[0.1.0] - 2020-02-08

  • Initial release on PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transitland_wrapper-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file transitland_wrapper-0.1.1.tar.gz.

File metadata

  • Download URL: transitland_wrapper-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for transitland_wrapper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4400d1a8014efaadc5ab0d12095230d2e1608e0e0534dea5d86bcdeafb47371d
MD5 ddc9e57e5411b62551399ebe1df8db49
BLAKE2b-256 b1da49e413646649deb201e03456a7d284a2a0e1d5e2792561a2a90e76eb1cdb

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page