Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Raycasting GPS coordinates
#5
Hello,

I managed to install and play around with Shapely. Unfortunately I meet an error which I am not sure whether is fixable.

I get the following error:
Error:
TypeError: must be real number, not list
This is my code:

from shapely.geometry import Point, Polygon
import pandas as pd
import csv

# Read the csv file
df = pd.read_csv("ais3.csv", encoding = "ISO-8859-1", decimal='.')


# Create dataframe with only relevant data
df1 = df[['Latitude','Longitude']].copy()


# convert data to numbers
df1[['Latitude', 'Longitude']].astype(float).values


# Store our latitude and longitude as list
latitude_list = df1["Latitude"].tolist()
longitude_list = df1["Longitude"].tolist()


# Create Point objects
p1 = Point(latitude_list, longitude_list)


# Create a Polygon
coords = [(59.29569,10.605997), (53.687444,9.060655),(53.90742,16.172993), (56.928762,16.923587)]
poly = Polygon(coords)


print(p1.within(poly))
Reply


Messages In This Thread
Raycasting GPS coordinates - by drybulkfreight - Aug-17-2019, 07:39 AM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-17-2019, 06:28 PM
RE: Raycasting GPS coordinates - by scidam - Aug-17-2019, 10:04 PM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-18-2019, 08:12 AM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-18-2019, 09:33 AM
RE: Raycasting GPS coordinates - by ThomasL - Aug-18-2019, 09:38 AM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-18-2019, 10:27 AM
RE: Raycasting GPS coordinates - by ThomasL - Aug-18-2019, 11:00 AM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-18-2019, 11:00 AM
RE: Raycasting GPS coordinates - by ThomasL - Aug-18-2019, 12:16 PM
RE: Raycasting GPS coordinates - by drybulkfreight - Aug-18-2019, 02:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help on making raycasting faster robie972003 2 2,953 Mar-10-2019, 03:36 AM
Last Post: robie972003

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020