catatom2osm.geo.layer.cons module

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

Bases: catatom2osm.geo.layer.polygon.PolygonLayer

Class for constructions.

clean()[fuente]

Clean geometries.

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

conflate(current_bu_osm, delete=True)[fuente]

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)[fuente]

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)[fuente]

Trim to parcel id.

get_parts(outline, parts)[fuente]

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()[fuente]

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()[fuente]

Index parts of building by building localid.

index_of_pools()[fuente]

Index pools in building parcel by building localid.

static is_building(feature)[fuente]

Return True for building features.

static is_part(feature)[fuente]

Return True for Part features.

static is_pool(feature)[fuente]

Return True for Pool features.

merge_adjacent_parts(outline, parts)[fuente]

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()[fuente]

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)[fuente]

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)[fuente]

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)[fuente]

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()[fuente]

Remove parts outside the outline of it building.

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

remove_parts_wo_building()[fuente]

Remove building parts without building.

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

Export to OSM.

validate(max_level, min_level)[fuente]

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

Returns distribution of floors.