Aug-18-2019, 09:33 AM
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:
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))