Spanish Cadastre/Buildings Import/Data Conversion

From OpenStreetMap Wiki
Jump to navigation Jump to search
Import guide Projects management Results Documentation
Spanish Cadastre Buildings Import.svg

Data Conversion describes the conversion procedure of the datasets for this Spanish Cadastre/Buildings Import.

How to download

The data is available for download through these ATOM services:

You can also use the conversion tool to download the data.

Content of the Datasets

A full description of the download service is available here.

The downloads are files in ZIP format that contain the data for each object in GML files, according to the specifications defined for the DGC INSPIRE data sets, plus an XML file with the metadata of the data downloaded.

The ZIP filenames follows this pattern:

A.ES.SDGC.XX.PPMMM.zip

with:

  • A: current cartography
  • ES: Spain
  • SDGC: Spanish Directorate General for Cadastre
  • XX: (CP: Cadastral Parcel, AD: Addresses, BU: Buildings).
  • PPMMM: Cadastral Provincial office and Municipality

Contents of the ZIP file of cadastral parcel

  • A.ES.SDGC.CP.MD.PPMMM.XML: metadata file.
  • A.ES.SDGC.CP.PPMMM.cadastralparcel.GML: GML file for Cadastral Parcel.
  • A.ES.SDGC.CP.PPMMM.cadastralzoning.GML: GML file for Cadastral zone.

Contents of the ZIP file of addresses

  • A.ES.SDGC.AD.MD..PPMMM.XML: metadata file
  • A.ES.SDGC.AD.PPMMM.cadastralparcel.GML: GML file for addresses.

Contents of the ZIP file of Buildings

  • A.ES. SDGC.BU. MD..PPMMM.XML: metadata file
  • A.ES.SDGC.BU.PPMMM.building.GML: GML file of Buildings.
  • A.ES.SDGC.BU.PPMMM.buildingpart.GML: GML file of Building Parts.
  • A.ES.SDGC.BU.PPMMM.otherconstruction.GML: GML file of other constructions (swimming pools).

Description of the data

The detailed description of the data set and its structure can be found here.

Cadastral Parcels (CP) dataset elements

  • CadastralParcel: Contains the geometry, with topology of enclosure, which delimits a cadastral parcel.
  • CadastralZoning: Contains the geometry of urban blocks and rural polygons.

Addresses (AD) dataset elements

  • AD:Address: Is the main object and there is one for each physical address. Contains the geometry of the point where the address is georeferenced, corresponding in some cases to the centroid of the cadastral parcel and others to the entrance.

The object Address, in order to complete a structured address, is associated with other objects that do not have a defined geometry, and they are:

  • AD:ThoroughfareName: Street name. In each dataset there will be one for each distinct street name.
  • AD:PostalDescriptor: Postcode. In each dataset there will one for each distinct postcode.
  • AD:AdminUnitName: Administrative unit.

Buildings (BU) dataset elements

  • Building: This is the main object that defines the building and represents the geometry building footprint with a number of attributes defined in an extended 2D scheme.
  • BuildingPart: This is for each of constructed area in a Cadastral Parcel having homogeneous volume, and it can be above and below ground. It has the attributes related to height.
  • OtherConstructions: In the dataset only swimming pools are considered, containing the attribute OtherConstructionNatureValue with the value openAirPool.

Generation of tags from the dataset

Conversion of the Addresses (AD) dataset

This chapter describes the conversion criteria of the elements contained in the GML file of Addresses (A.ES.SDGC.AD.GGMMM.gml).

<AdminUnitName> elements (Municipalities)

Conversion of <AdminUnitName> elements
Source tag Description OSM tag Comment
<AD:inspireId> +
<base:localId>
Municipality code with the pattern PP.MMM (PP=code of province, MM=code of municipality) N/A This identification value will be used to trace the municipality name in the Address
<AD:name> Name of the municipality in the field <GN:text> N/A This value of the name will be used in the addresses that refer to the identifier

<PostalDescriptor> elements (Postcodes)

Conversion of <PostalDescriptor> elements
Source tag Description OSM tag Comment
<AD:PostalDescriptor> Postcode identifier N/A This identification value will be used to trace the postcode in the Address
<AD:PostCode> It is the value of the postcode N/A This value of the postcode will be used in the addresses that refer to the identifier

<ThoroughfareName> elements (Streets)

Conversion of <ThoroughfareName> elements
Source tag Description OSM tag Comment
<AD:AlternativeIdentifier> It is the value of the via code N/A This identification value will be used to trace the name of the street in the Address
<AD:ThoroughfareNameValue> Value of the name of the street in the field GN:text N/A This value of the street name will be used in the addresses that refer to the identifier

<Address> elements

Each element <Address> included in the data set will be assigned to an OSM element as described here. The labels will be generated according to the following table:

Conversion of <Address> elements
Source tag Description OSM tag Comment
<AD:Position> +
<gml:Point>
Geographic coordinates <node lat=* lon=*>

The origin coordinate system is specified in the label srsName of the element gml:Point and must be taken into account for the conversion of the coordinates to EPSG:4326 (WGS84)

<AD:Position> +
<AD:specification>
It may have the value of "Parcel" or "Entrance" entrance=yes The tag will be added if the source value is "Entrance"
<AD:locator> +
<AD:designator>
Its value is the number of the portal plus duplicate if any addr:housenumber=* It will not be imported when the value is S-N (without number)
<AD:component
xlink:href="#ES.SDGC.TN.*">
Link to the corresponding ThoroughfareName (street) addr:street=*

/ addr:place=*

Name of the street or place referenced. See correction of the thoroughfare names
<AD:component
xlink:href="#ES.SDGC.PD.*">
Link to the corresponding PostalDescriptor (Postcode) addr:postcode=* Value of the referenced postcode
<AD:component
xlink:href="#ES.SDGC.AU.*">
Link to the corresponding AdminUnit (Municipality) N/A This data will not be included

Conversion of the Building (BU) dataset

This chapter describes the conversion criteria of the elements contained in the GML file of Buildings (A.ES.SDGC.BU.GGMMM.gml).

<Building> elements

For each <Building> element included in the dataset a closed way will be created with nodes according to the geographic coordinates specified in the outer linear ring.

If the <Building> element includes one or more inner linear rings, a multipolygon type relation will be created with the outer closed way having the role outer and the inner closed having the role inner.

Some <Building> elements could contain many outer rings. This happens when different buildings have the same cadastral reference (<base:localId> field).

The tags of the way (or multipolygon relation in case of inner rings) will be generated according to this table:

Conversion of <Building> elements
Source tag Description OSM tag Comment
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:exterior>
List of geographical coordinates that make up the outer ring of the building <node lat=* lon=*>
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:interior>
List of geographical coordinates that make up the inner rings (if any) of the building <node lat=* lon=*> If the building has inner rings, an OSM multipolygon relation will be created for this building
<bu-core2d:inspireId> +
<base:localId>
The first 14 characters of the cadastral reference N/A The cadastral reference is used to trace the building with the corresponding address. If an address with the same cadastral reference is found, the labels of that address can be incorporated into the building or to an entrance node according to the value of the '<AD: specification>' field of the address.
<bu-core2d:conditionOfConstruction> This may have the values:
  • ruin
  • declined
  • functional
  • If bu-core2d:conditionOfConstruction is functional, the value of bu-ext2d:currentUse will be used with the building key.
  • If bu-core2d:conditionOfConstruction is ruin, the value of bu-ext2d:currentUse will be used with the abandoned:building key.
  • If bu-core2d:conditionOfConstruction is declined, the value of bu-ext2d:currentUse will be used with the disused:building key.

See Estado de la construcción (in Spanish)

bu-ext2d:currentUse This may have the values:
  • 1_residential
  • 2_agriculture
  • 3_industrial
  • 4_1_office
  • 4_2_ret
  • 4_3_publicServices
<bu-ext2d:document> URL to access a photograph of the building's facade N/A Not imported, it will be available to check the number of the portal. See File:Autorizacion_fotos_fachadas_catastro.pdf.
Number of levels above ground building:levels=* Take the maximum value of the <bu-ext2d:numberOfFloorsAboveGround> field from this building parts.
Number of levels below ground building:levels:underground=* Take the minimum value of the <bu-ext2d:numberOfFloorsBelowGround> field from this building parts.

<BuildingPart> elements

For each <BuildingPart> element included in the dataset a closed way will be created with nodes according to the geographic coordinates specified in the outer linear ring.

If the <BuildingPart> element includes one or more inner linear rings, a multipolygon type relation will be created with the outer closed way with the role outer and the inner closed ways with the role inner.

The tags of the way (or multipolygon relation in case of inner rings) will be generated according to this table:

Conversion of <BuildingPart> elements
Source tag Description OSM tag Comment
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:exterior>
List of geographical coordinates that make up the outer ring of the building part <node lat=* lon=*>
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:interior>
List of geographical coordinates that make up the inner rings (if any) of the building part <node lat=* lon=*> If the building part has inner rings, an OSM multipolygon relation will be created for this building part
<bu-core2d:inspireId> +
<base:localId>
The first 14 characters of the cadastral reference, plus a sequential suffix for each part "_partX" N/A The cadastral reference value will be used to trace this building part with the corresponding building
N/A N/A The 'roof' value applies when the number of levels above and below ground is 0.
<bu-ext2d:numberOfFloorsAboveGround> Number of levels above ground building:levels=*
<bu-ext2d:numberOfFloorsBelowGround> Number of levels below ground building:levels:underground=*

<OtherConstructions> elements (Swimming Pools)

In the Cadastre dataset, the <OtherConstructions> elements refers only to swimming pools.

For each <OtherConstructions> element included in the dataset a closed way will be created with nodes according to the geographic coordinates specified in the outer linear ring.

If the <OtherConstructions> element includes one or more inner linear rings, a multipolygon type relation will be created with the outer closed way having the role outer and the inner closed ways having the role inner.

The tags of the way (or multipolygon relation in case of inner rings) will be generated according to this table:

Conversion of <OtherConstructions> elements (Swimming Pools)
Source tag Description OSM tag Comment
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:exterior>
List of geographical coordinates that make up the outer ring of the swimming pool <node lat=* lon=*>
<bu-ext2d:geometry> +
<gml:Surface> +
<gml:interior>
List of geographical coordinates that make up the inner rings (if any) of the swimming pool <node lat=* lon=*> If the swimming pool has inner rings, it will be created a OSM multipolygon relation
<bu-core2d:inspireId> +
<base:localId>
The first 14 characters of the cadastral reference, plus a sequential suffix for each swimming pool "_PI.X" N/A N/A
N/A N/A leisure=swimming_pool
N/A N/A layer=1
location=roof
When the swimming pool is on a building

Conversion of the Cadastral Parcel (CP) dataset

This chapter describes the conversion criteria of the elements contained in the GML file of Cadastral Parcels (A.ES.SDGC.CP.GGMMM.gml).

<CadastralParcel> elements

It was decided (in spanish) not to import the cadastral parcels.

<CadastralZoning> elements

With the <CadastralZoning> elements two files in GeoJSON format are generated to create projects in the task manager and to split the data in tasks.

No tag or property is generated from the data, but these are the fields to considered:

Conversion of <CadastralZoning> elements
Source tag Description OSM tag Comment
<cp:geometry> +
<gml:Surface> +
<gml:exterior>
List of geographical coordinates that make up the outer ring of the cadastral zone <node lat=* lon=*>
<cp:geometry> +
<gml:Surface> +
<gml:interior>
List of geographical coordinates that make up the inner rings (if any) of the cadastral zone <node lat=* lon=*> If the cadastral zone has inner rings, an OSM multipolygon relation will be created
<cp:inspireId> +
<base:localId>
Identifier of 9 characters length for polygons and of 11 characters for blocks. N/A
<cp:level> +
<cp:levelName>
Two possible values 'POLIGONO ' or 'MANZANA ', which serve to divide the elements into two types: Rustic and Urban. N/A

Changeset tags

The following tags will be used for the import changesets:

Changesets tags
Key Value Source of the value
comment "#Spanish_Cadastre_Buildings_Import"
source "Dirección General del Catastro"
source:date Date in format "YYYY-MM-DD" (Year-Month-Day) Date stated in the <gmd:dateStamp>+<gco:Date> tags of the Building (BU) metadata file A.ES.SDGC.BU.MD.GGMMM.xml
source:date:addr Date in format "YYYY-MM-DD" (Year-Month-Day) Date stated in the <gmd:dateStamp>+<gco:Date> tags of the Addresses (AD) metadata file A.ES.SDGC.AD.MD.GGMMM.xml
type "import"
url "https://wiki.openstreetmap.org/wiki/Spanish_Cadastre/Buildings_Import"

Data conversion problems

Problems found in the dataset that must be corrected before converting to OSM format are listed on this page: Problems.

Data conversion process

Taking into account the propossal for tags translation and conversion of the different elements of the data sets explained in the previous sections, the complete process of data conversion is summarized in the following steps:

Process of data conversion
Step Description Comment
1 Extraction of all CadrastalZoning from the Cadastral Parcel (CP) dataset. The zones will be used to divide the tasks in the manager.
2.1 Extraction of all Address from the Address (AD) dataset.
2.2 Extraction of all PostalDescriptor from the Address (AD) dataset. Postcodes are combined with addresses according to their references.
2.3 Extraction of all ThoroughfareName from the Address (AD) dataset. Thoroughfare names are combined with addresses according to their references.
3 Download of named highways in OSM. Necessary for the next step.
4 correction of the thoroughfare names If the conversion file does not exist, one is generated and the process is stopped for manual review.
5 Delete addresses without a portal number. 'S-N'.
6 Download of addresses in OSM They are combined excluding those Cadastral addresses that are already in OSM.
7.1 Extraction of all Building from the Building (BU) dataset.
7.2 Extraction of all BuildingPart from the Building (BU) dataset. The elements are moved to Building
7.3 Extraction of all OtherConstructions from the Building (BU) dataset. The elements are moved to Building
8 Processing of Building. All corrections referring to buildings, parts and pools mentioned in problems are applied.
9 Move the 'entrance' type addresses to the contour of the associated building. It don't move them if the distance is too large or the address ends in a corner of the building.
10 Assignment of task to which each Building element belongs. See division of data into tasks.
11 Download of existing buildings and pools in OSM. Those that conflict with Cadastre are filtered for manual review.
12 Processing of tasks. The elements of Building contained in each urban block are selected, then the contents in each rustic polygon not processed. The following steps are applied to each set.
12.1 Transformation to the OSM data model. Polygons become ways and multipolygon relations if they have holes.
12.2 Fusion of the addresses to the buildings with the same cadastral reference. All the tags of the address will become part of the way/relation of the building or entrance node in the footprint. See problems related to the addresses here.
12.3 Generation of XML OSM files for each task A single instance of the nodes or ways having identical coordinates and tag is created.

The data conflation is carried out in steps 3, 6 and 11.

Data conversion tool

To carry out the data conversion process, a software tool has been developed with Python that takes the ZIP files from the data sets of each municipality and generates the OSM files, either of the entire municipality or splitted into blocs for the Task Manager. The program is described on this page: CatAtom2Osm.

Validation of the data conversion process

For the validation of the data conversion process, it is proposed to download the datasets of several Municipalities, perform the conversion of the data and then perform an analysis of the data obtained.

The following statistics must be obtained from each municipality:

  • Data of surface and population of the Municipality (obtained from Wikipedia)
  • Number of Addresses, Buildings and Parts of Buildings obtained.
  • Number of Addresses not assigned to buildings.
  • Number of OSM Nodes, Ways and Relations created.
  • List of errors detected in the conversion.

This data and others are provided by the conversion tool in the file 'report.txt'.

A qualitative analysis will also be carried out:

  • Quality of the geometries (accuracy with respect to aerial images).
  • Detection of duplicate nodes or overlapping buildings or parts.

The criteria to take into account to select the Municipalities are:

  • Must be municipalities of different sizes (from the largest to the smallest). The larger ones will have more numerous and complex buildings, while the smaller ones will have fewer and simpler ones. This will help estimate the volume of data that will be included in OSM.
  • Must be municipalities of different geographical areas of Spain (North, South, East, West, Center, Canary Islands and Balearic Islands), to verify the correct conversion of geographic coordinates.
  • They must be from different Autonomous Communities, where different qualities or criteria for generating the data sets may exist.
  • As far as possible, they should be Municipalities whose converted data can be validated on the ground by OSM-es contributors, or else Municipalities with existing data of buildings and addresses that can be compared without a local verification.

Validation results

The validation process generates the following data.