|
61 | 61 | 'http://www.opengis.net/spec/ogcapi-maps-1/1.0/conf/core' |
62 | 62 | ] |
63 | 63 |
|
64 | | - |
65 | 64 | DEFAULT_CRS = 'http://www.opengis.net/def/crs/EPSG/0/4326' |
66 | 65 |
|
| 66 | +CRS_CODES = { |
| 67 | + '4326': 'http://www.opengis.net/def/crs/EPSG/0/4326', |
| 68 | + '3857': 'http://www.opengis.net/def/crs/EPSG/0/3857', |
| 69 | + 'http://www.opengis.net/def/crs/EPSG/0/4326': 'http://www.opengis.net/def/crs/EPSG/0/4326', # noqa |
| 70 | + 'http://www.opengis.net/def/crs/EPSG/0/3857': 'http://www.opengis.net/def/crs/EPSG/0/3857', # noqa |
| 71 | + 'EPSG:4326': 'http://www.opengis.net/def/crs/EPSG/0/4326', |
| 72 | + 'EPSG:3857': 'http://www.opengis.net/def/crs/EPSG/0/3857', |
| 73 | +} |
| 74 | + |
67 | 75 |
|
68 | 76 | def get_collection_map(api: API, request: APIRequest, |
69 | 77 | dataset: str, style: str | None = None |
@@ -106,10 +114,10 @@ def get_collection_map(api: API, request: APIRequest, |
106 | 114 |
|
107 | 115 | query_args['format_'] = request.params.get('f', 'png') |
108 | 116 | query_args['style'] = style |
109 | | - query_args['crs'] = collection_def.get('crs', DEFAULT_CRS) |
110 | | - query_args['bbox_crs'] = request.params.get( |
111 | | - 'bbox-crs', DEFAULT_CRS |
112 | | - ) |
| 117 | + query_args['crs'] = CRS_CODES[request.params.get( |
| 118 | + 'crs', collection_def.get('crs', DEFAULT_CRS))] |
| 119 | + query_args['bbox_crs'] = CRS_CODES[request.params.get( |
| 120 | + 'bbox-crs', collection_def.get('crs', DEFAULT_CRS))] |
113 | 121 | query_args['transparent'] = request.params.get('transparent', True) |
114 | 122 |
|
115 | 123 | try: |
@@ -151,6 +159,7 @@ def get_collection_map(api: API, request: APIRequest, |
151 | 159 | return headers, HTTPStatus.BAD_REQUEST, to_json( |
152 | 160 | exception, api.pretty_print) |
153 | 161 |
|
| 162 | + # the transformer function expects the crs to be in a uri format |
154 | 163 | if query_args['bbox_crs'] != query_args['crs']: |
155 | 164 | LOGGER.debug(f'Reprojecting bbox CRS: {query_args["crs"]}') |
156 | 165 | bbox = transform_bbox(bbox, query_args['bbox_crs'], query_args['crs']) |
|
0 commit comments