On Jul 28, 2009, at 8:55 PM, Daniel O'donohue wrote: > hi there > > I'm am trying to use the following algorthyim to test to see if two > geometries match > > Geometry A matches geometry B if > A is contained in buffer(B, d) > and B is contained in buffer(A, d) > and boundary(A) is contained in buffer(boundary(B), d) > and boundary(B) is contained in buffer(boundary(A), d) > > > > polya = MultiPoint([(-1.0, -2.0), (1.0, -2.0), (-1.0, 2.0), (1.0, > 2.0)]).convex_hull > polyb = MultiPoint([(-1.0, -2.0), (1.0, -2.0), (-1.0, 2.0), (1.0, > 2.0)]).convex_hull > > buffa = polya.buffer(1.0) > buffb = polya.buffer(1.0) > > polya_bound = polya.boundary > polyb_bound = polyb.boundary > > > print buffa.contains(polyb) > print buffb.contains(polya) > print buffa.contains(polyb_bound) > print buffb.contains(polya_bound) > > > I use a convex hull to ensure that the polygon created is only > considering the outside points > and my points are not ordered so this ensures that I valid polygon > is returned > > How ever the last four print statments return > > False > False > True > True > > both geometries are identical so why would the buffer of one not > contain the either one of the > original geometires?? > > I am really studk here and would be greatfull for any help > > cheers > > dan
Hi Dan, I can't reproduce this problem. Here's what I get, using Shapely 1.0.12 and GEOS 3.1.0: >>> from shapely.geometry import MultiPoint >>> polya = MultiPoint([(-1.0, -2.0), (1.0, -2.0), (-1.0, 2.0), (1.0, 2.0)]).convex_hull >>> polyb = MultiPoint([(-1.0, -2.0), (1.0, -2.0), (-1.0, 2.0), (1.0, 2.0)]).convex_hull >>> buffa = polya.buffer(1.0) >>> buffb = polya.buffer(1.0) >>> buffa.contains(polya) True >>> buffb.contains(polya) True >>> buffb.contains(polyb) True >>> buffa.contains(polyb) True >>> polya.equals(polyb) True What's your GEOS version? Sean _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
