Crate popdat[−][src]
Expand description
popdat (“population data”) generates Scenarios
given a map and some external census data.
Some of this functionality should maybe be reorganized or incorporated into the importer crate,
but for now, it’s convenient to organize it here.
All of the types and methods here are tied to a single Map
. Even if a city is chopped up into
multiple pieces, for now, let’s assume we’re just dealing with one map at a time. That lets us
use the map’s coordinate system, building IDs, etc.
These types form a pipeline:
- For a given map, find some census data that describes how many people live in different areas of the city. (CensusArea)
- Take the CensusAreas and turn them into individual CensusPersons, by randomly choosing a specific building on the map as their home, and assigning specific attributes based on the census data’s distribution.
- For each CensusPerson, classify them into a PersonType, then generate a Schedule of different Activities throughout the day.
- Pick specific buildings to visit to satisfy the Schedule.
Modules
This is a standalone pipeline for generating a Scenario, starting from origin-destination data (also called desire lines), which gives a count of commuters between two zones, breaking down by mode.
Structs
Represents aggregate demographic data for some part of a city. These could be census tracts or blocks, depending what data we find. All of the areas should roughly partition the map – we probably don’t need to guarantee we cover every single building, but we definitely shouldn’t have two overlapping areas.
Demographic information for a single person
Any arbitrarily chosen parameters needed should be put here, so they can be controlled from the UI or tuned for different cities.
A single person’s daily schedule. It’s assumed that someone always starts at home. And for most people, the last entry should probably be Activity::Home.
Enums
Different things people might do in the day. Maybe it’s more clear to call this a DestinationType or similar.
It might be useful to classify a CensusPerson into different categories to figure out their Schedule.
Functions
Starting from some number of total people living in a polygonal area, randomly distribute them to residential buildings within that area. Returns a list of homes with the number of residents in each.
Wires together all the pieces, so you can just hand this any map, and it’ll automatically find appropriate census data, and use it to produce a Scenario.