包装过境地美国石油学会
transitland-wrapper的Python项目详细描述
在过境地API包装
围绕https://transit.landAPI的简单Python包装器。在
安装
pip install transitland_wrapper
命令行接口
所有CLI命令都会将GeoJSONFeature
的列表写入stdout。这条路很小
结果立即保存在内存中。如果传递了geometry
,则几何体的
边界框提供给过境地和测试结果
与原始几何体相交。geometry
文件必须由可读
如有必要,GeoPandas和将自动重新投影到EPSG 4326。这个
几何体类型必须是Point
,Polygon
,MultiPolygon
,LineString
,
或MultiLineString
。在
操作员
^{pr2}$路线
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 / --no-include-geometry
Include route geometry [default: True]
-p, --per-page INTEGER Number of results per page [default: 50]
--page-all / --no-page-all Page over all responses [default: False]
--help Show this message and exit.
停止
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
-p, --per-page INTEGER Number of results per page [default: 50]
--page-all / --no-page-all Page over all responses [default: False]
--help Show this message and exit.
路线停止模式
Usage: transitland route-stop-patterns [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
--traversed-by TEXT find all Route Stop Patterns belonging to route
--stops-visited TEXT any one or more stop Onestop IDs, separated by
comma. Finds Route Stop Patterns with
stops_visited in stop_pattern
--trips TEXT any one or more trip ids, separated by comma.
Finds Route Stop Patterns with specified trips
in trips
-p, --per-page INTEGER Number of results per page [default: 50]
--page-all / --no-page-all Page over all responses [default: False]
--help Show this message and exit.
计划停止对
Usage: transitland schedule-stop-pairs [OPTIONS]
Request schedule stop pairs info
Options:
-b, --bbox TEXT Bounding box to search within
-g, --geometry PATH File with geometry to use. Must be readable
by GeoPandas
--origin-onestop-id TEXT Find all Schedule Stop Pairs from origin
--destination-onestop-id TEXT Find all Schedule Stop Pairs to a
destination
--date TEXT Find all Schedule Stop Pairs from origin on
date
--service-from-date TEXT Find all Schedule Stop Pairs in effect from
a date
--service-before-date TEXT Find all Schedule Stop Pairs in effect
before a date
--origin-departure-between TEXT
Find all Schedule Stop Pairs with
origin_departure_time in a range
--trip TEXT Find all Schedule Stop Pairs by trip
identifier
--route-onestop-id TEXT Find all Schedule Stop Pairs by route
--operator-onestop-id TEXT Find all Schedule Stop Pairs by operator
--active / --no-active Schedule Stop Pairs from active FeedVersions
[default: True]
-p, --per-page INTEGER Number of results per page [default: 50]
--page-all / --no-page-all Page over all responses [default: False]
--help Show this message and exit.
Onestop ID
Usage: transitland onestop-id [OPTIONS]
Request onestop_id info
Options:
--oid TEXT a Onestop ID for any type of entity (for example, a stop or
an operator)
-f, --file PATH a file with one or more Onestop IDs, with each on their own
line.
--help Show this message and exit.
进料
Usage: transitland feeds [OPTIONS]
Request feeds info
Options:
-b, --bbox TEXT Bounding box to search within
-g, --geometry PATH File with geometry to use. Must be readable by
GeoPandas
-p, --per-page INTEGER Number of results per page [default: 50]
--page-all / --no-page-all Page over all responses [default: False]
--help Show this message and exit.
Python API
每个函数返回结果的generator,因为可能存在
未知的寻呼量。迭代器的每个项都是
GeoJSONFeature
s
importtransitland_wrappertransitland_wrapper.stops()transitland_wrapper.operators()transitland_wrapper.routes()transitland_wrapper.route_stop_patterns()transitland_wrapper.schedule_stop_pairs()transitland_wrapper.onestop_id()transitland_wrapper.feeds()
停止
- 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
- per_page: number of results per page, by default 50
- page_all: page over all responses
操作员
- 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
- per_page: number of results per page, by default 50
- page_all: page over all responses
路线
- 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
- per_page: number of results per page, by default 50
- page_all: page over all responses
路线停止模式
- geometry: either 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.
- traversed_by: find all Route Stop Patterns belonging to route
- stops_visited: any one or more stop Onestop IDs, separated by comma. Finds Route Stop Patterns with stops_visited in stop_pattern.
- trips: any one or more trip ids, separated by comma. Finds Route Stop Patterns with specified trips in trips.
- per_page: number of results per page, by default 50
- page_all: page over all responses
计划停止对
- geometry: either 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.
- origin_onestop_id: Find all Schedule Stop Pairs from origin. Accepts multiple Onestop IDs, separated by commas
- destination_onestop_id: Find all Schedule Stop Pairs to a destination. Accepts multiple Onestop IDs, separated by commas
- date: Find all Schedule Stop Pairs from origin on date
- service_from_date: Find all Schedule Stop Pairs in effect from a date
- service_before_date: Find all Schedule Stop Pairs in effect before a date
- origin_departure_between: Find all Schedule Stop Pairs with origin_departure_time in a range
- trip: Find all Schedule Stop Pairs by trip identifier
- route_onestop_id: Find all Schedule Stop Pairs by route. Accepts multiple Onestop IDs, separated by commas.
- operator_onestop_id: Find all Schedule Stop Pairs by operator. Accepts multiple Onestop IDs, separated by commas.
- active: Schedule Stop Pairs from active FeedVersions
- per_page: number of results per page, by default 50
- page_all: page over all responses
Onestop ID
- oid: a Onestop ID for any type of entity (for example, a stop or an operator)
进料
- geometry: either 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.
贡献
发布到PyPI:
bumpversion minor
python setup.py sdist
twine upload dist/transitland_wrapper-0.1.0.tar.gz
变更日志
[0.5.0]-2020-02-23
- 添加源终结点
- 默认情况下,将
page-all
设置为false
[0.4.2]-2020-02-19
- 修复字符串被视为要联接的iterable的错误
[0.4.1]-2020-02-19
- 修复routes cli使用operators API端点的错误
[0.4.0]-2020-02-09
- 添加分页大小参数
- 添加选项“不翻页覆盖所有响应”
[0.3.0]-2020-02-09
- 添加onestop_id终结点
[0.2.0]-2020-02-08
- 添加路由停止模式和调度停止对终结点
[0.1.1]-2020-02-08
- 尝试修复PyPI包
[0.1.0]-2020-02-08
- PyPI的初始版本
- 项目
标签: