Performs all preparation steps for a map export. Args: image: The Image to be exported. config: All the user-specified export parameters. May be modified. Returns: A config dict containing all information required for the export.
(
image: _arg_types.Image, config: dict[str, Any]
)
| 1262 | |
| 1263 | |
| 1264 | def _prepare_map_export_config( |
| 1265 | image: _arg_types.Image, config: dict[str, Any] |
| 1266 | ) -> dict[str, Any]: |
| 1267 | """Performs all preparation steps for a map export. |
| 1268 | |
| 1269 | Args: |
| 1270 | image: The Image to be exported. |
| 1271 | config: All the user-specified export parameters. May be modified. |
| 1272 | |
| 1273 | Returns: |
| 1274 | A config dict containing all information required for the export. |
| 1275 | """ |
| 1276 | _canonicalize_parameters(config, Task.ExportDestination.GCS) |
| 1277 | |
| 1278 | # We have to protect the "scale" parameter as prepare_for_export will try |
| 1279 | # to interpret it inappropriately. |
| 1280 | scale = config.pop('scale', None) |
| 1281 | image, config = image.prepare_for_export(config) |
| 1282 | if scale is not None: |
| 1283 | config['scale'] = scale |
| 1284 | |
| 1285 | if 'fileFormat' not in config: |
| 1286 | config['fileFormat'] = 'auto' |
| 1287 | if 'writePublicTiles' not in config: |
| 1288 | config['writePublicTiles'] = True |
| 1289 | |
| 1290 | request = {} |
| 1291 | request['expression'] = image |
| 1292 | if 'description' in config: |
| 1293 | request['description'] = config.pop('description') |
| 1294 | |
| 1295 | request['tileOptions'] = _build_tile_options(config) |
| 1296 | request['tileExportOptions'] = _build_image_file_export_options( |
| 1297 | config, Task.ExportDestination.GCS) |
| 1298 | # This can only be set by internal users. |
| 1299 | if 'maxWorkers' in config: |
| 1300 | request['maxWorkers'] = {'value': int(config.pop('maxWorkers'))} |
| 1301 | if 'priority' in config: |
| 1302 | # This field is a wrapped integer value so it needs an inner "value" field |
| 1303 | # for JSON encoding. |
| 1304 | request['priority'] = {'value': int(config.pop('priority'))} |
| 1305 | if config: |
| 1306 | raise ee_exception.EEException(f'Unknown configuration options: {config}.') |
| 1307 | return request |
| 1308 | |
| 1309 | |
| 1310 | def _prepare_table_export_config( |
no test coverage detected