Welcome to AltMo

AltMo (Alternative Mobilities)

AltMo is command line tool set written in Python which can calculate distances between residences and amenities within a city. For a full overview of how to do this and set up the necessary dependencies, head to the extensive getting started tutorial. You can find a full reference for each command in the tool set below in the Command Overview section.

Background

This tool set runs on top of PostgreSQL/PostGIS, Valhalla Routing Engine and OpenStreetMap database. It was originally used for creating walkability indices, but could potentially be extended to do more. Essentially, this tool collects all the residences in a city and then calculates the network routes to the provided amenities (these can be configured via a config file). OpenStreetMap provides the data on the amenities and residences, while Valhalla provided the routing engine to calculate distances and times.

Command Overview

Below is an overview of each command:

schema

This command is used to install or remove the database schema from your configured database.

Example usage:

# create all the tables for altmo
$ altmo schema

# remove all tables altmo created
$ altmo schema --drop

csa

This command creates a study area that is used by all the subsequent commands. The study area is how you defined the extent of the area you want to run an analysis for. You will need to first create a GeoJSON file defined this area.

Example usage:

# 3857 is the SRS_ID used in the geojson file
$ altmo csa study_area_boundary.geojson study_area_name "Description of the area" 3857

build

This command queries the planet_osm* tables in the database to create our own copy of residences and amenities. Only residences and amenities within our study area are included

Example usage:

$ altmo build study_area_name

straight

This command calculates the straight line distances between residences and the three nearest amenities of each type. This data is used by the network command.

Example usage:

$ altmo straight study_area_name

network

This command calculates the network distances between each residence and the three nearest amenities of each type generated by the straight command.

This command accepts several options:

  • --mode|-m can be either “bicycle”, “pedestrian” or “auto”

  • --out|-o can be either “stdout”, “csv” or “db” (default)

  • --category|-c filter by category (e.g. “school” or “nature”)

  • --name|-n filter by name (e.g. “supermarket” or “place_of_worship”)

Example usage:

# This will calculate network distances using "bicycle" as a
# costing parameter in Valhalla and save it to our database.
$ altmo network study_area_name --mode bicycle

# This will calculate network distances using "pedestrian" as a
# costing parameter in Valhalla and save it to a CSV file.
$ altmo network study_area_name --mode pedestrian --out csv --file-name out.csv

export

This command exports the routing information calculated by the network command. It can either export a single GeoJSON file or a folder of GeoJSON files where each file represents a residence address.

Example usage:

# save a single GeoJSON file, filtering only pedestrian routes and using SRS_ID of 4236
$ altmo export study_area_name all --srs-id 4236 --mode pedestrian

# save a folder of GeoJSON files, using SRS_ID of 4236
$ altmo export study_area_name single_residence --srs-id 4236

raster

(optional, must install as extra and have GDAL installed)

This command exports the calculated network durations as a raster image. The result is a heatmap showing how close residences are to nearby amenities.

Example usage:

# This will export a raster image filter it by mode of bicycle using a raster cell size of 50
$ altmo raster study_area_name all_pedestrian.tiff -r 50 -m bicycle