概述
谢谢!
SEARCHED_LOCATION = db.GeoPt("48.8566667,2.3509871") # Location of Paris. DISTANCE = 50000 #Between 10000 and 150000. MAX_RESULTS = 300 # Resolution '4' is about 150 kilometers i suppose it's a good compromise. bBox = geocell.compute_Box(geocell.compute(SEARCHED_LOCATION,resolution=4)) cell = geocell.best_bBox_search_cells(bBox,geomodel.default_cost_function) query.filter('location_geocells IN',cell) # Python filters def _func(x): """Private method used to set the distance of the model to the searched location and return this distance. """ x.dist = geomath.distance(SEARCHED_LOCATION,x.location) return x.dist results = sorted(query.fetch(MAX_RESULTS),key=_func) # Order the result by distance results = [x for x in results if x.dist <= DISTANCE] # Filter the result
总结
以上是编程之家为你收集整理的Python GeoModel替代方案全部内容,希望文章能够帮你解决Python GeoModel替代方案所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧