Open cdkang opened 2 years ago
I think the error "ValueError: Length mismatch: Expected axis has 6405 elements, new values have 5181 elements" came from the mismatch between building shape file and its tessellation due to some overlapped elements.
Is it possible to make tessellation of building shape files in ArcGIS or ArcGIS pro? And, does it work in momepy?
We need the way to check the accuracy of tessellation file matched to building shape files.
Hi, yes, you are probably right. When creating a tessellation, there are steps that may cause this mismatch. It happens mostly when you have polygons that are tiny and the negative buffer, used to ensure there's a proper boundary between adjacent elements, turns them into empty geometries. In reality, these polygons are never real buildings though, so it is assumed that they are cleaned beforehand.
Tessellation does complain about them and lists affected elements during the creation as documented here: http://docs.momepy.org/en/stable/user_guide/elements/tessellation.html#Troubleshooting. Alternatively, you can try to catch them before doing Tessellation using momepy.CheckTessellationInput
- http://docs.momepy.org/en/stable/generated/momepy.CheckTessellationInput.html#momepy.CheckTessellationInput
Is it possible to make tessellation of building shape files in ArcGIS or ArcGIS pro?
there's nothing preventing you porting the algorithm to ArcGIS but I am not sure it can do it out of the box.
However, I think that we should fix things like CellAlignment
so it returns NaNs when there's no match, instead of failing as it does now.
Thank you so much.
But, I am wondering how to make the stable Block without Length mismatch.
Please let me know how to fix the Collapsed features, Split features, Overlapping features using momepy functions.
I am stuck when I make Block.
You can try using momepy.preprocess
function, but keep in mind that it is highly experimental and does not always work. Split features are usually fine. I normally drop collapsed features.
Thank you so much. The momepy.preprocess does not always work to clean data, especially, larger volume data.
I think that the best clean data is that the number of buildings is equal to that of building tessellation. For checking and cleaning that, we need to clean the data in ArcGIS or other software. Is it correct?
Yes, you often need to visually explore what is wrong.
Hello,
Hello, Hello, I face the new error message as below. It is usual when I work. Please let me know how to fit it.
ValueError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_2076/1343194658.py in
2
3 tessellation['stcOri'] = mm.Orientation(tessellation, verbose=False).series
----> 4 buildings['stbCeA'] = mm.CellAlignment(buildings, tessellation, 'stbOri', 'stcOri', 'uID', 'uID').series
C:\anaconda\envs\geo\lib\site-packages\momepy\distribution.py in init(self, left, right, left_orientations, right_orientations, left_unique_id, right_unique_id) 421 right_orientations = right_orientations + "_y" 422 self.series = np.absolute(comp[left_orientations] - comp[right_orientations]) --> 423 self.series.index = left.index 424 425
C:\anaconda\envs\geo\lib\site-packages\pandas\core\generic.py in setattr(self, name, value) 5498 try: 5499 object.getattribute(self, name) -> 5500 return object.setattr(self, name, value) 5501 except AttributeError: 5502 pass
C:\anaconda\envs\geo\lib\site-packages\pandas_libs\properties.pyx in pandas._libs.properties.AxisProperty.set()
C:\anaconda\envs\geo\lib\site-packages\pandas\core\series.py in _set_axis(self, axis, labels, fastpath) 557 if not fastpath: 558 # The ensure_index call above ensures we have an Index object --> 559 self._mgr.set_axis(axis, labels) 560 561 # ndarray compatibility
C:\anaconda\envs\geo\lib\site-packages\pandas\core\internals\managers.py in set_axis(self, axis, new_labels) 214 def set_axis(self, axis: int, new_labels: Index) -> None: 215 # Caller is responsible for ensuring we have an Index object. --> 216 self._validate_set_axis(axis, new_labels) 217 self.axes[axis] = new_labels 218
C:\anaconda\envs\geo\lib\site-packages\pandas\core\internals\base.py in _validate_set_axis(self, axis, new_labels) 55 56 elif new_len != old_len: ---> 57 raise ValueError( 58 f"Length mismatch: Expected axis has {old_len} elements, new " 59 f"values have {new_len} elements"
ValueError: Length mismatch: Expected axis has 6405 elements, new values have 5181 elements