i tried to count points from the point shapefile where is within in the polygon shapefile but i fail.Maybe my code is complete wrong but i tried. any idea how to fix my code ? i want fast method because i have big data features from shapely.geometry import shape import fiona
filepath1 = "point.shp" file1features = [] intersectfeatures_file1 = [] intersectfeatures_file2 = [] count =0 count=count+1 outschema = None with fiona.collection(filepath1, "r") as input1: outschema = input1.schema.copy() for p1 in input1: file1features.append(p1) filepath2 = "polygon.shp" with fiona.collection(filepath2, "r") as input2: for p2 in input2: for p1 in file1features: [count for i in [shape(p1['geometry']).within(shape(p2['geometry']))]] if p1 not in intersectfeatures_file1: intersectfeatures_file1.append(p1) if p2 not in intersectfeatures_file2: intersectfeatures_file2.append(p2) print count ''' if intersectfeatures_file1: outfile = "outputfile1.shp" with fiona.collection(outfile, "w", "ESRI Shapefile", outschema) as output: for outfeature in intersectfeatures: output.write(outfeature) if intersectfeatures_file2: outfile = "outputfile2.shp" with fiona.collection(outfile, "w", "ESRI Shapefile", outschema) as output: for outfeature in intersectfeatures: output.write(outfeature) ''' on the print count i take 20 times the number 1. after for this count i want to export to new shapefile the polygons where have specific number of points. thnx -- https://mail.python.org/mailman/listinfo/python-list