def find_all_boundary_tiles_at_time()

in data-access/nexustiles/backends/nexusproto/dao/ElasticsearchProxy.py [0:0]


    def find_all_boundary_tiles_at_time(self, min_lat, max_lat, min_lon, max_lon, ds, time, **kwargs):
        
        the_time = datetime.utcfromtimestamp(time).strftime(ELASTICSEARCH_FORMAT)
        
        params = {
            "size": 1000,
            "query": {
                "bool": {
                    "filter": [
                        {
                            "term": {
                                "dataset_s": {
                                    "value": ds
                                }
                            }
                        },
                        {
                            "geo_shape": {
                                "geo": {
                                    "shape": {
                                        "type": "multilinestring",
                                        "coordinates": [[[min_lon, max_lat], [max_lon, max_lat], [min_lon, max_lat], [min_lon, min_lat], [max_lon, max_lat], [max_lon, min_lat], [min_lon, min_lat], [max_lon, min_lat]]]
                                    },
                                    "relation": "intersects"
                                }
                            }
                        },
                        {
                            "range": {
                                "tile_count_i": {
                                    "gte": 1
                                }
                            }
                        },
                        { 
                            "range": {
                                "tile_min_time_dt": {
                                    "lte": the_time
                                }
                            } 
                        },
                        { 
                            "range": {
                                "tile_max_time_dt": {
                                    "gte": the_time
                                }
                            }
                        }
                    ],
                    "must_not" : {
                        "geo_shape": {
                            "geo": {
                                "shape": {
                                    "type": "envelope",
                                    "coordinates": [[min_lon, max_lat], [max_lon, min_lat]]
                                },
                                "relation": "within"
                            }
                        }
                    }
                }
            }
        }

        self._merge_kwargs(params, **kwargs)

        return self.do_query_all(*(None, None, None, False, None), **params)