Eric Lemoine wrote: > On Sat, Apr 26, 2008 at 12:52 AM, Sean Gillies <[EMAIL PROTECTED]> wrote: >> Eric Lemoine wrote: >> > On Fri, Apr 25, 2008 at 10:55 PM, Sean Gillies <[EMAIL PROTECTED]> wrote: >> >> Eric Lemoine wrote: >> >> > On Fri, Apr 25, 2008 at 10:12 PM, Eric Lemoine <[EMAIL PROTECTED]> >> wrote: >> >> >> On Fri, Apr 25, 2008 at 5:56 PM, Sean Gillies <[EMAIL PROTECTED]> >> wrote: >> >> >> > Eric, >> >> >> >> >> >> Sean, thanks for your reply. >> >> >> >> >> >> >> >> >> > >> >> >> > Try adding a breakpoint at the beginning of >> BinaryPredicate.__call__ in >> >> >> > shapely/predicates.py to see what's up with self.context._geom >> and >> >> >> > other._geom. >> >> >> >> >> >> self.context._geom = -1320155896 >> >> >> other._geom = 140268432 >> >> >> >> >> >> The first value looks suspicious, doesn't it? >> >> > >> >> > FWIW, I have: >> >> > >> >> > print self.context return POINT (52.4603282421875008 >> -23.7364467734374998) >> >> > print other return POINT (52.4603282421875008 -23.7364467734374998) >> >> > >> >> > so it's comparing the same point, it is just that the internal _geom >> >> > value isn't interpretable by geos for the self.context object. >> >> > >> >> > -- >> >> > Eric >> >> >> >> Is self.context the geometry in the session or is it the persisted >> >> geometry? If it's the persisted geometry, maybe what we're comparing is >> >> a cache or memoization? >> > >> > At this point I've no answer to these questions. Sorry. >> > >> > One other thing I've noticed: the two compared objects have different >> > values for the _geom property (see above); however they have the same >> > value for the __geom (_PointAdapter__geom really). Is this mismatch >> > expected? >> > >> > -- >> > Eric >> >> They are PointAdapters? Can you tell me more about their life cycle? > > They are created by asShape. Client posts GeoJSON -> Server creates a > geojson.feature.FeatureCollection -> for each feature geometry create > a PointAdapter using asShape(feature.geometry) > > See following code. post() is executed on HTTP POST requests. > > def post(self): > content = > request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH'])) > factory = lambda ob: geojson.GeoJSON.to_instance(ob) > collection = geojson.loads(content, object_hook=factory) > if not isinstance(collection, geojson.feature.FeatureCollection): > response.status_code = 400 > return > for f in collection.features: > geometry = asShape(f.geometry) > # the most hackish thing I've ever done, get a segfault > # in libgeos:GEOSEquals without this, that one's driving > # me crazy > #geometry.__dict__['equals'] = lambda arg: True > > # 1.0! FIXME > refugee = Refugee(1.0, geometry) > model.Session.save(refugee) > model.Session.commit() > response.status_code = 201 > > > > Thanks for your help Sean, I'm a bit desperate on that one! > > -- > Eric
Okay, I'll dig into that tonight. Sean _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
