|
64 | 64 |
|
65 | 65 | from pygeoapi.util import ( |
66 | 66 | CrsTransformSpec, TEMPLATES, UrlPrefetcher, dategetter, |
67 | | - filter_dict_by_key_value, get_api_rules, get_base_url, |
68 | | - get_provider_by_type, get_provider_default, get_typed_value, |
| 67 | + filter_dict_by_key_value, filter_providers_by_type, get_api_rules, |
| 68 | + get_base_url, get_provider_by_type, get_provider_default, get_typed_value, |
69 | 69 | get_crs_from_uri, get_supported_crs_list, render_j2_template, to_json |
70 | 70 | ) |
71 | 71 |
|
@@ -815,21 +815,18 @@ def landing_page(api: API, |
815 | 815 | headers = request.get_response_headers(**api.api_headers) |
816 | 816 | if request.format == F_HTML: # render |
817 | 817 |
|
818 | | - fcm['processes'] = False |
819 | | - fcm['stac'] = False |
820 | | - fcm['collection'] = False |
821 | | - |
822 | | - if filter_dict_by_key_value(api.config['resources'], |
823 | | - 'type', 'process'): |
824 | | - fcm['processes'] = True |
825 | | - |
826 | | - if filter_dict_by_key_value(api.config['resources'], |
827 | | - 'type', 'stac-collection'): |
828 | | - fcm['stac'] = True |
829 | | - |
830 | | - if filter_dict_by_key_value(api.config['resources'], |
831 | | - 'type', 'collection'): |
832 | | - fcm['collection'] = True |
| 818 | + for resource_type in ['collection', 'process', 'stac-collection']: |
| 819 | + fcm[resource_type] = False |
| 820 | + |
| 821 | + found = filter_dict_by_key_value(api.config['resources'], |
| 822 | + 'type', resource_type) |
| 823 | + if found: |
| 824 | + fcm[resource_type] = True |
| 825 | + if resource_type == 'collection': # check for tiles |
| 826 | + for key, value in found.items(): |
| 827 | + if filter_providers_by_type(value['providers'], |
| 828 | + 'tile'): |
| 829 | + fcm['tile'] = True |
833 | 830 |
|
834 | 831 | content = render_j2_template( |
835 | 832 | api.tpl_config, api.config['server']['templates'], |
|
0 commit comments