Type: | Package |
Title: | Official Gridded Data from the German Census 2022 |
Version: | 1.0.0 |
Maintainer: | Jonas Lieth <jonas.lieth@gesis.org> |
Description: | Provides fast and easy access to German census grid data from the 2011 and 2022 censuses https://www.zensus2022.de/, including a wide range of socio-economic indicators at multiple spatial resolutions (100m, 1km, 10km). Enables efficient download, processing, and analysis of large census datasets covering population, households, families, dwellings, and buildings. Harmonized data structures allow direct comparison with the 2011 census, supporting temporal and spatial analyses. Facilitates conversion of data into common formats for spatial analysis and mapping ('terra', 'sf', 'ggplot2'). |
License: | MIT + file LICENSE |
URL: | https://github.com/jslth/z22/, https://jslth.github.io/z22/ |
BugReports: | https://github.com/jslth/z22/issues |
Encoding: | UTF-8 |
Depends: | R (≥ 3.3.0) |
Imports: | utils, stats, cli, httr2, dplyr, arrow |
Suggests: | terra, sf, ggplot2, sinew, knitr, rmarkdown, testthat (≥ 3.0.0) |
RoxygenNote: | 7.3.2 |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2025-05-14 12:29:44 UTC; PC |
Author: | Jonas Lieth |
Repository: | CRAN |
Date/Publication: | 2025-05-19 08:40:02 UTC |
z22: Official Gridded Data from the German Census 2022
Description
Provides fast and easy access to German census grid data from the 2011 and 2022 censuses https://www.zensus2022.de/, including a wide range of socio-economic indicators at multiple spatial resolutions (100m, 1km, 10km). Enables efficient download, processing, and analysis of large census datasets covering population, households, families, dwellings, and buildings. Harmonized data structures allow direct comparison with the 2011 census, supporting temporal and spatial analyses. Facilitates conversion of data into common formats for spatial analysis and mapping ('terra', 'sf', 'ggplot2').
Author(s)
Maintainer: Jonas Lieth jonas.lieth@gesis.org (ORCID) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/jslth/z22/issues
Feature categories
Description
While some features contain total counts or averages, others contain figures
classified by certain categories. You can access these tables
programmatically using z22_categories
.
For further clarification of terms used in the category labels, see the glossary.
Usage
z22_categories(feature)
Arguments
feature |
A grid feature. See |
Value
A tibble containing the category code (code
) as well as
German and English labels (german
and english
). Each row
relates to a category of a feature.
Categories
birth_country
-
code german english 1 Deutschland Germany 20 Ausland Foreign 21 EU27-Land EU27 country 22 Europa Europe 23 Welt World 24 Sonstige Other
sex
-
code german english 1 Männlich Male 2 Weiblich Female
religion
-
code german english 1 Römisch-katholische Kirche Roman Catholic Church 2 Evangelische Kirche Evangelical Church 3 Sonstige, keine, ohne Angabe Other, none, no information
citizenship
-
code german english 1 Deutschland Germany 2 Ausland Foreign
citizenship_group
-
code german english 1 Deutschland Germany 20 Ausland Foreign 21 EU27-Land EU27 Country 22 Sonstiges Europa Other Europe 23 Sonstige Welt Other World 24 Sonstige Other
citizenship_origin
-
code german english 1 Deutschland Germany 2 Bosnien und Herzegowina Bosnia and Herzegovina 3 Griechenland Greece 4 Italien Italy 5 Kasachstan Kazakhstan 6 Kroatien Croatia 7 Niederlande Netherlands 8 Österreich Austria 9 Polen Poland 10 Rumänien Romania 11 Russische Föderation Russian Federation 12 Türkei Turkey 13 Ukraine Ukraine 14 Sonstige Other
citizenship_total
-
code german english 1 Eine Staatsangehörigkeit One citizenship 2 Mehrere, deutsch und ... Several, German and ... 3 Mehrere, nur ausländische Several, only foreign 4 Nicht bekannt Unknown
age_short
-
code german english 1 Unter 18 Under 18 2 18 - 29 18 to 29 3 30 - 49 30 to 49 4 50 - 64 50 to 64 5 65 und älter 65 and older
age_long
-
code german english 1 Unter 10 Under 10 2 10 - 19 10 to 19 3 20 - 29 20 to 29 4 30 - 39 30 to 39 5 40 - 49 40 to 49 6 50 - 59 50 to 59 7 60 - 69 60 to 69 8 70 - 79 70 to 79 9 80 und älter 80 and older
marital_status
-
code german english 1 Ledig Single 2 Verheiratet Married 3 Verwitwet Widowed 4 Geschieden Divorced 5 Eingetr. Lebenspartnerschaft Registered partnership 6 Eingetr. Lebenspartner/-in verstorben Registered partner deceased 7 Eingetr. Lebenspartnerschaft aufgehoben Registered partnership annulled 8 Ohne Angabe No information
family_type
-
code german english 1 Ehepaare ohne Kind Couples without child 2 Ehepaare, mind. 1 Kind < 18 Couples, at least 1 child < 18 3 Ehepaare alle Kinder >= 18 Couples all children >= 18 4 Eingetr. Lebenspartnerschaften ohne Kind Registered civil partnerships without child 5 Eingetr. Lebenspartnerschaften mind. 1 Kind < 18 Registered civil partnerships, at least 1 child < 18 6 Eingetr. Lebenspartnerschaften alle Kinder >= 18 Registered civil partnerships all children >= 18 7 Nichteheliche Lebensgem. ohne Kind Non-marital partnerships without child 8 Nichteheliche Lebensgem. mind. 1 Kind < 18 Non-marital partnerships, at least 1 child < 18 9 Nichteheliche Lebensgem. alle Kinder >= 18 Non-marital partnerships all children >= 18 10 Alleinerziehende Väter mind. 1 Kind < 18 Single fathers, at least 1 child < 18 11 Alleinerziehende Väter alle Kinder >= 18 Single fathers all children >= 18 12 Alleinerziehende Mütter mind. 1 Kind < 18 Single mothers, at least 1 child < 18 13 Alleinerziehende Mütter alle Kinder >= 18 Single mothers all children >= 18
family_size
-
code german english 1 2 Personen 2 Persons 2 3 Personen 3 Persons 3 4 Personen 4 Persons 4 5 Personen 5 Persons 5 6 und mehr Personen 6 and more Persons
household_family
-
code german english 1 Einpersonenhaushalte (Singlehaushalte) One-person households (Single households) 2 Paare ohne Kind(er) Couples without child(ren) 3 Paare mit Kind(ern) Couples with child(ren) 4 Alleinerziehende Elternteile Single parents 5 Mehrpersonenhaushalte ohne Kernfamilie Multi-person households without core family
household_lifestyle
-
code german english 1 Einpersonenhaushalte (Singlehaushalte) One-person households (Single households) 2 Ehepaare Married couples 3 Eingetr. Lebenspartnerschaften Registered civil partnerships 4 Nichteheliche Lebensgemeinschaften Non-marital partnerships 5 Alleinerziehende Mütter Single mothers 6 Alleinerziehende Väter Single fathers 7 Mehrpersonenhaushalte ohne Kernfamilie Multi-person households without core family
household_senior
-
code german english 1 Haushalte mit ausschließlich Senioren/-innen Households with only seniors 2 Haushalte mit Senioren/-innen und Jüngeren Households with seniors and younger people 3 Haushalte ohne Senioren/-innen Households without seniors
household_size_group
-
code german english 1 1 Person 1 Person 2 2 Personen 2 Persons 3 3 Personen 3 Persons 4 4 Personen 4 Persons 5 5 Personen 5 Persons 6 6 und mehr Personen 6 and more Persons
dwelling_occupancy
-
code german english 1 Von Eigentümer/-in bewohnt Occupied by owner 11 Eigentum: mit aktuell geführtem Haushalt Ownership: with currently managed household 12 Eigentum: ohne aktuell geführtem Haushalt Ownership: without currently managed household 2 Zu Wohnzwecken vermietet Rented for residential purposes 21 Vermietet: mit aktuell geführtem Haushalt Rented: with currently managed household 22 Vermietet: ohne aktuell geführtem Haushalt Rented: without currently managed household 3 Ferien- und Freizeitwohnung Holiday and leisure home 4 Leer stehend Vacant 5 Diplomaten-/Streitkräftewohnung Diplomatic/Military housing 99 Gewerbl. Nutzung Commercial use
dwelling_ownership_home
-
code german english 1 Privatperson/-en Private person(s) 2 Privatwirtschaftliche Unternehmen (jur. Personen) Private sector companies (legal persons) 3 Öffentliche Unternehmen, Kirchen o.ä. Public companies, churches or similar 4 Wohnungsgenossenschaft Housing cooperative 99 Trifft nicht zu (da keine Eigentumswohnung) Does not apply (no condominium)
dwelling_ownership_property
-
code german english 1 Gemeinschaft von Wohnungseigentümern/-innen Homeowner association 2 Privatperson/-en Private person(s) 3 Wohnungsgenossenschaft Housing cooperative 4 Kommune oder Kommunales Wohnungsunternehmen Municipality or municipal housing company 5 Privatwirtschaftliches Wohnungsunternehmen Private sector housing company 6 Anderes privatwirtschaftliches Unternehmen Other private sector company 7 Bund oder Land Federal or state government 8 Organisation ohne Erwerbszweck (z.B. Kirche) Non-profit organization (e.g. church)
floor_space
-
code german english 1 Unter 30 Under 30 2 30 - 39 30 - 39 3 40 - 49 40 - 49 4 50 - 59 50 - 59 5 60 - 69 60 - 69 6 70 - 79 70 - 79 7 80 - 89 80 - 89 8 90 - 99 90 - 99 9 100 - 109 100 - 109 10 110 - 119 110 - 119 11 120 - 129 120 - 129 12 130 - 139 130 - 139 13 140 - 149 140 - 149 14 150 - 159 150 - 159 15 160 - 169 160 - 169 16 170 - 179 170 - 179 17 180 und mehr 180 and more 99 t.n.z., gewerblich n.a., commercial
dwelling_rooms
-
code german english 1 1 Raum 1 Room 2 2 Räume 2 Rooms 3 3 Räume 3 Rooms 4 4 Räume 4 Rooms 5 5 Räume 5 Rooms 6 6 Räume 6 Rooms 7 7 und mehr Räume 7 and more Rooms 99 t.n.z., gewerblich n.a., commercial
dwelling_constr_year
-
code german english 1 Vor 1919 Before 1919 2 1919 - 1948 1919 - 1948 3 1949 - 1978 1949 - 1978 4 1979 - 1986 1979 - 1986 5 1987 - 1990 1987 - 1990 6 1991 - 1995 1991 - 1995 7 1996 - 2000 1996 - 2000 8 2001 - 2004 2001 - 2004 9 2005 - 2008 2005 - 2008 10 2009 und später 2009 and later
dwelling_building_type
-
code german english 1 Gebäude mit Wohnraum Building with living space 11 Wohngebäude Residential building 111 Wohngebäude (ohne Wohnheime) Residential building (excluding dormitories) 112 Wohnheim Dormitory 12 Sonstiges Gebäude mit Wohnraum Other building with living space
dwelling_building_design
-
code german english 1 Freistehendes Haus Detached house 2 Doppelhaus Hälfte Semi-detached house 3 Gereihtes Haus Terraced house 4 Anderer Gebäudetyp Other building type
dwelling_building_size
-
code german english 1 Freistehendes Einfamilienhaus Detached single-family house 2 Einfamilienhaus: Doppelhaushälfte Single-family house: semi-detached 3 Einfamilienhaus: Reihenhaus Single-family house: terraced 4 Freistehendes Zweifamilienhaus Detached two-family house 5 Zweifamilienhaus: Doppelhaushälfte Two-family house: semi-detached 6 Zweifamilienhaus: Reihenhaus Two-family house: terraced 7 Mehrfamilienhaus: 3-6 Wohnungen Multi-family house: 3-6 apartments 8 Mehrfamilienhaus: 7-12 Wohnungen Multi-family house: 7-12 apartments 9 Mehrfamilienhaus: 13 und mehr Wohnungen Multi-family house: 13 and more apartments 10 Anderer Gebäudetyp Other building type
dwelling_heat_type
-
code german english 1 Fernheizung (Fernwärme) District heating (long-distance heating) 2 Etagenheizung Self-contained central heating 3 Blockheizung Block heating 4 Zentralheizung Central heating 5 Einzel-/Mehrraumöfen (auch Nachtspeicherheizung) Individual/multi-room stoves (including night storage heating) 6 Keine Heizung im Gebäude oder in den Wohnungen No heating in the building or in the apartments
dwelling_heat_src
-
code german english 1 Gas Gas 2 Heizöl Heating oil 3 Holz(pellets) Wood (pellets) 4 Biomasse (ohne Holz), Biogas Biomass (no wood), biogas 5 Solar-/Geothermie, Wärmepumpen Solar, geothermal, heat pumps 6 Strom (ohne Wärmepumpen) Electric heating (no heat pumps) 7 Kohle Coal 8 Fernwärme District heating 9 Kein Energieträger No heating
building_ownership_property
-
code german english 1 Gemeinschaft von Wohnungseigentümern/-innen Homeowner association 2 Privatperson/-en Private person(s) 3 Wohnungsgenossenschaft Housing cooperative 4 Kommune oder Kommunales Wohnungsunternehmen Municipality or municipal housing company 5 Privatwirtschaftliches Wohnungsunternehmen Private sector housing company 6 Anderes privatwirtschaftliches Unternehmen Other private sector company 7 Bund oder Land Federal or state government 8 Organisation ohne Erwerbszweck (z.B. Kirche) Non-profit organization (e.g. church)
building_constr_year
-
code german english 1 Vor 1919 Before 1919 2 1919 - 1948 1919 - 1948 3 1949 - 1978 1949 - 1978 4 1979 - 1986 1979 - 1986 5 1987 - 1990 1987 - 1990 6 1991 - 1995 1991 - 1995 7 1996 - 2000 1996 - 2000 8 2001 - 2004 2001 - 2004 9 2005 - 2008 2005 - 2008 10 2009 und später 2009 and later
building_dwellings
-
code german english 1 1 Wohnung 1 Apartment 2 2 Wohnungen 2 Apartments 3 3 - 6 Wohnungen 3 - 6 Apartments 4 7 - 12 Wohnungen 7 - 12 Apartments 5 13 und mehr Wohnungen 13 and more Apartments
building_size
-
code german english 1 Freistehendes Einfamilienhaus Detached single-family house 2 Einfamilienhaus: Doppelhaushälfte Single-family house: semi-detached 3 Einfamilienhaus: Reihenhaus Single-family house: terraced 4 Freistehendes Zweifamilienhaus Detached two-family house 5 Zweifamilienhaus: Doppelhaushälfte Two-family house: semi-detached 6 Zweifamilienhaus: Reihenhaus Two-family house: terraced 7 Mehrfamilienhaus: 3-6 Wohnungen Multi-family house: 3-6 apartments 8 Mehrfamilienhaus: 7-12 Wohnungen Multi-family house: 7-12 apartments 9 Mehrfamilienhaus: 13 und mehr Wohnungen Multi-family house: 13 and more apartments 10 Anderer Gebäudetyp Other building type
building_type
-
code german english 1 Gebäude mit Wohnraum Building with living space 11 Wohngebäude Residential building 111 Wohngebäude (ohne Wohnheime) Residential building (excluding dormitories) 112 Wohnheim Dormitory 12 Sonstiges Gebäude mit Wohnraum Other building with living space
building_design
-
code german english 1 Freistehendes Haus Detached house 2 Doppelhaus Hälfte Semi-detached house 3 Gereihtes Haus Terraced house 4 Anderer Gebäudetyp Other building type
building_heat_type
-
code german english 1 Fernheizung (Fernwärme) District heating (long-distance heating) 2 Etagenheizung Self-contained central heating 3 Blockheizung Block heating 4 Zentralheizung Central heating 5 Einzel-/Mehrraumöfen (auch Nachtspeicherheizung) Individual/multi-room stoves (including night storage heating) 6 Keine Heizung im Gebäude oder in den Wohnungen No heating in the building or in the apartments
building_heat_src
-
code german english 1 Gas Gas 2 Heizöl Heating oil 3 Holz(pellets) Wood (pellets) 4 Biomasse (ohne Holz), Biogas Biomass (no wood), biogas 5 Solar-/Geothermie, Wärmepumpen Solar, geothermal, heat pumps 6 Strom (ohne Wärmepumpen) Electric heating (no heat pumps) 7 Kohle Coal 8 Fernwärme District heating 9 Kein Energieträger No heating
Examples
z22_categories("sex")
# Features without categories are given code 0
z22_categories("families")
Definitions and explanations for common Census terms
Description
First off, this package uses a couple of semi-official terms to make it easier to unequivocally identify certain parts of an aspect. When we are talking about a
-
feature, we talk about an indicator aggregated to grid cells, e.g., age or the number of dwellings.
-
category, we talk about the discrete classifications of features, e.g., ages 10 to 19, 20 to 29, 30 to 39, etc.
Both feature and category have to be provided to uniquely identify a dataset.
This documentation is a collection of definitions as they are provided by the Federal Statistical Office of Germany.
Building year
This characteristic indicates the year of construction of a building with living space in microcensus classes on the respective census reference date. The year of construction refers to the year in which the building was completed. In the case of conversions, extensions and additions to the house, the original year of construction of the building applies. In the case of completely destroyed and rebuilt buildings, the year of reconstruction is taken as the year of construction.
Building classifications
The census distinguishes three types of building classifications. Because they are very close terminologically, they need clarification:
- Building size
Originally called "building type size" (Gebäudetyp-Größe), this classification provides information on the building type in relation to its size. Categories range from detached single-family buildings to multi-story multi-unit buildings.
- Building type
Originally called "building type" (Gebäudeart), this classification provides information about the residential use of residential buildings. It distinguishes buildings based on how much space is used for residential purposes. Categories include:
-
Buildings with living space: Permanent buildings which are either fully or partially reserved for residential use by households. This also includes buildings used for administrative or commercial purposes if they contain at least one dwelling used for residential purposes. Buildings with living space are divided into residential buildings and other buildings with living space.
-
Residential buildings: Buildings in which at least half of the total usable floor space is used for residential purposes. Residential buildings also include dormitories (where residents run their own household).
-
Dormitories: Dormitories are residential buildings that primarily serve the housing needs of certain groups of the population (e.g. student residences, retirement homes). Dormitories have common rooms. Residents of dormitories run their own households.
-
Other buildings with living space: Buildings in which less than half of the total floor space is used for residential purposes, e.g. because the building is predominantly occupied by stores or offices.
-
- Building design
Originally called "building type construction design" (Gebäudetyp-Bauweise), this classification specifies the morphological design of a building, i.e. whether it is detached, semi-detached, terraced or something else.
Citizens / Citizenship
Persons with German citizenship are counted as German citizens. When assigning citizenship, a distinction is made between persons with German and non-German citizenship. Persons with a German citizenship are considered to be German, regardless of the existence of other citizenships.
Members of the German Armed Forces, police authorities and the Foreign Service working abroad and their families residing there are not included in this analysis, as they cannot be assigned regionally at grid cell level in Germany.
Core family
This characteristic indicates the type of core family according to national typification, i.e. according to the reference person principle, taking into account secondary residents. A core family consists of two or more persons belonging to the same private household and is made up of the reference person of the private household - a central person of the private household defined by age, marital status and gender - and at least one other person, e.g. the partner or a child of the reference person. This family concept restricts relationships between ancestors and descendants to direct relationships (first degree), i.e. relationships between parents and children. Only one core family can exist in a household. Other persons living in the household are not assigned to a core family. A household without a core family is possible.
The type of core family depends on the type of couple relationship or the gender of the single parent, and on the presence and age (under or over 18) of children. The term marriage is not differentiated according to the gender of the married persons. Persons in shared accommodation are not included here, only persons who have their own household.
A range of terms relate to core families:
A couple comprises of married couples, couples in a registered civil partnership and couples in a non-marital partnership who live together in a private household.
A married couple is a couple married according to the legal marital status on the reference date and living in a private household.
A registered civil partnership (ELP) is a legally recognized same-sex couple in a private household according to the legal marital status on the reference date.
A non-marital partnership (NELG) is a mixed-sex couple in a private household who were not married to each other according to their legal marital status on the reference date.
A single mother or a single father is a parent without a partner with at least one child within a private household.
A child is a biological son, stepson or adopted son or a biological daughter, stepdaughter or adopted daughter (regardless of age) whose usual place of residence is in the private household of at least one parent and one parent is the caregiver and/or partner of the caregiver.
A senior is defined as a person who has reached the age of 65 on the census date.
Dwelling
A dwelling is defined as rooms that are closed off from the outside, intended for residential purposes, usually located together, which enable the management of a separate household and are not used entirely for commercial purposes.
A dwelling does not necessarily have to contain a kitchen or kitchenette. Apartments have their own entrance directly from the outside, from a stairwell or a vestibule. However, a dwelling may also include basement or floor rooms (e.g. attics) that are developed for residential purposes outside the actual end of the dwelling.
Floor space
To determine the floor space, the following areas are taken into account:
-
full: floor areas of rooms or parts of rooms with a clear height of at least 2 meters.
-
half: floor areas of rooms or parts of rooms with a clear height of at least 1 meter but less than 2 meters; unheatable observatories, swimming pools, and similar rooms closed on all sides.
-
generally a quarter, but no more than half: areas of balconies, loggias, roof gardens, terraces.
Foreigners
Persons with a non-German nationality are counted as foreigners. When assigning nationality, a distinction is made between persons with German and non-German nationality. Persons with German citizenship are considered German, regardless of the existence of other citizenships.
Household
A private household consists of at least one person. This is based on the "concept of communal living": all persons who live together in dwelling, regardless of their residential status (sole residence, main or secondary residence), are considered members of the same private household, meaning that there is one private household per occupied dwelling. There is a maximum of one core family in a household. Other persons living in the household are not assigned to a core family.
Heating type
The characteristic reflects the type of heating in the building. This evaluation is carried out for dwellings. The predominant type of heating in the building is broken down according to which spatial unit (district, building block, building, dwelling, room) is heated by the heating system. In passive houses, systems for heat recovery/controlled ventilation systems are considered "heating" and are assigned accordingly (usually: central heating).
- District heating
Here, entire residential districts are supplied with heat from a central district heating plant (so-called district heating).
- Self-contained central heating
Self-contained central heating refers to a central heating system for all rooms in a self-contained dwelling, whereby the heating source (for example, gas boiler) is usually located within this dwelling.
- Block heating
Block heating is when a block of entire houses is heated by a central heating system and the heating source is located in or on one of the buildings or in its immediate vicinity (so-called local heating).
- Central heating
With central heating, all the residential units in a building are heated from a central heating point located within the building (usually in the basement). This also includes heat pumps.
- Single or multi-room stoves
Individual stoves (such as coal or night storage stoves) only heat the room in which they are located at any one time. They are usually permanently installed. A multi-room stove (e.g. tiled stove) heats several rooms at the same time (also through air ducts). No heating in the building or in the dwellings
Marital status
The marital status indicates a person's marital status under personal law. The marital status under personal law is determined in accordance with the Personenstandsgesetz (PStG) and the Lebenspartnerschaftsgesetz (LPartG).
The introduction of the right to marriage for persons of the same sex (Eheöffnungsgesetz) has allowed same-sex couples to marry since October 1, 2017. The establishment of new registered civil partnerships under the Lebenspartnerschaftsgesetz (LPartG) has no longer been possible since October 1, 2017. Unless existing civil partnerships are converted into a marriage, registered civil partnerships remain in place.
Net rent
The average net rent per square meter is the ratio between the total rent per square meter of the dwellings and the total number of dwellings. The calculation is made for rented dwellings in residential buildings (excluding dormitories). Dwellings not rented out are excluded from the calculation.
Ownership
Ownership is divided into home ownership and property ownership. Home ownership determines who is entitled to ownership of a dwelling in a building divided according to the Wohneigentumsgesetz (WEG) while property ownership determines who is entitled to ownership in a building. Owners can be private individuals or legal entities.
The ownership rate represents the share of owner-occupied dwellings in all occupied dwellings. Not taken into account: Vacant dwellings, vacation and leisure dwellings and commercially used dwellings. The calculation is made for dwellings in residential buildings (excluding halls of residence).
Place of birth
Persons born up to August 2, 1945 in former German eastern territories within the borders of Germany in 1937 are not counted as born abroad, but are assigned the German state code. If the place of birth is not within these borders, the current state code is assigned. Places of birth in countries that have merged into other countries, such as the Soviet Union or Yugoslavia, are assigned to the countries that exist today wherever possible.
- EU27
Comprises the member states of the European Union as of 15 May 2022, previously last amended by the UK's withdrawal in 2020. Persons born in Czechoslovakia are also included in "EU27 country (as of 2020)" with the current country codes. Croatia is also included here following its accession to the EU on July 1, 2013.
- Other Europe
Includes the Russian Federation and Turkey as well as other current country codes of the former Soviet Union and the former Yugoslavia. Great Britain is assigned here following its withdrawal from the EU.
- Other World
Includes all other countries. This category includes other current country codes of the former Soviet Union that were not assigned to "Other Europe".
- Other
Includes "Not specified".
Residents
Each resident is assigned to an address and thus to a grid cell with a side length of 100 m, 1 km or 10 km. Members of the German Armed Forces, police authorities and the Foreign Service working abroad and their families living there are not included in this analysis, as they cannot be assigned regionally at grid cell level in Germany.
Room
A room is either a living room, dining room, bedroom or other separate room (e.g. habitable cellar or floor rooms) of at least 6 square meters in size as well as self-contained kitchens, regardless of their size. Bathrooms, toilets, hallways and utility rooms are generally not counted. A living room with a dining area, sleeping alcove or kitchenette is to be counted as one room. Accordingly, dwellings in which there is no structural separation of the individual living areas (e.g. so-called "loft dwellings") consist of only one room.
Source of heating
The characteristic shows the energy source of the heating in the building. This evaluation is carried out for dwellings. Energy source used to heat the building. If there are several energy sources in the building, it is the one that heats the largest part of the living space. In passive houses, the residual heat requirement is covered by an additional source, which is specified here.
-
Gas
-
Heating oil
-
Wood, wood pellets
-
Biomass (excluding wood), biogas: All organic substances produced by plants or animals from which energy can be obtained by burning. Energy can be obtained through combustion. This includes straw, organic waste or liquid manure (excluding wood). Biogas is produced during the fermentation of biomass and is also classified here.
-
Solar/geothermal energy, environmental heat, exhaust air heat: Solar energy as well as energy from water, air and earth is obtained here with the help of collectors, heat pumps and heat exchangers. This also includes heat obtained from the exhaust air of buildings (so-called exhaust air heat).
-
Electricity (without heat pumps)
-
Coal
-
District heating (various heating sources)
-
No energy source (no heating)
Vacancy
The vacancy rate (dwellings) represents the ratio of vacant dwellings to all occupied and vacant dwellings. The market-active vacancy rate represents the proportion of vacant dwellings that are available again within three months as a percentage of all dwellings in residential buildings. Not taken into account: Vacation and leisure dwellings as well as commercially used dwellings. The calculation is made for dwellings in residential buildings (excluding halls of residence).
Source
Translated and slightly edited version of the dataset descriptions of the Zensus 2022 and Zensus 2011 gridded datasets by the Federal Statistical Office of Germany.
© Statistische Ämter des Bundes und der Länder, 2024
Generate INSPIRE IDs
Description
Given pairs of coordinates, generates their INSPIRE grid representation. Given INSPIRE identifiers, can also extract the X and Y coordinates.
An INSPIRE ID contains information about the CRS, cell size and the
ETRS89-LAEA coordinates of the south-west corner of the grid cell in its
format. Only the relevant first digits are used in place of the full
coordinates. In case of res = "100km"
, these are the first two
digits, for res = "100m"
the first five digits.
CRS3035{cellsize}mN{y}E{x} # new format {cellsize}N{y}E{x} # legacy format
The legacy format always uses meters while the legacy formats aggregates cell sizes greater or equal to 1000m to km.
Usage
z22_inspire_generate(coords, res = NULL, legacy = FALSE)
z22_inspire_extract(inspire, as_sf = FALSE)
Arguments
coords |
A list, matrix, or dataframe where the X and Y coordinates are
either in the columns Can also be a |
res |
Resolution of the grid. Can be |
legacy |
If |
inspire |
A vector of INSPIRE IDs. Can be either legacy or non-legacy. |
as_sf |
Whether to return an object of class |
Details
To remain fast even for huge grid datasets, the function is just a very
simple sprintf
wrapper that performs no input checks. To
produce valid INSPIRE identifiers, make sure to transform your data to
ETRS89-LAEA (e.g. using
st_transform(..., 3035)
). You should also
make sure that the coordinates are the south-west corner of existing
INSPIRE grid cells.
Value
z22_inspire_generate
returns a character vector containing
the INSPIRE identifiers. z22_inspire_extract
returns a dataframe
or sfc
object containing the points extracted from
the INSPIRE identifiers. Note that the returned coordinates are always
the centers of the grid cells as opposed to the south-west corners.
Examples
library(dplyr, warn.conflicts = FALSE)
# Generate IDs from a dataframe
coords <- tibble(x = c(4334150, 4334250), y = c(2684050, 2684050))
identical(z22_inspire_extract(z22_inspire_generate(coords)), coords)
# Extract coordinates from legacy ID strings
z22_inspire_extract("100mN34000E44000")
# Generate IDs from an sf dataframe
if (requireNamespace("sf", quietly = TRUE)) {
coords <- sf::st_as_sf(coords, coords = c("x", "y"))
z22_inspire_generate(coords)
}
Get Census 2022 grid dataset
Description
Retrieve the values and coordinates of gridded features from the censuses 2011 and 2022.
When we are talking about a
feature, we talk about an indicator aggregated to grid cells, e.g., age or the number of dwellings.
category, we talk about the discrete classifications of features, e.g., ages 10 to 19, 20 to 20, 30 to 39, etc.
Both feature and category have to be provided to uniquely identify a dataset.
Usage
z22_data(
feature,
categories = NULL,
year = 2022,
res = "1km",
all_cells = FALSE,
normalize = FALSE,
rasterize = FALSE,
as_sf = FALSE,
update_cache = FALSE
)
Arguments
feature |
A grid feature. See |
categories |
One or multiple feature categories. See
|
year |
Census year. Currently, only 2011 and 2022 are available. Defaults to 2022. |
res |
Resolution of the grid dataset. Can be |
all_cells |
If |
normalize |
If |
rasterize |
If |
as_sf |
If |
update_cache |
By default, both functions cache attribute files for
the remainder of the R session. They are downloaded to a temporary directory
and - if the file to download already exists - are recovered from the cache.
In other words, when rerunning the same request multiple times, the
subsequent calls should be much faster. If |
Details
Half of the grids cell width is added to each coordinate in the dataset internally. According to the INSPIRE guidelines, coordinates always represent the South-west of the grid cells. Centroids represent the geographic location of grid cells better which is why they are used.
By default, data are downloaded from the
z22data data repository which
stores all pre-processed data. You can download this repository and use
it offline or use an entirely different repository by setting
options(z22.data_repo = "path/to/z22data")
.
Value
A tibble, SpatRasterDataset
or
sf
tibble depending on the rasterize
and as_sf
arguments.
If a tibble is returned each category in categories
is stored in
a column. If a SpatRasterDataset
is returned, each category is a
named layer.
Examples
# Get gridded population
pop <- z22_data("population", res = "10km", rasterize = TRUE)
terra::plot(pop$cat_0)
# Get data about the number of people born in a EU27 country
z22_data("birth_country", categories = 21, res = "1km")
Decode and translate features and categories
Description
Replace category codes with their labels.
Usage
z22_decode(codes, feature, lang = c("english", "german"))
Arguments
codes |
A vector of character codes, possibly prefixed with
|
feature |
A grid feature that the category |
lang |
Specifies the language of the output description. Can be
either |
Value
.data
with category codes decoded to labels.
Examples
# retrieves a the translation of cat codes directly
z22_decode(1, "marital_status")
# recycles codes
z22_decode(c(1, 1, 1), "marital_status")
# undefined codes are returned as NA
z22_decode(c(1, 2, 3), feature = "sex")
# special case: cat_* strings
z22_decode("cat_2", feature = "sex")
Features
Description
Get a list of available features. To get a list of all categories, see
z22_categories
.
For further clarification of terms used in the feature labels, see the glossary.
Usage
z22_features(theme = NULL, year = NULL, res = NULL, legacy_names = FALSE)
Arguments
theme |
Theme of the feature. Available themes are |
year |
Census year. Can be 2011 or 2022. If |
res |
Resolution of the feature grid. Can be |
legacy_names |
If |
Value
A tibble containing the following columns:
theme
: Theme of the featurefeature
: Feature namedesc
: Human-readable english descriptionz22
: Whether the feature is available in the Census 2022z11_100m
: Whether the feature is available in the Census 2011 at a 100m resolutionz11_1km
: Whether the feature is available in the Census 2011 at a 1km resolutionhas_cat
: Whether the feature is is further divided into categories.
Examples
# return all features related to dwellings
z22_features("dwellings")
# return all features available in the Census 2011
z22_features(year = 2011)
# return all features available in 2011 at a 1km resolution
z22_features(year = 2011, res = "1km")
Get INSPIRE grid
Description
Retrieve the entire INSPIRE grid.
Unlike the feature grids retrieved from z22_data
,
the INSPIRE grid encompasses the entire area of Germany. You can thus use
it to join with the incomplete feature grids from z22_data
to create a complete dataset.
Usage
z22_grid(
res,
year = 2019,
rasterize = FALSE,
as_sf = FALSE,
update_cache = FALSE
)
Arguments
res |
Resolution of the grid. Can be |
year |
Version of the grid. Can be 2015, 2017, 2018 and 2019. Defaults to the latest version. |
rasterize |
If |
as_sf |
If |
update_cache |
By default, both functions cache attribute files for
the remainder of the R session. They are downloaded to a temporary directory
and - if the file to download already exists - are recovered from the cache.
In other words, when rerunning the same request multiple times, the
subsequent calls should be much faster. If |
Details
Note the uncompressed object sizes of the output (2019 version):
100 m: 38 million cells, 291 MB
250 m: 6 million cells, 47 MB
1 km: 384 thousand cells, 3 MB
5 km: 16 thousand cells, 0.12 MB
10 km: 4 thousand cells, 0.03 MB
Value
A tibble, SpatRasterDataset
or
sf
tibble depending on the rasterize
and as_sf
arguments.
If a tibble is returned each category in categories
is stored in
a column. If a SpatRasterDataset
is returned, each category is a
named layer.
Examples
# Get high-res grid as tibble
z22_grid("100m")
# Get low-res grid as raster
z22_grid("1km", rasterize = TRUE)
Cast feature grid to a long table
Description
Helper function to convert the output of z22_data
to a
long table. This can be useful for plotting or other data wrangling tasks.
Note that pivoting can quickly become expensive for larger 100m grids.
Usage
z22_pivot_longer(.data, feature, lang = c("english", "german"))
Arguments
.data |
Output of |
feature |
A grid feature that is represented by |
lang |
Specifies the language of the output description. Can be
either |
Details
Note that all columns starting with "cat_*"
are automatically used
for pivoting.
Value
A dataframe containing the columns category
, value
,
x
and y
. All non-category columns are preserved.
Examples
# get feature grid
age <- z22_data("age_short", res = "10km")
# pivot to a long table
z22_pivot_longer(age, feature = "age_short")