Amazon Location Service Connector

The Amazon Location Service Connector provides geolocation services powered by Amazon Location Service, including place search and static map generation.


Operations


searchPlaceByText

Searches for places matching a text query, with optional bias toward a geographic location.

Parameters

ParameterTypeRequiredDefaultDescription
querystringYes-The search text (e.g., "coffee shop", "123 Main Street")
latitudenumberYes-Latitude for location bias
longitudenumberYes-Longitude for location bias
maxResultsnumberNo5Maximum number of results to return
generateMapImagesbooleanNofalseWhether to generate static map images for each result

Response Structure

Each result item includes:

FieldTypeDescription
TitlestringName of the place
Positionarray[longitude, latitude] coordinates
Address.LabelstringFull formatted address
Address.AddressNumberstringStreet number
Address.StreetstringStreet name
Address.LocalitystringCity or municipality
Address.DistrictstringNeighborhood or district
Address.RegionobjectState or region information
Address.CountryobjectCountry information
Address.PostalCodestringPostal/ZIP code
PlaceobjectNormalized place data (see below)
mapImageUrlstringStatic map image URL (if generateMapImages is true)

Examples

// Basic place search
{
    "query": "Starbucks",
    "latitude": 37.7749,
    "longitude": -122.4194,
    "maxResults": 3
}

// Output
{
  "result": [
    {
      "Title": "Starbucks",
      "Position": [-122.4089, 37.7855],
      "Address": {
        "Label": "789 Mission St, San Francisco, CA 94103, USA",
        "AddressNumber": "789",
        "Street": "Mission St",
        "Locality": "San Francisco",
        "Region": { "Name": "California" },
        "Country": { "Name": "United States" },
        "PostalCode": "94103"
      }
    }
  ]
}
// Search with map image generation
{
    "query": "Golden Gate Bridge",
    "latitude": 37.7749,
    "longitude": -122.4194,
    "maxResults": 1,
    "generateMapImages": true
}

// Output
{
  "result": [
    {
      "Title": "Golden Gate Bridge",
      "Position": [-122.4783, 37.8199],
      "Address": {
        "Label": "Golden Gate Bridge, San Francisco, CA, USA"
      },
      "mapImageUrl": "https://cdn.example.com/static-maps/abc123-def456.jpg"
    }
  ]
}
// Address search
{
    "query": "1600 Pennsylvania Avenue NW, Washington DC",
    "latitude": 38.8977,
    "longitude": -77.0365,
    "maxResults": 1
}

// Output
{
  "result": [
    {
      "Title": "1600 Pennsylvania Avenue NW",
      "Position": [-77.0365, 38.8977],
      "Address": {
        "Label": "1600 Pennsylvania Avenue NW, Washington, DC 20500, USA",
        "AddressNumber": "1600",
        "Street": "Pennsylvania Avenue NW",
        "Locality": "Washington",
        "Region": { "Name": "District of Columbia" },
        "Country": { "Name": "United States" },
        "PostalCode": "20500"
      }
    }
  ]
}

Using with Context Variables

{
    "query": "{{context.parameters.searchQuery}}",
    "latitude": "{{context.parameters.userLatitude}}",
    "longitude": "{{context.parameters.userLongitude}}",
    "maxResults": 5,
    "generateMapImages": true
}

Static Map Generation

When generateMapImages is set to true, the connector:

  1. Generates a 400x400 pixel static map image for each result
  2. Centers the map on the place's coordinates at zoom level 16
  3. Adds a red marker with the place's title as a label
  4. Uploads the image to S3 with a 7-day expiration
  5. Returns the CDN URL in the mapImageUrl field

Map Image Specifications:

PropertyValue
Dimensions400 x 400 pixels
FormatJPEG
Map StyleStandard
Zoom Level16
Marker ColorRed (#EE4B2B)
Marker SizeLarge
Text ColorWhite (#FFFFFF)
Expiration7 days

Error Handling

Error ConditionBehavior
Invalid coordinatesAWS SDK throws validation error
No results foundReturns empty array []
Map generation failsResult returned without mapImageUrl field
Unsupported operationThrows Operation '{name}' not supported

Usage Examples

Finding Nearby Restaurants

{
    "query": "Italian restaurant",
    "latitude": 40.7128,
    "longitude": -74.0060,
    "maxResults": 5
}

Generating Location Cards with Maps

{
    "query": "{{context.userMessage}}",
    "latitude": "{{context.session.location.latitude}}",
    "longitude": "{{context.session.location.longitude}}",
    "maxResults": 3,
    "generateMapImages": true
}

The results can then be used to generate rich location cards with embedded map images.