Giter Site home page Giter Site logo

ishiland / nyc-open-routing Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 2.5 MB

Routing in NYC using authoritative data and pgrouting

Dockerfile 0.80% Python 9.53% HTML 1.93% Shell 4.11% JavaScript 78.28% PLpgSQL 5.36%
pgrouting nyc routing lion geosupport

nyc-open-routing's Introduction

NYC Open Routing

Routing in NYC with pgRouting and authoritative NYC data. This project is currently a proof of concept and not intended for real world routing scenarios.

image

Features

Getting Started

This projected is orchestrated with docker-compose.

  1. Clone this repo and cd into it:

    git clone https://github.com/ishiland/nyc-open-routing.git

  2. Build the project.

    docker-compose build

  3. Start the project.

    docker-compose up -d

    If this is the first time starting, the api container will download and install geosupport. You can upgrade geosupport by specifying a different version in the .env file and restarting the service.

  4. Import the Lion data using the following command:

    docker-compose exec api sh /data-imports/scripts/import-lion.sh

    You can also specify a version of Lion:

    docker-compose exec api sh /data-imports/scripts/import-lion.sh 23a

  5. When its complete navigate to http://localhost:3001

api

Use the flask api to query routes directly. All successful requests return GeoJSON w/MultiLineString geometries. You can comment out the client container in the docker-compose.yml if all you require is the api.

Parameters:

  • orig: Origin coordinates. Expects a comma separated lat,long.
  • dest: Destination coordinates. Expects a comma separated lat,long.
  • mode: Travel mode. Can be drive, walk or bike

Example request: http://localhost:5001/api/route?orig=-74.0117,40.649221&dest=-73.951458,40.797061&mode=drive

response:

{
    "features": [
        {
            "properties": {
                "seq": 1,  // sequence of segment in route
                "street": "3 AVENUE",
                "distance": 260.679437746423,  // distance of segment in feet
                "travel_time": 0.0987422112675845,  // travel time of segment in minutes 
            },
            "geometry": {
                "type": "GeometryCollection",
                "geometries": [
                    {
                        "type": "MultiLineString",
                        "coordinates": [
                            [
                                [
                                    -74.01149956053376,
                                    40.65037686591395
                                ],
                                [
                                    -74.01207536260924,
                                    40.649811516367066
                                ]
                            ]
                        ]
                    }
                ]
            }
        },
...

Further Ideas

  • Incorporate traffic data to more accurately calculate driving costs. Live or static traffic data would be a significant improvement.
  • Add public transit modes using MTA data.
  • Ferry schedules for more accurate biking/walking cost.
  • Travel time isochrones for selected addresses.
  • Line Merge segments where possible to optimize and reduce complexity of graph.
  • Optimize functions by adding BBOX parameter.
  • Add turn by turn directions with angle (left, right, sharp right, etc. ) similar to google maps.
  • Send GeoJSON directly from the database using ST_AsGeoJSON to remove gdal dependency in api container.

Resources

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.