A simple package for acquiring and manipulating catchments from Skobbler and Here API
Project description
Catchments
Simple package for acquiring and manipulating catchments from SKOBBLER (Real Reach) and HERE (Isolines) API.
Installation
$ pip install catchments
Usage
You can use package functions to build Your own scripts:
>>> from catchments import request_catchment, catchment_as_geojson, \
save_as_geojson
>>> # Get catchment from API
>>> params = {'api': 'SKOBBLER', 'key': 'your_api_key'}
>>> catchment = request_catchment({'lat' 52.05, 'lon': 16.82}, **params)
>>> {"realReach": {...} ...}
>>> geojson = catchment_as_geojson(catchment, **params)
>>> {"type": "Feature", geometry: {"type": "Polygon", ...}, ...}
>>> save_as_geojson(geojson, **params)
>>> 'SKOBBLER_52.05_16.82.geojson'
Or You can use inbuilt command line script which accepts *.csv file input with points as coordinates resource.
Example *.csv file structure (name column is optional):
name |
lat |
lon |
---|---|---|
point1 |
52.0557 |
16.8278 |
point2 |
52.4639 |
16.9410 |
$ catchments-cls.py -a SKOBBLER -k your_api_key -p path/to/file/with/points/*.csv
All supported options for command line script and package functions are mentioned below:
param |
required |
default value |
---|---|---|
api |
Yes |
None |
key |
Yes |
None |
points |
Yes |
None (required only by catchments-cls.py) |
range |
No |
600 |
units |
No |
sec (SKOBBLER) time (HERE) |
transport |
No |
car |
jam |
No |
disabled (HERE API only) |
toll |
No |
1 (SKOBBLER API only) - currently not supported by catchments-cls.py |
highways |
No |
1 (SKOBBLER API only) - currently not supported by catchments-cls.py |
non_reachable |
No |
1 (SKOBBLER API only) - currently not supported by catchments-cls.py |
Tests
$ python setup.py test
To fix
Refactor cyclomatic complexity (11) for catchment_as_geojson function
Release History
0.9.0b (2017-03-11)
Initial release (beta)
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
Built Distribution
Hashes for catchments-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d4b2cf9f627df215ad38fc6714b23778fd5bdd3b7b14bd1abc72b49804bb80d |
|
MD5 | afb73c3cc37b073d7d09014065c66c10 |
|
BLAKE2b-256 | 77b4ac2d52ff8f57d21f3a010ee3f71d13c7f6bb1e596b62913e0683a4c966a5 |