Amazon Location Service
AWS LabsOfficialCreated by aws-geospatialDistributed by AWS Labs
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Amazon Location Service provides a suite of geospatial APIs for web and mobile applications. This skill covers the integration of maps, geocoding, routing, places search, geofencing, and device tracking. It emphasizes the use of the bundled JavaScript client for web development and promotes resourceless API operations to simplify deployment. The skill also provides guidance on authentication via IAM or API keys, and distinguishes between interactive address input and bulk postal address validation using the Jobs API.
What it does
- Provides interactive maps using MapLibre and static map images.
- Converts addresses to coordinates (geocoding) and coordinates to addresses (reverse geocoding).
- Calculates routes, travel times, and service areas with traffic estimation.
- Searches for places, businesses, and points of interest with autocomplete functionality.
- Monitors geographical boundaries with geofences and tracks device locations.
- Validates and standardizes addresses in bulk against authoritative postal data.
When to use it
- When building location-aware web or mobile applications on AWS.
- When you need to implement maps, routing, or place search functionality.
- When you need to verify and standardize large datasets of addresses in the US, CA, UK, or AU.
- When you need to track device locations or monitor entry/exit from geofenced areas.
- When migrating from other mapping providers to Amazon Location Service.
Advantages
- Supports resourceless API operations to reduce infrastructure management.
- Provides a bundled JavaScript client for simplified web integration.
- Offers flexible authentication options including API keys for public applications.
- Includes specialized APIs for bulk address validation and postal standardization.
- Integrates seamlessly with other AWS services and SDKs.
Usage examples
- “How do I implement an address autocomplete field in my React app using Amazon Location Service?”
- The agent provides a guide on using the Autocomplete API, emphasizing the use of Address.Label for display and GetPlace for retrieving full details upon selection.
- “I need to validate a large database of customer addresses in the UK. How should I do this?”
- The agent explains the use of the asynchronous Jobs API (StartJob with ValidateAddress) for bulk processing, noting that it provides postal-authority verdicts.
- “How do I initialize a map in my web application?”
- The agent provides instructions on using MapLibre with a direct URL to the map style descriptor and setting validateStyle to false for performance.
- “What are the best practices for securing my map implementation on a public website?”
- The agent recommends using API Keys with restricted AllowActions and AllowResources, rather than exposing IAM credentials.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/awslabs/amazon-location-service/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip amazon-location-service.zip -d .agents/skills
Documentation by aws-geospatial
Overview
Amazon Location Service provides geospatial APIs for maps, geocoding, routing, places search, geofencing, and tracking. Prefer the bundled JavaScript client (@aws/amazon-location-client) for web development and use resourceless API operations to avoid managing AWS resources.
When to Use This Skill
Use this skill when:
Building location-aware web or mobile applications
Working with Amazon Location Service projects
Implementing maps, geocoding, routing, or places search
Adding geofencing or device tracking functionality
Integrating geospatial features into AWS applications
Do NOT use this skill for:
Google Maps, Mapbox, or Leaflet-with-OSM projects (unless migrating to Amazon Location)
Generic GIS operations without AWS context
Non-AWS geospatial services
Amazon Location Service API Overview
Places (SDK: geo-places, JS: @aws-sdk/client-geo-places)
Geocode (Forward/Reverse): Convert addresses to coordinates and vice versa
Search (Text/Nearby): Find points of interest with contact and hours info
Autocomplete: Predict addresses based on user input
Suggest: Predict places and points of interest based on partial or misspelled user input
Get Place: Retrieve place details by place ID
Jobs (SDK: location, JS: @aws-sdk/client-location)
Address Validation: Verify and standardize addresses in bulk with the asynchronous Jobs API (StartJob with Action
ValidateAddress, then GetJob/ListJobs/CancelJob). It adds what Geocode lacks — a postal-authority verdict (ValidationGranularity, Mailable/Locatable, per-component StatusDetail), not just coordinates. Coverage is US, CA, UK, and AU only; for other countries use Geocode.
Maps (SDK: geo-maps, JS: @aws-sdk/client-geo-maps)
Dynamic Maps: Interactive maps using tiles with MapLibre rendering
Static Maps: Pre-rendered, non-interactive map images, good for including an image into a web page, or for thumbnail images
Routes (SDK: geo-routes, JS: @aws-sdk/client-geo-routes)
Route calculation with traffic and distance estimation
Service area/isoline creation
Matrix calculations for multiple origins/destinations
GPS trace alignment to road segments
Route optimization (traveling salesman problem)
Geofences & Trackers (SDK: location, JS: @aws-sdk/client-location)
Geofences: Detect entry/exit from geographical boundaries
Trackers: Current and historical device location tracking
API Keys (SDK: location, JS: @aws-sdk/client-location)
API Keys: Grant access to public applications without exposing AWS credentials
Common Mistakes
Avoid these frequent errors:
Using
Titleinstead ofAddress.Labelfor display: In Autocomplete results, always displayAddress.Label. TheTitlefield may show components in reverse order and is not suitable for user-facing text.Using GetStyleDescriptor API for map initialization: MUST use direct URL passing to MapLibre (
https://maps.geo.{region}.amazonaws.com/v2/styles/Standard/descriptor?key={apiKey}) instead of making GetStyleDescriptor API calls. The direct URL method is required for proper map rendering.Forgetting
validateStyle: falsein MapLibre config: Always setvalidateStyle: falsein the MapLibre Map constructor for faster map load times with Amazon Location styles.Mixing resource-based and resourceless operations: When possible, prefer resourceless operations (direct API calls without pre-created resources) for simpler deployment and permissions.
Inconsistent API operation naming: Use the format
service:Operationwhen referencing APIs (e.g.,geo-places:Geocode,geo-maps:GetStyleDescriptor). SDK clients use@aws-sdk/client-*format.Not handling nested Address objects correctly: The Address object from GetPlace contains nested objects (
Region.Code,Region.Name,Country.Code2, etc.), not flat strings. Access nested properties correctly.Wrong action names in API Key permissions: API key
AllowActionsusegeo-maps:,geo-places:,geo-routes:prefixes (e.g.,geo-places:Geocode,geo-routes:CalculateRoutes). Do NOT use SDK client names (@aws-sdk/client-geo-places) or IAM-style actions. See the Authentication and Permissions section for the complete list.
Defaults
Use these default choices unless the user explicitly requests otherwise:
JavaScript SDK: Bundled client (CDN) for browser-only apps; npm modular SDKs (@aws-sdk/client-geo-*) for React and build tool apps
API operations: Resourceless for Maps/Places/Routes (Geofencing/Tracking always require pre-created resources)
Authentication: API Key for Maps/Places/Routes; Cognito for Geofencing/Tracking
Map style: Standard
Coordinate format: [longitude, latitude] (GeoJSON order)
Override: User can specify "use Cognito for Maps/Places/Routes" or "use bundled client for React".
API Selection Guidance
Choose the right API for your use case:
Address Input (interactive forms)
Autocomplete → Type-ahead in address forms (partial input: "123 Main")
GetPlace → Get full details after user selects autocomplete result (by PlaceId)
Geocode → Resolve a complete user-typed address to coordinates. Returns coordinates, a matched label, and match quality (
MatchScoresoverall + per-component,AddressNumberCorrected) synchronously in one call — but no postal-deliverability verdict or standardized output.
Address Validation (verify & standardize)
StartJob (Action
ValidateAddress) → Verify and standardize addresses in bulk against authoritative postal data; async Jobs API with Parquet input/output in Amazon S3. Coverage: US, CA, UK, AU only; for other countries use Geocode.GetJob / ListJobs / CancelJob → Track, enumerate, and cancel validation jobs
Choose the Jobs API when you need a postal-authority verdict (ValidationGranularity, Mailable/Locatable, per-component StatusDetail) or bulk throughput. For a single ad-hoc check of whether one address resolves and how well it matched, the synchronous Geocode
MatchScoresis the right tool — do not stand up a job. See the address-verification reference.
Finding Locations
SearchText → General text search ("pizza near Seattle")
SearchNearby → Find places near a coordinate (restaurants within 5km)
Suggest → Predict places/POIs from partial or misspelled input
Autocomplete → Address-specific predictions (not for general POI search)
Geocoding
Geocode (Forward) → Address string → Coordinates
ReverseGeocode → Coordinates → Address
Maps
Dynamic Maps (tiles + MapLibre) → Interactive maps requiring pan, zoom, markers
Static Maps (image) → Non-interactive map images for thumbnails or email
Routing
CalculateRoutes → Single route between origin and destination
CalculateRouteMatrix → Multiple origins/destinations travel times
CalculateIsolines → Service areas (all locations reachable within time/distance)
LLM Context Files
When you need detailed API parameter specifications or service capabilities not covered in the reference files, fetch these llms.txt resources:
Developer Guide: https://docs.aws.amazon.com/location/latest/developerguide/llms.txt
API Reference: https://docs.aws.amazon.com/location/latest/APIReference/llms.txt
Key Guidance for Better Recommendations
Prefer the Bundled JavaScript Client for Web Development
For convenient web application development, Amazon Location Service provides a bundled JavaScript client that simplifies integration and provides optimized functionality without custom bundling. This bundled client includes all libraries required to build client side web applications with Amazon Location Service.
Features included in the bundled client:
Enables direct pre-bundled dependency inclusion without custom bundle / build
Simplified authentication and API integration
TypeScript support with comprehensive type definitions
Support for all Amazon Location SDKs
Included SDKs and Libraries:
@aws-sdk/client-geo-maps
@aws-sdk/client-geo-places
@aws-sdk/client-geo-routes
@aws-sdk/client-location
@aws-sdk/credential-providers
https://github.com/aws-geospatial/amazon-location-utilities-auth-helper-js
Resources:
NPM Package: @aws/amazon-location-client
GitHub Repository: aws-geospatial/amazon-location-client-js
Prefer Resourceless Operations
Amazon Location Places, Maps and Routes services offer both resource-based and resourceless API operations. Resourceless operations are often simpler and more appropriate for many use cases.
Resource-based operations require you to:
Create and configure Amazon Location Service resources (maps, place indexes, route calculators)
Manage resource lifecycle and permissions
Handle resource naming and organization
Resourceless operations allow you to:
Make API calls directly without pre-creating resources
Reduce deployment complexity
Simplify IAM permissions and API Key permissions
Authentication and Permissions
When discussing permissions for Amazon Location Places, Maps and Routes services, always include both IAM permissions and API Key permissions in your guidance. If the type of application being developed is clear, recommend the appropriate authorization tool as described below:
IAM Permissions - Recommended for server-side applications and AWS SDK usage:
Used with AWS credentials (access keys, roles, etc.)
Provide fine-grained access control
Required for resource management operations
API Key Permissions - Alternative authentication method, especially useful for client-side applications or applications deployed to unauthenticated (public) users:
Simplified authentication without exposing AWS credentials
Can be configured with specific allowed operations
Useful for web and mobile applications
Supports both resource-based and resourceless operations
Enables faster subsequent map loads through CDN caching
API Key Action Names - API keys use their own action naming convention. Do NOT use SDK client names or IAM action names — they will be rejected.
Resourceless API key actions (recommended):
| Service | AllowActions | AllowResources |
|---|---|---|
| Maps | geo-maps:GetTile, geo-maps:GetStaticMap | arn:aws:geo-maps:REGION::provider/default |
| Places | geo-places:Autocomplete, geo-places:Geocode, geo-places:ReverseGeocode, geo-places:SearchText, geo-places:SearchNearby, geo-places:Suggest, geo-places:GetPlace | arn:aws:geo-places:REGION::provider/default |
| Routes | geo-routes:CalculateRoutes, geo-routes:CalculateRouteMatrix, geo-routes:CalculateIsolines, geo-routes:OptimizeWaypoints, geo-routes:SnapToRoads | arn:aws:geo-routes:REGION::provider/default |
Do NOT use legacy geo: prefixed actions (e.g., geo:GetMap*, geo:CalculateRoute) — these are for pre-created resources only and will not work with resourceless APIs.
LocationClient Setup
Geofencing and Tracking use LocationClient (@aws-sdk/client-location). These are resource-based operations — you MUST create resources (trackers, geofence collections) before using them.
import { LocationClient } from "@aws-sdk/client-location";
// Server-side: uses IAM credentials from environment/role
const client = new LocationClient({ region: "us-east-1" });// Client-side: uses Amazon Cognito
import { LocationClient } from "@aws-sdk/client-location";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-providers";
const client = new LocationClient({
region: "us-east-1",
credentials: fromCognitoIdentityPool({
identityPoolId: "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
clientConfig: { region: "us-east-1" },
}),
});MCP Server Integration
Integrates with the AWS MCP Server (Apache-2.0 license) which provides access to AWS documentation, API references, and direct API interactions. See the Getting Started Guide for setup and credential configuration. To use a non-default region, add "--metadata", "AWS_REGION=<your-region>" to your MCP config args.
Additional Resources
Reference Files
Load these resources as needed for specific implementation guidance:
Address Input - Create effective address input forms for users with address type ahead completion improving input speed and accuracy
Address Verification - Verify and standardize addresses in bulk against authoritative postal data using the asynchronous Jobs API (StartJob with Action ValidateAddress), before persisting to databases or taking downstream actions
Calculate Routes - Calculate routes between locations with customizable travel options and display them on maps
Device Tracking - Track device locations in real time and query position history
Dynamic Map Rendering - Render dynamic maps with MapLibre
Google Maps Migration (Android) - Migrate Android application from Google Maps SDK for Android to Amazon Location Service
Google Maps Migration (iOS) - Migrate iOS application from Google Maps SDK for iOS to Amazon Location Service
Google Maps Migration (JavaScript) - Migrate JavaScript web application from Google Maps API to Amazon Location Service
Places Search - Search for places or points of interest
Web JavaScript - Integrate Amazon Location services into web browser applications
Zone Alerts - Monitor device positions against geographic boundaries and react to zone entry or exit
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer89 B
- SKILL.md15.5 KiB
- references/address-input.md10.1 KiB
- references/address-verification.md24.3 KiB
- references/calculate-routes.md41.5 KiB
- references/device-tracking.md13.4 KiB
- references/dynamic-map.md12.6 KiB
- references/google-migration-android.md25.4 KiB
- references/google-migration-ios.md27.0 KiB
- references/google-migration-web.md31.0 KiB
- references/places-search.md18.1 KiB
- references/web-javascript.md15.1 KiB
- references/zone-alerts.md13.1 KiB
references/google-migration-web.md
Google Maps Migration (JavaScript)
Audience Note: Keywords MUST, SHOULD, MAY in this document indicate requirements for agent recommendations to users, following RFC 2119.
Migrate JavaScript web applications from Google Maps API to Amazon Location Service with minimal code changes using the Migration SDK, or transition to native Amazon Location APIs for full feature access.
Table of Contents
Migration Strategy Overview
Phase 1: Migration SDK (Recommended First)
Phase 2: Native Amazon Location APIs
API Mappings Reference
Helper and Math Libraries
Migration Guides
Migration Strategy Overview
Amazon Location provides two migration paths for JavaScript applications:
Two-Phase Approach (Recommended)
Phase 1: Migration SDK Phase 2: Native APIs
┌────────────────────┐ ┌────────────────────┐
│ Drop-in replacement│ → │ Full feature access│
│ Minimal changes │ │ Direct AWS SDK │
│ Quick migration │ │ No google.maps │
└────────────────────┘ └────────────────────┘
Hours to Days Days to WeeksWhen to use each phase:
| Situation | Recommended Phase | Why |
|---|---|---|
| Need to migrate quickly | Phase 1 (SDK) | Hours instead of weeks - just change the script import |
| Using unsupported Google APIs | Phase 2 (Native) | SDK doesn't support all Google APIs (see limitations) |
| Want maximum performance | Phase 2 (Native) | No abstraction layer overhead |
| Building new application | Phase 2 (Native) | Start with native APIs from the beginning |
| Legacy codebase with complex Google Maps usage | Phase 1 → Phase 2 | Migrate incrementally - SDK first, then refactor |
Decision Flowchart
Are you migrating existing Google Maps code?
├─ Yes → Does Migration SDK support your Google APIs?
│ ├─ Yes → START with Phase 1 (Migration SDK)
│ │ Can transition to Phase 2 later for optimization
│ └─ No → Use Phase 2 (Native APIs)
│ SDK won't work - go directly to native
└─ No (new app) → Use Phase 2 (Native APIs)
Start with native APIs from the beginningPhase 1: Migration SDK (Recommended First)
The Amazon Location Migration SDK provides a drop-in replacement for Google Maps JavaScript API.
Key Benefits
Minimal code changes - Often just changing the script import
Keeps google.maps namespace - Existing code works as-is
Fast migration - Hours instead of weeks
Incremental transition - Migrate to native APIs later
Installation
Replace your Google Maps import with the Migration SDK:
Dynamic Library Import
Before (Google Maps):
<script>
(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",...
key: "YOUR_GOOGLE_API_KEY",
v: "weekly",
});
</script>After (Migration SDK):
<script src="https://cdn.jsdelivr.net/npm/@aws/amazon-location-migration-sdk/dist/amazonLocationMigrationSDK.min.js?region=us-west-2&apiKey=YOUR_AMAZON_LOCATION_API_KEY"></script>Legacy Script Tag
Before (Google Maps):
<script
async
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&callback=initMap&libraries=places"
></script>After (Migration SDK):
<script
async
src="https://cdn.jsdelivr.net/npm/@aws/amazon-location-migration-sdk/dist/amazonLocationMigrationSDK.min.js?callback=initMap®ion=us-west-2&apiKey=YOUR_AMAZON_LOCATION_API_KEY"
></script>NPM js-api-loader
Before (Google Maps):
import { Loader } from "@googlemaps/js-api-loader";
const loader = new Loader({
apiKey: "YOUR_GOOGLE_API_KEY",
version: "weekly",
});After (Migration SDK):
import { Loader } from "@aws/amazon-location-migration-sdk";
const loader = new Loader({
apiKey: "YOUR_AMAZON_LOCATION_API_KEY",
region: "us-west-2", // Optional, defaults to us-west-2
version: "weekly",
});Your Existing Code Works
The rest of your application code remains unchanged:
// This code works with BOTH Google Maps and Migration SDK
let map;
async function initMap() {
const { Map } = await google.maps.importLibrary("maps");
map = new Map(document.getElementById("map"), {
center: { lat: 30.268193, lng: -97.7457518 },
zoom: 8,
});
// Add marker
const { Marker } = await google.maps.importLibrary("marker");
new Marker({
position: { lat: 30.268193, lng: -97.7457518 },
map: map,
});
}
initMap();Migration SDK Supported APIs
The Migration SDK supports most commonly-used Google Maps APIs:
Core Library:
✅ Map, Marker, AdvancedMarkerElement
✅ InfoWindow, Circle, Polyline
✅ LatLng, LatLngBounds, Point, Size
✅ Event handling (event.addListener, etc.)
Places Library:
✅ PlacesService (textSearch, nearbySearch, getDetails, findPlaceFromQuery, findPlaceFromPhoneNumber)
✅ Autocomplete widget
✅ AutocompleteService (getPlacePredictions, getQueryPredictions)
✅ SearchBox widget
Routes Library:
✅ DirectionsService (route method)
✅ DirectionsRenderer
✅ DistanceMatrixService
⚠️ Travel modes: DRIVING, WALKING, TRANSIT (no BICYCLING)
Geocoding Library:
✅ Geocoder (geocode method for address → coordinates)
✅ Reverse geocoding (coordinates → address)
Geometry Library:
✅ encoding (encodePath, decodePath)
✅ poly (containsLocation, isLocationOnEdge)
✅ spherical (computeHeading, computeDistanceBetween, etc.)
Map Features:
✅ TrafficLayer
✅ TransitLayer
For the complete list with detailed limitations, see Migration SDK Supported APIs.
Migration SDK Limitations
Not supported by Migration SDK:
Bicycling routing - No BICYCLING travel mode (TRANSIT is supported)
Street View - Not available in Amazon Location
3D Maps - No Maps3D support
Elevation API - Not available in Amazon Location
Advanced geometry features - Some specialized APIs
KML/GeoRSS layers - Not supported
Data layer styling - No data-driven styling
If you need these features: Use Phase 2 (Native APIs) or check if Amazon Location provides alternative approaches.
When to Move to Phase 2
Consider transitioning from Migration SDK to native APIs when:
You need features not supported by the SDK
You want to optimize performance (remove abstraction layer)
You're refactoring your application architecture
You need access to new Amazon Location features before SDK update
Phase 2: Native Amazon Location APIs
Transition to native Amazon Location Service APIs for full control and feature access.
Overview
Phase 2 involves:
Replace google.maps imports with Amazon Location clients
Update API calls to use Amazon Location Service APIs
Replace helper libraries for client-side operations
Update authentication to use API Keys or Cognito
Authentication Setup
API Key (Recommended for Maps, Places, Routes):
// Import bundled client
<script src="https://cdn.jsdelivr.net/npm/@aws/amazon-location-client@1"></script>
<script>
const API_KEY = "YOUR_API_KEY";
const REGION = "us-west-2";
const authHelper = amazonLocationClient.withAPIKey(API_KEY, REGION);
</script>For detailed authentication patterns, see the Web JavaScript reference.
Client Usage Pattern
Every Amazon Location API call follows this pattern:
// 1. Create auth helper (once at app startup)
const authHelper = amazonLocationClient.withAPIKey(API_KEY, REGION);
// 2. Create service client
const client = new amazonLocationClient.GeoPlacesClient(
authHelper.getClientConfig(),
);
// 3. Create command with parameters
const command = new amazonLocationClient.places.GeocodeCommand({
QueryText: "123 Main St, Austin, TX",
});
// 4. Send command and await response
const response = await client.send(command);API Mappings Reference
Places API
| Google Maps API | Amazon Location API | Migration Notes |
|---|---|---|
PlacesService.textSearch() | SearchTextCommand | General text search for places |
PlacesService.nearbySearch() | SearchNearbyCommand | Proximity-based search |
PlacesService.getDetails() | GetPlaceCommand | Fetch details by PlaceId |
PlacesService.findPlaceFromQuery() | SearchTextCommand | Use SearchText with query |
PlacesService.findPlaceFromPhoneNumber() | Not directly supported | Use SearchText with phone as query text |
Autocomplete widget | AutocompleteCommand OR SuggestCommand | See note below on Autocomplete vs Suggest |
AutocompleteService.getPlacePredictions() | AutocompleteCommand OR SuggestCommand | Depends on use case (addresses vs places) |
SearchBox widget | SuggestCommand + SearchTextCommand | Place suggestions, then search |
Important: Autocomplete vs Suggest
Google Maps Autocomplete handles both addresses AND place names (e.g., "123 Main St" or "Starbucks"). Amazon Location splits this functionality into two separate APIs:
AutocompleteCommand- Address-specific predictions only (street addresses, postal codes)Use for: Address input forms, shipping addresses, location entry
Returns: Structured address components
Example: "123 Main St, Austin, TX" ✅, "Starbucks" ❌
SuggestCommand- Place and POI name predictions (businesses, landmarks, parks)Use for: Finding named places, business search, POI discovery
Returns: Place names with categories
Example: "Starbucks" ✅, "Central Park" ✅, "123 Main St" ❌
Migration decision:
If your Google Autocomplete is for address-only input (e.g., shipping forms) → Use
AutocompleteCommandIf your Google Autocomplete allows place/business names OR both addresses and places → Use
SuggestCommand
Note: SuggestCommand can return both place names and addresses, making it the closest equivalent to Google's Autocomplete behavior. Only use AutocompleteCommand if you specifically need address-only predictions
See Address Input reference for AutocompleteCommand patterns and Places Search reference for SuggestCommand patterns.
Example - Place Search:
// Google Maps (Phase 1 - Migration SDK)
const service = new google.maps.places.PlacesService(map);
service.textSearch(
{
query: "coffee shops in Austin",
location: new google.maps.LatLng(30.2747, -97.7431),
},
(results, status) => {
if (status === google.maps.places.PlacesServiceStatus.OK) {
results.forEach((place) => {
console.log(place.name, place.geometry.location);
});
}
},
);
// Amazon Location (Phase 2 - Native)
const placesClient = new amazonLocationClient.GeoPlacesClient(
authHelper.getClientConfig(),
);
const command = new amazonLocationClient.places.SearchTextCommand({
QueryText: "coffee shops in Austin",
BiasPosition: [-97.7431, 30.2747], // Note: [lng, lat]
MaxResults: 10,
});
const response = await placesClient.send(command);
response.ResultItems.forEach((place) => {
console.log(place.Title, place.Position); // [lng, lat]
});For detailed Places API usage, see Places Search reference.
Geocoding API
| Google Maps API | Amazon Location API | Migration Notes |
|---|---|---|
Geocoder.geocode({ address }) | GeocodeCommand | Address to coordinates |
Geocoder.geocode({ location }) | ReverseGeocodeCommand | Coordinates to address |
Geocoder.geocode({ placeId }) | GetPlaceCommand | Get place by ID |
Example - Geocoding:
// Google Maps (Phase 1 - Migration SDK)
const geocoder = new google.maps.Geocoder();
geocoder.geocode({ address: "Austin, TX" }, (results, status) => {
if (status === "OK") {
const location = results[0].geometry.location;
console.log(location.lat(), location.lng());
}
});
// Amazon Location (Phase 2 - Native)
const placesClient = new amazonLocationClient.GeoPlacesClient(
authHelper.getClientConfig(),
);
const command = new amazonLocationClient.places.GeocodeCommand({
QueryText: "Austin, TX",
MaxResults: 1,
});
const response = await placesClient.send(command);
const [lng, lat] = response.ResultItems[0].Position;
console.log(lat, lng);Directions/Routing API
| Google Maps API | Amazon Location API | Migration Notes |
|---|---|---|
DirectionsService.route() | CalculateRoutesCommand | Get route with turn-by-turn |
DistanceMatrixService.getDistanceMatrix() | CalculateRouteMatrixCommand | Many-to-many distance/time |
| N/A (no direct Google equivalent) | CalculateIsolinesCommand | Reachability areas (time/distance) |
Example - Directions:
// Google Maps (Phase 1 - Migration SDK)
const directionsService = new google.maps.DirectionsService();
directionsService.route(
{
origin: "Austin, TX",
destination: "Dallas, TX",
travelMode: google.maps.TravelMode.DRIVING,
},
(result, status) => {
if (status === "OK") {
console.log(result.routes[0].legs[0].distance);
}
},
);
// Amazon Location (Phase 2 - Native)
const routesClient = new amazonLocationClient.GeoRoutesClient(
authHelper.getClientConfig(),
);
const command = new amazonLocationClient.routes.CalculateRoutesCommand({
Origin: [-97.7431, 30.2747], // Austin [lng, lat]
Destination: [-96.797, 32.7767], // Dallas [lng, lat]
TravelMode: "Car",
LegGeometryFormat: "Simple", // Returns coordinate arrays for easy rendering
LegAdditionalFeatures: ["Summary"], // Required for distance/duration
});
const response = await routesClient.send(command);
const distance =
response.Routes[0].Legs[0].VehicleLegDetails.Summary.Overview.Distance;
console.log(distance); // metersRoute Geometry Formats:
Amazon Location returns route geometry in two formats via the LegGeometryFormat parameter:
Simple(recommended for migration) - Returns coordinate arrays[[lng, lat], ...]ready for MapLibre rendering, no decoder neededFlexiblePolyline- Returns encoded string, 5-10x smaller but requires decoding with@aws/polyline
For straightforward migration from Google Maps, set LegGeometryFormat: "Simple" explicitly. For bandwidth optimization in mobile apps or high-volume scenarios, see Choosing Route Geometry Formats in the Calculate Routes reference.
For detailed routing usage, see Calculate Routes reference.
Map Display
| Google Maps API | Amazon Location API | Migration Notes |
|---|---|---|
google.maps.Map | MapLibre GL JS + Amazon Location map styles | Use MapLibre with Amazon Location tile endpoints |
google.maps.Marker | maplibregl.Marker | MapLibre marker API |
google.maps.InfoWindow | maplibregl.Popup | MapLibre popup API |
google.maps.Polyline | MapLibre line layer | GeoJSON-based rendering |
google.maps.Circle | MapLibre circle layer | GeoJSON circle with Turf.js |
For detailed map integration, see Dynamic Map reference.
Helper and Math Libraries
Google Maps provides client-side geometry and math utilities. For Amazon Location, use these open-source alternatives:
Polyline Encoding/Decoding
| Google Maps API | Amazon Location Alternative | Package |
|---|---|---|
google.maps.geometry.encoding.encodePath(path) | encodeFromLngLatArray(lngLatArray) | @aws/polyline |
google.maps.geometry.encoding.decodePath(encoded) | decodeToLngLatArray(encoded) | @aws/polyline |
Example - Polyline Encoding:
// Phase 1 - Migration SDK: load via the SDK's Loader, then your existing
// google.maps.geometry calls keep working unchanged.
import { Loader } from "@aws/amazon-location-migration-sdk";
const loader = new Loader({
apiKey: "<amazon-location-api-key>",
region: "us-east-1",
});
const { encoding } = await loader.importLibrary("geometry");
const path = [
new google.maps.LatLng(30.2747, -97.7431),
new google.maps.LatLng(32.7767, -96.797),
];
const encoded = encoding.encodePath(path);
// Phase 2 - Native Amazon Location with @aws/polyline
import { encodeFromLngLatArray } from "@aws/polyline";
const lngLatArray = [
[-97.7431, 30.2747],
[-96.797, 32.7767],
];
const encodedNative = encodeFromLngLatArray(lngLatArray);Package installation:
npm install @aws/polylinePolygon and Geometry Operations
| Google Maps API | Amazon Location Alternative | Package |
|---|---|---|
google.maps.geometry.poly.containsLocation(point, polygon) | turf.booleanPointInPolygon(point, polygon) | @turf/turf |
google.maps.geometry.poly.isLocationOnEdge(point, poly, tolerance) | turf.pointToLineDistance() + turf.booleanPointOnLine() | @turf/turf |
google.maps.geometry.spherical.computeDistanceBetween(from, to) | turf.distance(from, to, { units: "meters" }) (Turf defaults to kilometers) | @turf/turf |
google.maps.geometry.spherical.computeHeading(from, to) | turf.bearing(from, to) | @turf/turf |
google.maps.geometry.spherical.computeOffset(from, distance, heading) | turf.destination(from, distance, bearing, { units: "meters" }) (Turf defaults to kilometers) | @turf/turf |
google.maps.geometry.spherical.computeArea(path) | turf.area(polygon) | @turf/turf |
google.maps.geometry.spherical.interpolate(from, to, fraction) | turf.along(line, turf.length(line) * fraction) (along takes an absolute distance, not a 0-1 fraction) | @turf/turf |
Example - Point in Polygon:
// Phase 1 - Migration SDK: load via the SDK's Loader, then your existing
// google.maps.geometry calls keep working unchanged.
import { Loader } from "@aws/amazon-location-migration-sdk";
const loader = new Loader({
apiKey: "<amazon-location-api-key>",
region: "us-east-1",
});
const { poly } = await loader.importLibrary("geometry");
const point = new google.maps.LatLng(30.2747, -97.7431);
const polygonPath = [
new google.maps.LatLng(30.0, -98.0),
new google.maps.LatLng(31.0, -98.0),
new google.maps.LatLng(31.0, -97.0),
new google.maps.LatLng(30.0, -97.0),
];
const polygon = new google.maps.Polygon({ paths: polygonPath });
const contains = poly.containsLocation(point, polygon);
// Phase 2 - Native Amazon Location with Turf.js
import * as turf from "@turf/turf";
const turfPoint = turf.point([-97.7431, 30.2747]); // [lng, lat]
const turfPolygon = turf.polygon([
[
[-98.0, 30.0],
[-98.0, 31.0],
[-97.0, 31.0],
[-97.0, 30.0],
[-98.0, 30.0], // Close the polygon
],
]);
const containsNative = turf.booleanPointInPolygon(turfPoint, turfPolygon);Example - Distance Between Points:
// Google Maps (Phase 1 - Migration SDK): spherical math via the loaded
// geometry library; existing google.maps.geometry calls keep working.
const { spherical } = await google.maps.importLibrary("geometry");
const from = new google.maps.LatLng(30.2747, -97.7431);
const to = new google.maps.LatLng(32.7767, -96.797);
const distanceMeters = spherical.computeDistanceBetween(from, to);
// Amazon Location (Phase 2 - Native with Turf.js)
import * as turf from "@turf/turf";
const fromPoint = turf.point([-97.7431, 30.2747]);
const toPoint = turf.point([-96.797, 32.7767]);
const distanceMetersNative = turf.distance(fromPoint, toPoint, { units: "meters" });Package installation:
npm install @turf/turfNote: The Migration SDK does not provide helper/math utilities of its own — it is a drop-in shim for the Google Maps API surface. In Phase 1, keep calling google.maps.geometry.* as before. When you move to native Amazon Location (Phase 2), use the underlying open-source packages (@aws/polyline, @turf/turf) directly.
Coordinate System Differences
Important: Google Maps uses [lat, lng] order, while Amazon Location and GeoJSON use [lng, lat] order.
// Google Maps (Phase 1)
const location = new google.maps.LatLng(30.2747, -97.7431); // lat, lng
console.log(location.lat(), location.lng()); // 30.2747, -97.7431
// Amazon Location (Phase 2)
const position = [-97.7431, 30.2747]; // lng, lat (GeoJSON standard)
console.log(position[1], position[0]); // 30.2747, -97.7431 (lat, lng)Always verify coordinate order when migrating:
Google Maps:
{ lat: 30.2747, lng: -97.7431 }Amazon Location:
[-97.7431, 30.2747](array) or{ longitude: -97.7431, latitude: 30.2747 }(object)
Migration Guides
Official AWS Migration Guides
Web Application Migration Guide - Step-by-step guide for web apps
Android Application Migration Guide - For Android/Kotlin apps
iOS Application Migration Guide - For iOS/Swift apps
Migration SDK Documentation
Migration SDK GitHub - Source code and examples
Supported Libraries - Complete API support matrix
NPM Package - Package documentation
Related Amazon Location References
For detailed usage of native Amazon Location APIs:
Web JavaScript - Authentication, client setup, error handling
Places Search - SearchText, SearchNearby, Suggest, GetPlace
Address Input - Autocomplete for address forms
Calculate Routes - Directions, route matrix, isolines
Dynamic Map - Map display with MapLibre GL JS
Common Migration Patterns
Migrating a Simple Map
Google Maps:
const map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 30.2747, lng: -97.7431 },
zoom: 10,
});
const marker = new google.maps.Marker({
position: { lat: 30.2747, lng: -97.7431 },
map: map,
title: "Austin",
});Phase 1 (Migration SDK): No code changes needed - just update the script import.
Phase 2 (Native with MapLibre):
// Add MapLibre GL JS
import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
// Get Amazon Location map style
const authHelper = amazonLocationClient.withAPIKey(API_KEY, REGION);
const mapStyleUrl = `https://maps.geo.${REGION}.amazonaws.com/v2/styles/Standard/descriptor?key=${API_KEY}`;
const map = new maplibregl.Map({
container: "map",
style: mapStyleUrl,
center: [-97.7431, 30.2747], // [lng, lat]
zoom: 10,
});
const marker = new maplibregl.Marker()
.setLngLat([-97.7431, 30.2747])
.setPopup(new maplibregl.Popup().setText("Austin"))
.addTo(map);Migrating Autocomplete
Google Maps:
const autocomplete = new google.maps.places.Autocomplete(inputElement);
autocomplete.addListener("place_changed", () => {
const place = autocomplete.getPlace();
console.log(place.geometry.location);
});Phase 1 (Migration SDK): No code changes needed.
Phase 2 (Native):
const placesClient = new amazonLocationClient.GeoPlacesClient(
authHelper.getClientConfig(),
);
let debounceTimer;
inputElement.addEventListener("input", async (e) => {
clearTimeout(debounceTimer);
debounceTimer = setTimeout(async () => {
const command = new amazonLocationClient.places.AutocompleteCommand({
QueryText: e.target.value,
MaxResults: 5,
});
const response = await placesClient.send(command);
displaySuggestions(response.ResultItems);
}, 300);
});
// When user selects a suggestion
async function onSuggestionSelected(placeId) {
const command = new amazonLocationClient.places.GetPlaceCommand({
PlaceId: placeId,
});
const response = await placesClient.send(command);
console.log(response.Position); // [lng, lat]
}See Address Input reference for complete autocomplete patterns.
Migrating Place Search
Google Maps:
const service = new google.maps.places.PlacesService(map);
service.nearbySearch(
{
location: { lat: 30.2747, lng: -97.7431 },
radius: 5000,
type: "restaurant",
},
(results, status) => {
if (status === google.maps.places.PlacesServiceStatus.OK) {
results.forEach((place) => {
addMarker(place);
});
}
},
);Phase 1 (Migration SDK): No code changes needed.
Phase 2 (Native):
const placesClient = new amazonLocationClient.GeoPlacesClient(
authHelper.getClientConfig(),
);
const command = new amazonLocationClient.places.SearchNearbyCommand({
QueryPosition: [-97.7431, 30.2747], // [lng, lat]
QueryRadius: 5000, // meters
Filter: {
IncludeCategories: ["restaurant"], // Use valid Category IDs
},
MaxResults: 20,
});
const response = await placesClient.send(command);
response.ResultItems.forEach((place) => {
addMarker(place);
});Category/Type Differences:
Google Maps and Amazon Location use different category systems:
Google Maps: Generic type strings (e.g.,
"restaurant","cafe","bank")Amazon Location: Specific Category IDs (e.g.,
"restaurant","coffee_shop","bank","fueling_station","hotel","grocery")
When migrating, verify category names match Amazon Location's supported Category IDs. See Place Categories Documentation for the complete list.
Best Practices
Phase 1 Best Practices
Start with Migration SDK - Fastest path to migration for most apps
Test thoroughly - SDK behavior may differ slightly from Google Maps
Check API support - Verify your Google APIs are supported before committing
Plan Phase 2 - Consider SDK as temporary bridge, not permanent solution
Phase 2 Best Practices
Coordinate order - Always verify [lng, lat] vs [lat, lng] when migrating
Authentication - Use API Keys for Maps/Places/Routes, Cognito for Geofencing/Tracking
Error handling - Implement proper try-catch and retry logic
Client reuse - Create clients once at app startup, reuse for all requests
Caching - Cache geocoding and search results (with appropriate TTLs)
Helper libraries - Use
@aws/polylinefor encoding,@turf/turffor geometry
Testing Your Migration
Create a comparison page during migration:
// Load both Google Maps and Migration SDK side-by-side
// Test identical operations and compare results
// Useful for validating behavior before full cutoverIncremental migration:
Start with Phase 1 (SDK) for quick win
Identify high-value areas for Phase 2 optimization
Migrate module by module, not all at once
Keep both implementations temporarily for A/B testing
Troubleshooting
Common Issues
Issue: Coordinates are backwards
Cause: Google uses [lat, lng], Amazon Location uses [lng, lat]
Fix: Swap coordinate order when migrating from Phase 1 to Phase 2
Issue: Autocomplete not working
Cause: Different API between Phase 1 and Phase 2
Fix: See Address Input reference for native implementation
Issue: Map not displaying
Cause: Missing MapLibre setup or incorrect map style URL
Fix: See Dynamic Map reference for complete setup
Issue: Places search returns no results
Cause: Query format or filter differences
Fix: Review Places Search reference for correct parameters
Issue: Routes not calculating
Cause: Coordinate order or travel mode not supported
Fix: Verify [lng, lat] order and use supported travel modes (Car, Pedestrian, Scooter, Truck)
Getting Help
Migration SDK Issues: GitHub Issues
Amazon Location Service: AWS Documentation
API Reference: Amazon Location API Reference
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs an API key
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- aws-geospatial
- Publisher
- AWS Labs (Official)
- Distributed by
- AWS Labs
- Source
- awslabs/agent-plugins · plugins/amazon-location-service/skills/amazon-location-service · commit fbefb37
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by aws-geospatial or AWS Labs.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download amazon-location-service.zip