catatom2osm.app module

Main application processes.

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

Bases: object

Main application class.

add_comments()[source]

Recover missing task files metadata after JOSM editing.

static create_and_run(a_path, options)[source]
exit()[source]

Exit properly.

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

Export a vector layer.

Parameters
  • layer (QgsVectorLayer) – Source layer.

  • filename (str) – Output filename.

  • driver_name (str) – name of OGR driver (or get it from filename).

  • target_crs_id (int) – Defaults to source CRS.

export_poly()[source]
finish()[source]

Generate final report.

get_address()[source]

Read Address GML dataset.

get_auxiliary_addresses()[source]

Read and conflate auxiliary sources of addresses data.

get_boundary()[source]

Get best boundary search area for overpass queries.

get_building()[source]

Merge building, parts and pools.

get_cbcn()[source]

Read CartoBCN addresses.

get_current_ad_osm()[source]

Get OSM address for conflation.

get_highway()[source]

Get OSM highways for street names conflation.

get_parcel()[source]

Get parcels dataset.

get_place()[source]

Get OSM places for street names conflation.

get_split()[source]

Get boundary file for splitting.

static get_task_comment(label)[source]

Return comment for task with this label.

get_tasks(source)[source]

Put each source feature into a task layer.

get_translations(address)[source]

Get the translate file.

If there exists the translation file ‘highway_types.csv’, read it, else write one with default values. If the translations file ‘highway_names.csv’ don’t exist, 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]

Get zoning data.

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

move_project()[source]

Move to tasks all files needed for the backup the in the repository.

Use a subdirectory if it’s a split municipality.

output_zoning()[source]

Generate project zoning file.

process_address()[source]

Fix street names, conflate and move addresses.

process_building()[source]

Process all buildings dataset.

process_parcel()[source]

Process parcels dataset.

process_tasks(source)[source]

Convert to osm for each task.

read_osm(*paths, **kwargs)[source]

Read an OSM data set from an OSM XML file.

If the file not exists, downloads data from overpass using ql query.

Parameters
  • paths (str) – input filename components relative to self.path

  • ql (str) – Query to put in the url for overpass

Returns

Osm: OSM data set

resume_address()[source]

Resume processing for second run of addresses dataset.

run()[source]

Launch the app processing.

stop_address()[source]

Save current processing status and exits.

write_osm(data, *paths)[source]

Generate an OSM XML file for an OSM data set.

Parameters
  • data (Osm) – OSM data set

  • paths (str) – output filename components relative to self.path (compress if ends with .gz)

class catatom2osm.app.QgsSingleton[source]

Bases: qgis._core.QgsApplication

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