Skip to content

Edge case when the number of parcels in voronoi exceeds number of buildings in block #122

Description

@nmarchio

Sometimes the number of parcel geometries in voronoi exceeds number of building geometries in block. This is fairly rare (under 5% of blocks and usually only a difference of 1).

Cause of unexpected behavior is here: https://github.com/mansueto-institute/kblock/blob/main/kblock/batch_4_compute_k.py#L134

Because very rarely:
np.sum(pygeos.get_num_geometries(block_parcels)) > len(pygeos.get_num_geometries(block_parcels))

To rectify this issue, just change line 134 and other spots to len(pygeos.get_num_geometries(block_parcels)) for it to equal building geometry count.

Mechanically, what is likely happening is that there are occasionally multi-polygon geometries created in the tessellation process, so a single building can be in a multipart parcel geometry. The way its set up now should not affect K (since multipart parcel geometries are treated together as a group), however it does change the interpretation of the building_layers column to mean "number of parcel geometries in each layer" (instead of number of building geometries in each layer) and the building_count column reflect total number of parcel geometries in block.

At a minimum these columns should be renamed or use length if the conceptual definition should be building based.

See attached CSV for edge case blocks.
check.csv

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions