Inconsistent "Inconsistent coordinate dimensionality" error
See original GitHub issueAs found in #963, there is a bit of inconsistency in how mixed 2D and 3D coordinates/points are used to create LineString objects.
These are expected errors:
from shapely.geometry import LineString, Point
import pytest
with pytest.raises(ValueError, match="Inconsistent coordinate dimensionality"):
LineString([(1, 2, 3), (4, 5)])
with pytest.raises(ValueError, match="Inconsistent coordinate dimensionality"):
LineString([Point(1, 2, 3), Point(4, 5)])
However these should also raise the error too:
with pytest.raises(ValueError, match="Inconsistent coordinate dimensionality"):
LineString([(1, 2), (3, 4, 5)])
with pytest.raises(ValueError, match="Inconsistent coordinate dimensionality"):
LineString([Point(1, 2), Point(3, 4, 5)])
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
#1079 (Inconsistent dimensionality change) – GEOS
It seems inconsistent all around, to me. What is the consistent rule supposed to be? My guess would have been "preserve the dimensionality...
Read more >Failure while converting geojson to wkt · Issue #869 - GitHub
Steps to reproduce the problem. from shapely import geometry def ... dimensionality") ValueError: Inconsistent coordinate dimensionality.
Read more >what is wrong with this shapely error message - Stack Overflow
I am using shapely for first time with no prior experience in it. Any help will be much appreciated. Thank you. Note: The...
Read more >ValueError: Invalid coordinate dimensionality
I have looked for this error everywhere. Shapely did not provide anything about it. What I am trying to do is convert multiple...
Read more >Why do I get the error "The input data has inconsistent size ...
Accepted Answer The input data has inconsistent size. To resolve this error message, you must make sure that the matrices "xq", "yq" and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, a first regression report! 😉 Can you open a new issue with that failing example? (we clearly were not testing this case)
Indeed, I think that’s a correct analysis.
Now for a solution, note that pygeos already checks for this (although the error message is not very clear / user friendly, not sure we can do something about that …):
So this will be fixed in Shapely 2.0 (and not necessarily worth doing a separate fix in 1.8, or at least not priority, I would say)