Link Search Menu Expand Document

Households

Table of contents

  1. Using Household Attributes for Persons
  2. Visualizing Households

Displays MATSim households.
Requires a loaded households file.

MATSim supports a household data structure, which is able to group multiple persons together as households, and assign various attributes to each household. Via can load such household.xml files and will provide the following functionality, when a Households layer is created.

Using Household Attributes for Persons

Once a Households layer is created, Via creates the connection between a household and the persons listed as members. This enables persons to access all of the attributes defined in the households file as well as some additional ones.

For example, assume a households.xml file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<households
  xmlns="http://www.matsim.org/files/dtd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.matsim.org/files/dtd http://www.matsim.org/files/dtd/households_v1.0.xsd">
  
  <household id="1">
    <members>
      <personId refId="1" />
      <personId refId="2" />
      <personId refId="3" />
    </members>
    <vehicles>
      <vehicleDefinitionId refId="23" />
    </vehicles>
    <income currency="eur" period="month">5000</income>
	<attributes>
		<attribute name="bikeCount" class="java.lang.Integer">2</attribute>
		<attribute name="loc" class="org.matsim.api.core.v01.Coord">(1.4142;2.141452)</attribute>
	</attributes>
  </household>

  ...
</households>

In this case, agents get the following additional attributes:

  • [Household] Household Id
  • [Household] Members Count
  • [Household] bikeCount
  • [Household] loc.x
  • [Household] loc.y

These attributes are also available to Vehicles, prefixed with [Driver]. This allows to style vehicles based on Household attributes.

Visualizing Households

By default, Households do not contain any spatial information in MATSim, as they only represent logical groups of persons. If households should be visualized, it is thus necessary, to provide the location as a custom attribute. In the example above, the household has an attribute loc (for location) which contains a MATSim coordinate object. As an alternative, the household could also include two Integer or Double attributes that provide the x and y coordinate values separately.

In the Households layer’s settings, one can select which attribute(s) contain the location. Once this setting is made, Via will visualize the households at the specified locations. The households can be styled based on their attributes’ values.

setting the households' locations