Пример #1
0
 def collections(self):
     collection_list = opensearch_config.load_settings("collections_list")
     collection_list_newest_first = OrderedDict(
         reversed(collection_list.items()))
     return base.render(
         'static/collection_list.html',
         extra_vars={'collection_list': collection_list_newest_first})
Пример #2
0
def collection_information(collection_id=None):
    collections = opensearch_config.load_settings("collections_list")
    collection_items = collections.items()

    for collection in collection_items:
        if collection[0] == collection_id:
            return dict(collection[1])
Пример #3
0
def get_collections_count():
    collections = opensearch_config.load_settings("collections_list")

    collections_count = collections.keys()
    collections_count = len(collections_count)

    return collections_count
Пример #4
0
def generate_opensearch_query(params):
    query = '/opensearch/search.atom?'

    if 'collection_name' in params:
        collection_name = params['collection_name']

        collections = opensearch_config.load_settings("collections_list")
        collection_items = collections.items()

        for collection in collection_items:
            collection_items = collection[1].items()
            if collection_name in collection[1].items()[0]:
                query = query + 'productType=' + collection[0]

        for param in params:
            if param != 'collection_name':
                param_tmp = ''
                if param == 'polarisationChannels':
                    param_tmp = 'polarisation'
                elif param == "swathIdentifier":
                    param_tmp = "swath"
                elif param == "orbitDirection":
                    param_tmp = "orbit_direction"
                elif param == "swathIdentifier":
                    param_tmp = "swath"
                elif param == "OrbitDirection":
                    param_tmp = "orbit_direction"
                elif param == "TransmitterReceiverPolarisation":
                    param_tmp = "polarisation"
                elif param == 'Swath':
                    param_tmp = "swath"
                elif param == 'ext_bbox':
                    param_tmp = "bbox"
                else:
                    param_tmp = param

                if ' ' in params[param]:
                    value = '"' + params[param] + '"'
                else:
                    value = params[param]

                query = query + '&' + param_tmp + '=' + value
    else:
        for param in params:
            if param == 'ext_bbox':
                param_tmp = "bbox"
                query = query + '&' + param_tmp + '=' + params[param]
            else:
                query = query + '&' + param + '=' + params[param]

    return query