catatom2osm.geo.layer.cons module

class catatom2osm.geo.layer.cons.ConsLayer(path='MultiPolygon', baseName='building', providerLib='memory', source_date=None)[source]

Bases: catatom2osm.geo.layer.polygon.PolygonLayer

Class for constructions.

clean()[source]

Clean geometries.

Delete invalid geometries and close vertices, add topological points, merge building parts and simplify vertices.

conflate(current_bu_osm, delete=True)[source]

Remove from current_bu_osm the buildings that don’t have conflicts.

If delete=False, only mark buildings with conflicts.

explode_multi_parts(address=False)[source]

Split multipolygons.

Creates a new WKBPolygon feature for each part of any WKBMultiPolygon feature in request. This avoid relations with many ‘outer’ members in OSM data set. From this moment, localId will not be a unique identifier for buildings.

static get_id(feat)[source]

Trim to parcel id.

get_parts(outline, parts)[source]

Return a dictionary of parts for levels, the maximum and minimum levels.

Given the building outline and its parts, for the parts inside the outline.

index_of_building_and_parts()[source]

Construct some utility dicts.

buildings index building by localid (call before explode_multi_parts). parts index parts of building by building localid.

index_of_parts()[source]

Index parts of building by building localid.

index_of_pools()[source]

Index pools in building parcel by building localid.

static is_building(feature)[source]

Return True for building features.

static is_part(feature)[source]

Return True for Part features.

static is_pool(feature)[source]

Return True for Pool features.

merge_adjacent_parts(outline, parts)[source]

Merge the adjacent parts in each level given a building outline and its parts.

Translates the maximum values of number of levels above and below ground to the outline and optionally deletes all the parts in that level.

merge_building_parts()[source]

Apply merge_adjacent_parts to each set of building and its parts.

Detect pools contained in a building and assign layer=1. Detect buildings/parts with geometry equals to a pool geometry and delete them. Detect inner rings of buildings/parts with geometry equals to a pool geometry and remove them.

move_address(address)[source]

Try to move each entrance address to the nearest point in the building outline.

Building and addresses are associated using the cadastral reference. Non entrance addresses ends in the building outline when CatAtom2Osm.merge_address is called. Delete the address if the number of associated buildings is 0 or greater than 1 for non entrance addresses.

move_entrance(ad, ad_buildings, ad_parts, to_move, to_insert, parents_per_vx)[source]

Auxiliary method to move entrance to the nearest building and part.

Don’t move and the entrance specification is changed if the new position is not enough close (‘remote’), is a corner (‘corner’), is in an inner ring (‘inner’) or is in a wall shared with another building (‘shared’).

remove_inner_rings(feat1, feat2)[source]

Auxiliary method to remove feat1 of its inner rings if equals to feat2.

Returns True if feat1 must be deleted and new geometry if any ring is removed.

remove_outside_parts()[source]

Remove parts outside the outline of it building.

Remove parts without levels above ground. Precondition: Called before merge_greatest_part.

remove_parts_wo_building()[source]

Remove building parts without building.

to_osm(data=None, tags={}, upload='never')[source]

Export to OSM.

validate(max_level, min_level)[source]

Put fixmes to buildings with not valid geometry, too small or big.

Returns distribution of floors.