Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have such a python code.

from shapely.geometry import Point, LineString
line = LineString([(lat1,lon1),(lat2,lon2)])
point = Point(lat3, lon3)
line.distance(point) < 1e-8


And here's the error.

TypeError: only size-1 arrays can be converted to Python scalars


What I have tried:

I guess this is raised when the function expects a single value but you pass an array instead. But I don't know how to figure out this problem. What can I do?
Posted
Updated 27-Mar-21 21:57pm

Don't pass it an array ... or change the LineString function to accept an array.

We have no idea what that code is meant to do, or what the LineString function does, or how it does it - so we really can't help with any accuracy!
 
Share this answer
 
Please spend more time reading the documentation: Shapely · PyPI[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900