GithubHelp home page GithubHelp logo

ddd1600 / isocronut Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drewfustin/isocronut

0.0 2.0 0.0 168 KB

For a given geospatial location, calculate an isochrone (same time) contour around it.

Python 100.00%

isocronut's Introduction

isocronut

For a given geospatial location, calculate an isochrone (same time) contour around it. Any point on an x-minute isochrone contour should take a total of x minutes of travel to reach from the origin. Any point within an x-minute contour should be reachable in fewer than x minutes.

Use

import isocronut

origin = '111 W Washington, Chicago'
duration = 10

isochrone = isocronut.get_isochrone(origin, duration)

or generate your own html file with an embedded Google Maps with isochrone (which will be written to isochrone.html in the current directory):

import isocronut

origin = '111 W Washington, Chicago'
duration = 10

isochrone = isocronut.generate_isochrone_map(origin, duration)

Parameters

origin : Google Maps parseable origination address (str) or [lat, lng] 2-list ([scalar, scalar])

duration : Number of minutes (scalar) for the isochrone contour

number_of_angles : Number of points defining the isochrone (int) -- think of it as a resolution, default: 12

tolerance : Number of minutes (scalar) that a test point can be away from duration to be considered acceptable, default: 0.1

access_type : Either 'personal' or 'business' (str), specifying if you are using a personal or business API access for Google Maps, default: 'personal'

  • If 'personal', you won't have access to traffic conditions. The format of the 'google_maps.cfg' config file must be (e.g. if your api_number were 1234567890, you would replace <your api number> below with 1234567890):
[api]
api_number=<your api number>
  • If 'business', you will be able to use current traffic conditions, which will tighten your contour distance. The format of the 'google_maps.cfg' config file must be:
[api]
client_id=<your client id>
crypto_key=<your crypto key>

config_path : Path location (str) of the 'google_maps.cfg' file, default 'config/'

Returns

Isochrone contour as a list of [lat, lng] 2-lists -- [[lat1, lng1], [lat2, lng2], ..., [latn, lngn]] where n = number_of_angles.

Dependencies

This module makes use of the following Python modules that you must have installed.

  • hashlib
  • hmac
  • base64
  • urlparse
  • ConfigParser
  • simplejson
  • urllib2
  • time
  • datetime
  • math

isocronut's People

Watchers

 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.