如何將 GPS 追蹤比對至道路網路 - Amazon Location Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

如何將 GPS 追蹤比對至道路網路

SnapToRoads API 可讓您將 GPS 追蹤比對至道路網路。GPS 追蹤包含使用 GPS 裝置記錄的位置和中繼資料,例如時間戳記、速度和標題。這些追蹤通常具有誤差範圍,使其難以直接用於分析和視覺化。

SnapToRoads 會考慮指定行程模式的法律和時間限制,同時比對追蹤。如果追蹤強烈建議違反限制,則會維持實際採取的路由。

潛在的使用案例

  • GPS 追蹤覆蓋在最可能行駛的道路上:此功能有助於將 GPS 資料與道路網路上最準確的路徑對齊,以支援更清晰的資料視覺化。

  • 攔截 GPS 追蹤中的差距:SnapToRoads 可以透過將座標貼齊道路區段來填補差距,為應用程式建立更連續且有用的資料集。

  • 篩選雜訊和極端值:透過貼齊最近的道路,此 API 可協助移除極端值並減少 GPS 雜訊,改善分析的資料可靠性。

範例

Sample request
{ "TracePoints": [ { "Position": [8.53404,50.16364], "Timestamp": "2024-05-22T18:13:42Z" }, { "Position": [8.53379056,50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z" } ], "TravelMode": "Car" }
Sample response
{ "Notices": [], "SnappedGeometry": { "Polyline": "Redacted" }, "SnappedGeometryFormat": "FlexiblePolyline", "SnappedTracePoints": [ { "Confidence": 1, "OriginalPosition": [8.53404, 50.16364], "SnappedPosition": [8.53402, 50.16367] }, { "Confidence": 0.86, "OriginalPosition": [8.53379056, 50.16352417], "SnappedPosition": [8.53375, 50.16356] } ] }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/snap-to-roads?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "TracePoints": [ { "Position": [8.53404,50.16364], "Timestamp": "2024-05-22T18:13:42Z" }, { "Position": [8.53379056,50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z" } ], "TravelMode": "Car" }'
AWS CLI
aws geo-routes snap-to-roads --key ${YourKey} \ --trace-points '[{"Position": [8.53404, 50.16364], "Timestamp": "2024-05-22T18:13:42Z"}, {"Position": [8.53379056, 50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z"}]' \ --travel-mode "Car"
Sample request
{ "TracePoints": [ { "Position": [8.53404,50.16364], "Timestamp": "2024-05-22T18:13:42Z" }, { "Position": [8.53379056,50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z" } ], "TravelMode": "Truck", "TravelModeOptions": { "Truck": { "GrossWeight": 10000 } } }
Sample response
{ "Notices": [], "SnappedGeometry": { "Polyline": "Redacted" }, "SnappedGeometryFormat": "FlexiblePolyline", "SnappedTracePoints": [ { "Confidence": 1, "OriginalPosition": [8.53404, 50.16364], "SnappedPosition": [8.53402, 50.16367] }, { "Confidence": 0.86, "OriginalPosition": [8.53379056, 50.16352417], "SnappedPosition": [8.53375, 50.16356] } ] }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/snap-to-roads?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "TracePoints": [ { "Position": [8.53404,50.16364], "Timestamp": "2024-05-22T18:13:42Z" }, { "Position": [8.53379056,50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z" } ], "TravelMode": "Truck", "TravelModeOptions": { "Truck": { "GrossWeight": 10000 } } }'
AWS CLI
aws geo-routes snap-to-roads --key ${YourKey} \ --trace-points '[{"Position": [8.53404, 50.16364], "Timestamp": "2024-05-22T18:13:42Z"}, {"Position": [8.53379056, 50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z"}]' \ --travel-mode "Truck" \ --travel-mode-options '{"Truck": {"GrossWeight": 10000}}'