Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error keeps arising while trying to run Load the track to analyze #4

Closed
malek87434 opened this issue Aug 9, 2023 · 4 comments
Closed

Comments

@malek87434
Copy link

ValueError Traceback (most recent call last)
Cell In[13], line 14
12 l_inner_border = LineString(inner_border)
13 l_outer_border = LineString(outer_border)
---> 14 road_poly = Polygon(np.vstack((l_outer_border, np.flipud(l_inner_border))))
15 print("Is loop/ring? ", l_center_line.is_ring)
16 road_poly

File <array_function internals>:200, in flipud(*args, **kwargs)

File /usr/local/lib/python3.11/site-packages/numpy/lib/twodim_base.py:154, in flipud(m)
152 m = asanyarray(m)
153 if m.ndim < 1:
--> 154 raise ValueError("Input must be >= 1-d.")
155 return m[::-1, ...]

ValueError: Input must be >= 1-d.

@malek87434
Copy link
Author

Running the code on a MacBook

@debanjanbasu
Copy link

I'm having the same issue...

@MusabAlsaifi
Copy link

the problem is the vstack operation is expecting a 2D array, but LineString objects don't have a shape attribute.
do this instead
road_poly = Polygon(np.vstack((np.array(l_outer_border.coords), np.flipud(np.array(l_inner_border.coords)))))

@malek87434
Copy link
Author

the problem is the vstack operation is expecting a 2D array, but LineString objects don't have a shape attribute. do this instead road_poly = Polygon(np.vstack((np.array(l_outer_border.coords), np.flipud(np.array(l_inner_border.coords)))))

Thank you @MusabAlsaifi this worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants