gis-ops / routingpy

🌎 Python library to access all public routing, isochrones and matrix APIs in a consistent manner.
https://routingpy.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
252 stars 26 forks source link

Add convenience method for converting between intervals and buckets #43

Closed chrstnbwnkl closed 2 years ago

chrstnbwnkl commented 2 years ago

Since graphhopper's isochrone endpoint expects a limit and a number of buckets instead of intervals, what if we provide a convenience method that takes a time limit and a number of buckets and converts it to intervals like this:

time_limit = 850
buckets = 5
intervals = [int(time_limit-n*time_limit/buckets) for n in range(buckets)]

Pretty high level, but possibly a nice gem and a contribution to consistent access across routers ;)