catatom2osm module

Tool to convert INSPIRE data sets from the Spanish Cadastre ATOM Services to OSM files

class catatom2osm.CatAtom2Osm(a_path, options)[source]

Main application class for a tool to convert the data sets from the Spanish Cadastre ATOM Services to OSM files.

delete_shp(name, relative=True)[source]
end_messages()[source]
exit()[source]

Ends properly

export_layer(layer, filename, driver_name='ESRI Shapefile', target_crs_id=None)[source]

Export a vector layer.

Parameters:
  • layer (QgsVectorLayer) – Source layer.
  • filename (str) – Output filename.
  • driver_name (str) – Defaults to ESRI Shapefile.
  • target_crs_id (int) – Defaults to source CRS.
get_auxiliary_addresses()[source]

If exists, reads and conflate an auxiliary addresses data source

get_building()[source]

Merge building, parts and pools

get_current_ad_osm()[source]

Gets OSM address for address conflation

get_current_bu_osm()[source]

Gets OSM buildings for building conflation

get_highway()[source]

Gets OSM highways needed for street names conflation

get_tasks(source)[source]
get_translations(address)[source]

If there exists the configuration file ‘highway_types.csv’, read it, else write one with default values. If don’t exists the translations file ‘highway_names.csv’, creates one parsing current OSM highways data, else reads and returns it as a dictionary.

  • ‘highway_types.csv’ List of osm elements in json format located in the application path that contains translations from abbreviations to full types of highways.
  • ‘highway_names.csv’ is located in the outputh folder and contains corrections for original highway names.
get_zoning()[source]

Reads cadastralzoning and splits in ‘MANZANA’ (urban) and ‘POLIGONO’ (rustic)

merge_address(building_osm, address_osm)[source]

Copy address from address_osm to building_osm using ‘ref’ tag.

If there exists one building with the same ‘ref’ that an address, copy the address tags to the building if it isn’t a ‘entrace’ type address or else to the entrance if there exist a node with the address coordinates in the building.

Precondition: building.move_address deleted addresses belonging to multiple buildings

Parameters:
  • building_osm (Osm) – OSM data set with buildings
  • address_osm (Osm) – OSM data set with addresses
process_building()[source]

Process all buildings dataset

process_parcel()[source]
process_tasks(source)[source]
process_zoning()[source]
read_address()[source]

Reads Address GML dataset

read_osm(ql, filename)[source]

Reads a OSM data set from a OSM XML file. If the file not exists, downloads data from overpass using ql query

Parameters:
  • ql (str) – Query to put in the url
  • filename (str) – File to read/write
Returns
Osm: OSM data set
run()[source]

Launches the app

write_osm(data, filename, **kwargs)[source]

Generates a OSM XML file for a OSM data set.

Parameters:
  • data (Osm) – OSM data set
  • filename (str) – output filename
  • compress (bool) – whether the file is to be compressed Defaults to not compressing the file
class catatom2osm.QgsSingleton[source]

Bases: qgis._core.QgsApplication

Keeps a unique instance of QGIS for the application (and tests)