🌍 catchments
Python wrapper for multiple APIs, that provide catchments-areas. It allows to acquire and manipulate catchments from those APIs.
Installation
$ pip install catchments
Usage
Currently there are implemented two classes: SkobblerAPI and HereAPI.
You can use them as follows:
>>> from catchments import SkobblerAPI
>>> # get catchment from Skobbler API
>>> skobbler = SkobblerAPI('your_api_key')
>>> # if you don't provide params values default ones will be used
>>> params = {"range": 600, "highways": 1}
>>> catchment = skobbler.get_catchment({"lat" 52.05, "lon": 16.82}, **params)
>>> {"realReach": {...} ...}
>>> geojson = skobbler.catchment_as_geojson(catchment)
>>> {"type": "Feature", geometry: {"type": "Polygon", ...}, ...}
>>> skobbler.save_as_geojson(geojson)
>>> 'SKOBBLER_52.05_16.82.geojson'
As you can see .get_catchment method uses params as second argument. Params keys names should be exactly the same as mentioned in APIs documentations, otherwise they will be ignored and default values will be used.
Params supported by SKOBBLER and HERE:
SKOBBLER (startMercator, response_type - not supported)
You can use also inbuilt command line scripts which accept *.csv file input with points as coordinates resource. Scripts generate *.geojson files for every point in given *.csv file.
Example *.csv file structure (name column is optional):
name |
lat |
lon |
|---|---|---|
point1 |
52.0557 |
16.8278 |
point2 |
52.4639 |
16.9410 |
Example command line script usage:
$ catchments-skobbler.py -k your_api_key -p path/to/file/with/points/*.csv
All scripts and their options are mentioned below:
$ catchments-skobbler.py
-k –key [REQUIRED] [DEFAULT: None]
-p –points [REQUIRED] [DEFAULT: None]
-r –range - [OPTIONAL] [DEFAULT: 600]
-u –units - [OPTIONAL] [DEFAULT: sec]
-t –transport - [OPTIONAL] [DEFAULT: car]
-l –toll - [OPTIONAL] [DEFAULT: 0]
-w –highways - [OPTIONAL] [DEFAULT: 0]
-n –nonReachable - [OPTIONAL] [DEFAULT: 0]
$ catchments-here.py
-i –app_id [REQUIRED] [DEFAULT: None]
-c –app_code [REQUIRED] [DEFAULT: None]
-r –range - [OPTIONAL] [DEFAULT: 600]
-e –range-type - [OPTIONAL] [DEFAULT: time]
-m –mode - [OPTIONAL] [DEFAULT: fastest;car;traffic:disabled]
Tests
$ python setup.py test
TODO
Add support for Mapzen API catchments
Add support for OpenRouteService catchments
Add support for concurrent HTTP requests
Release History
1.1.1 (2017-05-04)
Split catchments-cls.py into separate scripts (one for each API)
Documentation
1.0.0 (2017-05-01)
Bug fixes, code reorganization
Better documentation
0.9.1b (2017-03-11)
Required params validation in catchments-cls.py
0.9.0b (2017-03-11)
Initial release (beta)
Metadata
Release files for catchments 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| catchments-1.1.1.tar.gz | 6.1 kB | Without provenance | Details for catchments-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| catchments-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for catchments-1.1.1-py3-none-any.whl |
Total release size: 17.2 kB
Release files / catchments-1.1.1.tar.gz
| Download URL | catchments-1.1.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fa6c5cf69ad24a61bc86c618549f5a17c084ac919dfeb805e3d074f0e8d4e49
|
|
BLAKE2b-256 checksum How to use checksums |
d46877665773abb9162c817153c9729e8043169884b2a8c8a280d7e83d13f4e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / catchments-1.1.1-py3-none-any.whl
| Download URL | catchments-1.1.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c40db1833a3e254aac1f12caf38751c2892ba07dedbfca137c5a534fb8756b07
|
|
BLAKE2b-256 checksum How to use checksums |
cfe16720fc5cf920076e672eb96ede403b74b48b7544d54b9aba439d478127c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for catchments 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.