I have a list of points describing the boundaries of Spain. I want to be able to tell whether a pair of lat,lon is within these boundaries. I have tried the following:
import shapefile import matplotlib.pyplot as plt from shapely.geometry import MultiPoint, Point, Polygon from shapely.geometry.polygon import Polygon sf = shapefile.Reader(r"\ESP_adm0.shp") shapes = sf.shapes() lat = ; lon =  for i in range(len(shapes.points)): lon.append(shapes.points[i]);lat.append(shapes.points[i])
I know I am retrieving the points, because I'm able to plot and get the desired results:
(plot in the link below) plot result
I do the following to get the poitns into a polygon:
coords = list(zip(lat,lon)) spain_pol = Polygon(coords)
And then I use the contains function.
These both return false. In fact I haven't been able to get a single point I've tried to return a True.
I have tried all sorts of things, and I think I must be missing something fundamental.
Perhaps the facts Spain has islands and there's more than one polygon is the problem?