如何创建物流地图 - Amazon Location Service

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

如何创建物流地图

该 TravelModes 功能允许您使用亚马逊定位服务(Amazon Location Service)构建物流地图。 TravelModes 显示卡车导航的相关路线信息以及相关的道路限制。使用 Tran TravelMode sit 显示公共交通详情。

使用 Truck 创建地图 TravelMode

此示例说明如何使用TruckTravelMode为物流路径创建地图。

index.html
<!DOCTYPE html> <html lang="en"> <head> <title>Truck Map</title> <meta charset='utf-8'> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' /> <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script> </head> <body style="margin: 0; padding: 0;"> <div id="map" style="width: 100%; height: 100vh;"></div> <script> const apiKey = "Add Your Api Key"; const mapStyle = "Standard"; const awsRegion = "us-east-1"; const map = new maplibregl.Map({ container: 'map', style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?travel-modes=Truck&key=${apiKey}`, center: [-74.0060 ,40.7128], zoom: 12, validateStyle: false, // Disable style validation for faster map load }); </script> </body> </html>
style.css
body { margin: 0; padding: 0; } #map { width: 100%; height: 100vh; }