-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathcreate-map.js
More file actions
32 lines (27 loc) · 1.04 KB
/
create-map.js
File metadata and controls
32 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[location.JavaScript.map.createMapV3]
import { fileURLToPath } from "node:url";
import { CreateMapCommand, LocationClient } from "@aws-sdk/client-location";
import data from "./inputs.json" with { type: "json" };
const region = "eu-west-1";
export const main = async () => {
const CreateMapCommandInput = {
MapName: `${data.inputs.mapName}`,
Configuration: { style: "VectorEsriNavigation" },
};
const locationClient = new LocationClient({ region: region });
try {
const command = new CreateMapCommand(CreateMapCommandInput);
const response = await locationClient.send(command);
console.log("Map created. Map ARN is : ", response.MapArn);
} catch (error) {
console.error("Error creating map: ", error);
throw error;
}
};
// snippet-end:[location.JavaScript.map.createMapV3]
// Invoke main function if this file was run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main();
}