Hello,
I am playing around with Shapely. However, I am having trouble making Shapely accept a list of GPS coordinates as the logical test.
I get the following error message:
TypeError: must be real number, not list
CSV File: LINK
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))