-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
momepy.CellAlignment expects the left and right GeoDataFrames (containing buildings and tessellation cells) to have the same number of elements, ie each building corresponds to one cell (which is the case in morphological tessellation). This means that it sometimes doesn't work when using enclosed tessellation, when there are some tessellation cells with no corresponding buildings (ie areas enclosed by roads with no buildings on them).
Code example:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-78-f527b308bee5> in <module>
----> 1 blg['blg_CellAlignment'] = mm.CellAlignment(blg, tess, 'blg_Orientation', 'tess_Orientation', 'uID', 'uID').series
/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/momepy/distribution.py in __init__(self, left, right, left_orientations, right_orientations, left_unique_id, right_unique_id)
419 right_orientations = right_orientations + "_y"
420 self.series = np.absolute(comp[left_orientations] - comp[right_orientations])
--> 421 self.series.index = left.index
422
423
/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/pandas/core/generic.py in __setattr__(self, name, value)
5476 try:
5477 object.__getattribute__(self, name)
-> 5478 return object.__setattr__(self, name, value)
5479 except AttributeError:
5480 pass
pandas/_libs/properties.pyx in pandas._libs.properties.AxisProperty.__set__()
/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/pandas/core/series.py in _set_axis(self, axis, labels, fastpath)
468 if not fastpath:
469 # The ensure_index call above ensures we have an Index object
--> 470 self._mgr.set_axis(axis, labels)
471
472 # ndarray compatibility
/usr/local/Cellar/jupyterlab/3.0.1/libexec/lib/python3.9/site-packages/pandas/core/internals/managers.py in set_axis(self, axis, new_labels)
218
219 if new_len != old_len:
--> 220 raise ValueError(
221 f"Length mismatch: Expected axis has {old_len} elements, new "
222 f"values have {new_len} elements"
ValueError: Length mismatch: Expected axis has 81708 elements, new values have 81479 elementsWhere tess is an enclosed tessellation generated from the buildings blg.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels