def singleCollectionHandler(self, params, id=None): collection = CollectionModel().load(id, user=self.getCurrentUser()) if (BOUNDS_KEY in collection): return { k: v for (k, v) in collection.items() if k in COLLECTION_RETURN_FIELDS } else: return {}
def forceRecomputeAllHandler(self, params): filteredCollections = [] for collection in CollectionModel().list(user=self.getCurrentUser()): convexHull = computeCollectionConvexHull(collection, self.getCurrentUser()) if (convexHull): collection[BOUNDS_KEY] = { 'type': 'Polygon', 'coordinates': [list(convexHull.exterior.coords)] } collection = CollectionModel().save(collection) filteredCollections.append({ k: v for (k, v) in collection.items() if k in COLLECTION_RETURN_FIELDS }) return filteredCollections