I have a shapefile for Manhattan taken from the Pluto dataset:


Removing it from the zip, I load it with Fiona.

import fiona
import shapely
fiona_shape_pluto_mn = fiona.open("MNMapPLUTO.shp")
first = fiona_shape_pluto_mn.next()
shp_geom = shapely.geometry.shape(first['geometry']) 

According to the Pluto CSV file for Manhattan (MN2017V11.csv), these points correspond to Bush Tower in Manhattan: 988230, 214299

But when I run the following I get False:

shp_geom.contains(shapely.geometry.Point(988230, 214299))

  • Did you plot the data because your point is not within any polygon – gene Apr 20 '18 at 8:04
  • Thanks. You are right. I had thought fiona was loading the entire shapefile. It appears to only be loading a part. When I load it into a multipolygon mp = MultiPolygon([shape(pol['geometry']) for pol in fiona.open(f_MN)]) and run mp.contains(Point(987838,195989)), I get a TopologicalError. – zadrozny Apr 20 '18 at 20:42
  • Whether you use a polygon or a multipolygon, the problem remains the same, none of them contains the point. – gene Apr 21 '18 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.