Swiss Municipal Data Merger Tool: Manual

20.02.2021

Introduction

In Switzerland, the landscape of municipalities is changing rapidly mainly due to mergers. The Swiss Municipality Merger Tool (SMMT) automatically detects these mutations and maps municipalities of an old state to municipalities of a new state. The aim of this vignette is to illustrate how to use the functionality of the SMMT.

This figure shows the decrease in municipalities over time:
This figure shows the mutations for the decade 2010-2019:

Source: https://www.atlas.bfs.admin.ch/

How To

Setup

  1. Download & unpack the Swiss municipality inventory from the Federal Statistical Office website.
path_inventory_xml <- download_municipality_inventory(path = getwd())
  1. Import the inventory into the workspace
mutations_object <- import_CH_municipality_inventory(file_path = path_inventory_xml)
mutations        <- mutations_object$mutations

# Alternative: Use a local available version (e.g. Version from January 1st, 2018):
file_path_inventory_xml <- "path/to/eCH0071_180101.xml"
mutations_object <- import_CH_municipality_inventory(file_path = file_path_inventory_xml)
mutations        <- mutations_object$mutations

Get Mapping Table

  1. Define the old state and the new state. Example:
old_state <- as.Date("1961-01-01")
new_state <- as.Date("1963-01-01")
  1. Get mapping table
mapping_object <- map_old_to_new_state(mutations, old_state, new_state)
mapping_table  <- mapping_object$mapped

Excerpt of mapping table:

bfs_nr_new name_new bfs_nr_old name_old
4021 Baden 4021 Baden
4021 Baden 4025 Daettwil

If of relevance, use the information about municipalities which could not be mapped (e.g. due to secessions). For example, if you need to exclude these elements from a dataset.

Definitions

Further information