Coder Social home page Coder Social logo

punkerpunker / isochrone Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 3.0 2.53 MB

Walking distance area calculator

License: MIT License

Python 44.20% PLpgSQL 51.08% Dockerfile 4.72%
walking-areas calculating-isochrones graph isochrones isochrone-map docker-compose docker pgrouting python

isochrone's Introduction

Issues Forks Stats License Contributors

Isochrone

Isochrone API that provides a functionality of calculating isochrones (walking areas).

Install:

  1. Download graph for regions where you need to calculate isochrones. Download .osm.pbf files from http://download.geofabrik.de/.
  2. Put your .osm.pbf. files under containers/app/osm/pbf directory (currently there is rutland-latest.osm.pbf for illustration reasons, remove it if you don't need this area).
  3. Run docker-compose up --build (Hints on how-to install docker and docker-compose)

Then, you'll need to wait until graph is uploaded to DB. During upload, you might see messages like this docker-compose logs app:

[|                                   ] (1%) Total processed: 20000        Vertices inserted: 58672       Split ways inserted 53186
[*|                                  ] (3%) Total processed: 40000        Vertices inserted: 48981       Split ways inserted 46608
[**|                                 ] (5%) Total processed: 60000        Vertices inserted: 46003       Split ways inserted 43317
[***|                                ] (6%) Total processed: 80000        Vertices inserted: 33135       Split ways inserted 34595
[****|                               ] (8%) Total processed: 100000       Vertices inserted: 16320       Split ways inserted 18170

When API is ready you'll see message like this docker-compose logs app:

* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
  Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:1769/ (Press CTRL+C to quit)

Usage:

In order to calculate isochrone you need to pass 3 query parameters to API:

  1. X (float) - Longitude of a point for which you want to calculate walking area.
  2. Y (float) - Latitude of a point for which you want to calculate walking area.
  3. sec (integer) - Number of seconds (600 - 10 minute walking area, 300 - 5 minute walking area, etc.)

Example:

import requests

url = 'http://localhost:1769/isochrone?'

params = {'X': -0.1946611966680779, 'Y': 51.46534965585685, 'sec': 300}
resp = requests.get(url, params=params)

print(resp.json())
POLYGON((-0.200436112629018 51.4667218592721,-0.200446733267529 51.4667235969986,-0.200460738988607 51.466725888585,-0.200490282193392 51.4667307223818, ...))

alt text

isochrone's People

Contributors

alexkay28 avatar marketinglogic avatar punkerpunker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.