Skip to main content

A simple package for acquiring and manipulating catchments from Skobbler and Here API

Project description

https://travis-ci.org/Luqqk/catchments.svg?branch=master https://coveralls.io/repos/github/Luqqk/catchments/badge.svg https://lima.codeclimate.com/github/Luqqk/catchments/badges/gpa.svg?output=embed

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.1b (2017-03-11)

  • Required params validation in catchments-cls.py

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

catchments-0.9.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

catchments-0.9.1-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

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