Skip to content

Developed algorithm with Professor Nathan Ryan to study physical access to health care providers, using Google Maps API

Notifications You must be signed in to change notification settings

yashbhutwala/service-area-google-maps

Repository files navigation

service-area-google-maps

For a given [lat,long] location, calculate a service area around it. Any point on an x-minute 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.

Parameters

origin : must be a list containing [lat, lng]; For lat/long as per convention: N, E are positive; S, W are negative

duration : Number of minutes for the service area

mode : must be either 'driving' or 'walking' or 'transit' or 'bicycling', default: 'driving'

number_of_angles : Number of points defining the service area (int), default: 10

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

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

  • Make a file called 'google_maps.cfg' in a directory called 'config/'
  • Format of the 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>

Returns

  • get_service_area: A list of [lat, lng] -- [[lat1, lng1], [lat2, lng2], ..., [latn, lngn]] where n = number_of_angles.

  • generate_service_area_map: generates html file with an embedded Google Maps with service area

Dependencies

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

  • urllib.parse
  • configparser
  • simplejson
  • urllib.request
  • time
  • math

Use

origin = [39.9500, -75.1667]
duration = 30
mode = 'walking'
number_of_angles = 10
get_service_area(origin, duration, mode, number_of_angles)
# OR generate html file
generate_service_area_map(origin, duration, mode, number_of_angles)

About

Developed algorithm with Professor Nathan Ryan to study physical access to health care providers, using Google Maps API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published