Easily generate translations between transport zoning systems
Project description
CAF.Space
Common Analytical Framework (CAF) Space contain geo-processing functionality useful
for transport planners. Primarily it is a tool for generating standard weighting
translations in .csv
format describing how to convert between different zoning systems.
The aim is to free tools up from directly having to do their own geo-processing, and
instead have a single source of truth to get them from!
Tool info
The tool has two main options for running a translation, either a purely spatial translation (where overlapping zones are split by area), or a weighted translation where overlapping zones are split by some other type of weighting data like population or employment data. For most purposes a weighted translation will be more accurate, and it is up to the user to decide the most appropriate weighting data to use. For both types of translation the tool runs from a config file (in yaml format). These files can be created using the inputs module, or there is an example config file in the examples folder called test.yml. Parameters for this config are described below.Spatial Correspondence
For a spatial correspondence, the only user inputs needed are shapefiles for the two zone systems you want a translation between. The parameters required for a spatial translation are as follows: zone_1:
name: The name of the first zone system you are providing. This should be as simple as possible, so for an MSOA shapefile, name should simply be MSOA.
shapefile: A file path to the shapefile you want a translation for.
id_col: The name of the unique ID column in your chosen shapefile. This can be any column as long as it is unique for each zone in the shapefile.
zone_2: Parameters the same as for zone_1, it doesn't matter which order these are in, a two-way translation will be created.
cache_path: File path to a cache of existing translations. This defaults to a location on a network drive, and it is best to keep it there if you have access to it.
tolerance: This is a float less than 1, and defaults to 0.98. If filter_slivers (explained below) is chosen, tolerance controls how big or small the slithers need to be to be rounded away. For most users this can be kept as is.
rounding: True or False. Select whether or not zone totals will be rounded to 1 after the translation is performed. Recommended to keep as True.
filter_slithers: True or False. Select whether very small overlaps between zones will be filtered out. This accounts for zone boundaries not aligning perfectly when they should between shapefiles, and the tolerance for this is controlled by the tolerance parameter. With this parameter set to false translations can be a bit messy.
The translation will be output as a csv to your output path location, in a folder named by the names selected for each zone system. Along with the csv will be a yml file containing the parameters the translation was run with, along with the date of the run.
Weighted Correspondence
For a weighted translation more parameters must be provided. The tool creates a weighted translation by first joining weighting data to a lower zone system - this is a zone system smaller than the two primary zone systems. Overlaps are then found between the three zone systems to create a set of weighted tiles across the extent of the zones. These tiles are then used to create the translation. There is a more detailed explanation of this process in the documentation. Below are the additional parameters required for a weighted translation rather than a spatial one.lower_zoning: lower_zoning is a subclass of the class used for zones 1 and 2, the first three parameters for this are the same as for zones 1 and 2. The additional parameters required for lower zoning are:
weight_data: File path to the weighting data for the lower zone system. This should be saved as a csv, and only needs two columns (an ID column and a column of weighting data)
data_col: The name of the column in the weighting data csv containing the weight data.
weight_id_col: The name of the columns in the weighting data containing the zone ids. This will be used to join the weighting data to the lower zoning, so the IDs must match, but the names of the ID columns may be different.
method: The name of the method used for weighting (e.g. pop or emp). This can be anything, but must be included as the tool checks if this parameter exists to decide whether a weighted translation can be performed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for caf.space-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e0e4e4d44547687fb5b9d55c36b819085c45ff0f703c3069f08cb237f755a23 |
|
MD5 | 72f8a0e4fe87bea12772e3760703988c |
|
BLAKE2b-256 | 9f4a1ca37f7c7fdcc03d764b769cd11af0b78cf8693807faa69f33b1ee3d2786 |