I have an identical Python cgi-bin script running on two servers - one a Windows 2003 server and the other my desktop (Windows 7 64-bit). The script uses Shapely prepared polygon geometries to test whether a large number of points fall within given polygons. I get different results from both servers. Both are running Python 2.7.
Here are some code snippets: from shapely.geometry import Point, Polygon from shapely.wkt import loads from shapely.prepared import prep #read in file of livestock areas in WKT format and create list of Polygons allf = open("poly_geom.txt","r") lines = allf.readlines() lsrs = [] polys = [] polysdict = {} for line in lines: lsr,geom = line.strip().split("|") lsrs.append(lsr) poly = loads(geom) prpoly = prep(poly) polysdict[lsr] = prpoly polys.append(prpoly) #Later, using a list of points (allpts) I do: polyidx = 0 for prpoly in polys: a = [pt for pt in allpts if prpoly.contains(pt)] lsr = lsrs[polyidx] alldict[lsr] = len(a) print lsr + ":" + str(len(a)) polyidx = polyidx + 1 On the Windows 2003 server I get almost double the numbers of points falling within each polygon. I have checked using a GIS and spatialite, and my desktop (Windows 7) returns the correct results. On the server, if I use unprepared polygon geoemetries, I get the correct answer. ie. I replace the first section of code with: for line in lines: lsr,geom = line.strip().split("|") lsrs.append(lsr) poly = loads(geom) #prpoly = prep(poly) polysdict[lsr] = poly polys.append(poly) Is there a bug in the prepared code or does Shapely rely on other installed components (Geos) etc. such that I might have an older dll somewhere? Many thanks, Robert This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system. This message has been scanned for Malware and Viruses by Websense Hosted Security. www.websense.com _______________________________________________ Community mailing list Community@lists.gispython.org http://lists.gispython.org/mailman/listinfo/community