LocationServicePlacesV2 / Client / suggest

suggest#

LocationServicePlacesV2.Client.suggest(**kwargs)#

The Suggest operation finds addresses or place candidates based on incomplete or misspelled queries. You then select the best query to submit based on the returned results.

See also: AWS API Documentation

Request Syntax

response = client.suggest(
    QueryText='string',
    MaxResults=123,
    MaxQueryRefinements=123,
    BiasPosition=[
        123.0,
    ],
    Filter={
        'BoundingBox': [
            123.0,
        ],
        'Circle': {
            'Center': [
                123.0,
            ],
            'Radius': 123
        },
        'IncludeCountries': [
            'string',
        ]
    },
    AdditionalFeatures=[
        'Core'|'TimeZone'|'Phonemes'|'Access',
    ],
    Language='string',
    PoliticalView='string',
    IntendedUse='SingleUse',
    Key='string'
)
Parameters:
  • QueryText (string) –

    [REQUIRED]

    The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.

  • MaxResults (integer) – An optional limit for the number of results returned in a single call.

  • MaxQueryRefinements (integer) – Maximum number of query terms to be returned for use with a search text query.

  • BiasPosition (list) –

    The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in [lng, lat] and in the WSG84 format.

    Note

    The fields BiasPosition, FilterBoundingBox, and FilterCircle are mutually exclusive.

    • (float) –

  • Filter (dict) –

    A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.

    • BoundingBox (list) –

      The bounding box enclosing the geometric shape (area or line) that an individual result covers.

      The bounding box formed is defined as a set 4 coordinates: [{westward lng}, {southern lat}, {eastward lng}, {northern lat}]

      • (float) –

    • Circle (dict) –

      The Circle that all results must be in.

      • Center (list) – [REQUIRED]

        The center position, in longitude and latitude, of the FilterCircle.

        • (float) –

      • Radius (integer) – [REQUIRED]

        The radius, in meters, of the FilterCircle.

    • IncludeCountries (list) –

      A list of countries that all results must be in. Countries are represented by either their alpha-2 or alpha-3 character codes.

      • (string) –

  • AdditionalFeatures (list) –

    A list of optional additional parameters, such as time zone, that can be requested for each result.

    • (string) –

  • Language (string) – A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

  • PoliticalView (string) – The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.

  • IntendedUse (string) – Indicates if the results will be stored. Defaults to SingleUse, if left empty.

  • Key (string) – Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

Return type:

dict

Returns:

Response Syntax

{
    'PricingBucket': 'string',
    'ResultItems': [
        {
            'Title': 'string',
            'SuggestResultItemType': 'Place'|'Query',
            'Place': {
                'PlaceId': 'string',
                'PlaceType': 'Country'|'Region'|'SubRegion'|'Locality'|'District'|'SubDistrict'|'PostalCode'|'Block'|'SubBlock'|'Intersection'|'Street'|'PointOfInterest'|'PointAddress'|'InterpolatedAddress',
                'Address': {
                    'Label': 'string',
                    'Country': {
                        'Code2': 'string',
                        'Code3': 'string',
                        'Name': 'string'
                    },
                    'Region': {
                        'Code': 'string',
                        'Name': 'string'
                    },
                    'SubRegion': {
                        'Code': 'string',
                        'Name': 'string'
                    },
                    'Locality': 'string',
                    'District': 'string',
                    'SubDistrict': 'string',
                    'PostalCode': 'string',
                    'Block': 'string',
                    'SubBlock': 'string',
                    'Intersection': [
                        'string',
                    ],
                    'Street': 'string',
                    'StreetComponents': [
                        {
                            'BaseName': 'string',
                            'Type': 'string',
                            'TypePlacement': 'BeforeBaseName'|'AfterBaseName',
                            'TypeSeparator': 'string',
                            'Prefix': 'string',
                            'Suffix': 'string',
                            'Direction': 'string',
                            'Language': 'string'
                        },
                    ],
                    'AddressNumber': 'string',
                    'Building': 'string'
                },
                'Position': [
                    123.0,
                ],
                'Distance': 123,
                'MapView': [
                    123.0,
                ],
                'Categories': [
                    {
                        'Id': 'string',
                        'Name': 'string',
                        'LocalizedName': 'string',
                        'Primary': True|False
                    },
                ],
                'FoodTypes': [
                    {
                        'LocalizedName': 'string',
                        'Id': 'string',
                        'Primary': True|False
                    },
                ],
                'BusinessChains': [
                    {
                        'Name': 'string',
                        'Id': 'string'
                    },
                ],
                'AccessPoints': [
                    {
                        'Position': [
                            123.0,
                        ]
                    },
                ],
                'AccessRestrictions': [
                    {
                        'Restricted': True|False,
                        'Categories': [
                            {
                                'Id': 'string',
                                'Name': 'string',
                                'LocalizedName': 'string',
                                'Primary': True|False
                            },
                        ]
                    },
                ],
                'TimeZone': {
                    'Name': 'string',
                    'Offset': 'string',
                    'OffsetSeconds': 123
                },
                'PoliticalView': 'string',
                'Phonemes': {
                    'Title': [
                        {
                            'Value': 'string',
                            'Language': 'string',
                            'Preferred': True|False
                        },
                    ],
                    'Address': {
                        'Country': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'Region': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'SubRegion': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'Locality': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'District': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'SubDistrict': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'Block': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'SubBlock': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ],
                        'Street': [
                            {
                                'Value': 'string',
                                'Language': 'string',
                                'Preferred': True|False
                            },
                        ]
                    }
                }
            },
            'Query': {
                'QueryId': 'string',
                'QueryType': 'Category'|'BusinessChain'
            },
            'Highlights': {
                'Title': [
                    {
                        'StartIndex': 123,
                        'EndIndex': 123,
                        'Value': 'string'
                    },
                ],
                'Address': {
                    'Label': [
                        {
                            'StartIndex': 123,
                            'EndIndex': 123,
                            'Value': 'string'
                        },
                    ]
                }
            }
        },
    ],
    'QueryRefinements': [
        {
            'RefinedTerm': 'string',
            'OriginalTerm': 'string',
            'StartIndex': 123,
            'EndIndex': 123
        },
    ]
}

Response Structure

  • (dict) –

    • PricingBucket (string) –

      The pricing bucket for which the query is charged at.

      For more inforamtion on pricing, please visit Amazon Location Service Pricing.

    • ResultItems (list) –

      List of places or results returned for a query.

      • (dict) –

        The resulting item from the suggested query.

        • Title (string) –

          The display title that should be used when presenting this option to the end user.

        • SuggestResultItemType (string) –

          The result type. Place results represent the final result for a point of interest, Query results represent a follow up query which can be completed through the SearchText operation.

        • Place (dict) –

          The suggested place by its unique ID.

          • PlaceId (string) –

            The PlaceId of the place you wish to receive the information for.

          • PlaceType (string) –

            A PlaceType is a category that the result place must belong to.

          • Address (dict) –

            The place’s address.

            • Label (string) –

              Assembled address value built out of the address components, according to the regional postal rules. This is the correctly formatted address.

            • Country (dict) –

              The country component of the address.

              • Code2 (string) –

                Country, represented by its alpha 2-character code.

              • Code3 (string) –

                Country, represented by its alpha t-character code.

              • Name (string) –

                Name of the country.

            • Region (dict) –

              The region or state results should be present in.

              Example: North Rhine-Westphalia.

              • Code (string) –

                Abbreviated code for a the state, province or region of the country.

                Example: BC.

              • Name (string) –

                Name for a the state, province, or region of the country.

                Example: British Columbia.

            • SubRegion (dict) –

              The sub-region or county for which results should be present in.

              • Code (string) –

                Abbreviated code for the county or sub-region.

              • Name (string) –

                Name for the county or sub-region.

            • Locality (string) –

              The locality or city of the address.

              Example: Vancouver.

            • District (string) –

              The district or division of a locality associated with this address.

            • SubDistrict (string) –

              A subdivision of a district.

              Example: Minden-Lübbecke.

            • PostalCode (string) –

              An alphanumeric string included in a postal address to facilitate mail sorting, such as post code, postcode, or ZIP code, for which the result should posses.

            • Block (string) –

              Name of the block.

              Example: Sunny Mansion 203 block: 2 Chome

            • SubBlock (string) –

              Name of sub-block.

              Example: Sunny Mansion 203 sub-block: 4

            • Intersection (list) –

              Name of the streets in the intersection.

              Example: ["Friedrichstraße","Unter den Linden"]

              • (string) –

            • Street (string) –

              The name of the street results should be present in.

            • StreetComponents (list) –

              Components of the street.

              Example: Younge from the “Younge street”.

              • (dict) –

                Components of a street.

                • BaseName (string) –

                  Base name part of the street name.

                  Example: Younge from the “Younge street”.

                • Type (string) –

                  Street type part of the street name.

                  Example: “avenue".

                • TypePlacement (string) –

                  Defines if the street type is before or after the base name.

                • TypeSeparator (string) –

                  What character(s) separates the string from its type.

                • Prefix (string) –

                  A prefix is a directional identifier that precedes, but is not included in, the base name of a road.

                  Example: E for East.

                • Suffix (string) –

                  A suffix is a directional identifier that follows, but is not included in, the base name of a road.

                  Example W for West.

                • Direction (string) –

                  Indicates the official directional identifiers assigned to highways.

                • Language (string) –

                  A BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

            • AddressNumber (string) –

              The number that identifies an address within a street.

            • Building (string) –

              The name of the building at the address.

          • Position (list) –

            The position, in longitude and latitude.

            • (float) –

          • Distance (integer) –

            The distance in meters from the QueryPosition.

          • MapView (list) –

            The bounding box enclosing the geometric shape (area or line) that an individual result covers.

            The bounding box formed is defined as a set 4 coordinates: [{westward lng}, {southern lat}, {eastward lng}, {northern lat}]

            • (float) –

          • Categories (list) –

            Categories of results that results must belong to.

            • (dict) –

              Category of the Place returned.

              • Id (string) –

                The category ID.

              • Name (string) –

                The category name.

              • LocalizedName (string) –

                Localized name of the category type.

              • Primary (boolean) –

                Boolean which indicates if this category is the primary offered by the place.

          • FoodTypes (list) –

            List of food types offered by this result.

            • (dict) –

              List of Food types offered by this result.

              • LocalizedName (string) –

                Localized name of the food type.

              • Id (string) –

                The Food Type Id.

              • Primary (boolean) –

                Boolean which indicates if this food type is the primary offered by the place. For example, if a location serves fast food, but also dessert, he primary would likely be fast food.

          • BusinessChains (list) –

            The Business Chains associated with the place.

            • (dict) –

              A businesschain is a chain of businesses that belong to the same brand. For example 7-11.

              • Name (string) –

                The business chain name.

              • Id (string) –

                The Business Chain Id.

          • AccessPoints (list) –

            Position of the access point represent by longitude and latitude.

            • (dict) –

              Position of the access point represented by longitude and latitude for a vehicle.

              • Position (list) –

                The position, in longitude and latitude.

                • (float) –

          • AccessRestrictions (list) –

            Indicates known access restrictions on a vehicle access point. The index correlates to an access point and indicates if access through this point has some form of restriction.

            • (dict) –

              Indicates if the access location is restricted. Index correlates to that of an access point and indicates if access through this point has some form of restriction.

              • Restricted (boolean) –

                The restriction.

              • Categories (list) –

                Categories of results that results must belong too.

                • (dict) –

                  Category of the Place returned.

                  • Id (string) –

                    The category ID.

                  • Name (string) –

                    The category name.

                  • LocalizedName (string) –

                    Localized name of the category type.

                  • Primary (boolean) –

                    Boolean which indicates if this category is the primary offered by the place.

          • TimeZone (dict) –

            The time zone in which the place is located.

            • Name (string) –

              The time zone name.

            • Offset (string) –

              Time zone offset of the timezone from UTC.

            • OffsetSeconds (integer) –

              The offset of the time zone from UTC, in seconds.

          • PoliticalView (string) –

            The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.

          • Phonemes (dict) –

            How the various components of the result’s address are pronounced in various languages.

            • Title (list) –

              List of PhonemeTranscription. See PhonemeTranscription for fields.

              • (dict) –

                How to pronounce the various components of the address or place.

                • Value (string) –

                  Value which indicates how to pronounce the value.

                • Language (string) –

                  A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                • Preferred (boolean) –

                  Boolean which indicates if it the preferred pronunciation.

            • Address (dict) –

              How to pronounce the address.

              • Country (list) –

                The alpha-2 or alpha-3 character code for the country that the results will be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • Region (list) –

                How to pronounce the region or state results should be to be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • SubRegion (list) –

                How to pronounce the sub-region or county for which results should be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • Locality (list) –

                How to pronounce the city or locality results should be present in.

                Example: Vancouver.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • District (list) –

                How to pronounce the district or division of a city results should be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • SubDistrict (list) –

                How to pronounce the sub-district or division of a city results should be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • Block (list) –

                How to pronounce the name of the block.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • SubBlock (list) –

                How to pronounce the name of the sub-block.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

              • Street (list) –

                How to pronounce the name of the street results should be present in.

                • (dict) –

                  How to pronounce the various components of the address or place.

                  • Value (string) –

                    Value which indicates how to pronounce the value.

                  • Language (string) –

                    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

                  • Preferred (boolean) –

                    Boolean which indicates if it the preferred pronunciation.

        • Query (dict) –

          The suggested query results.

          • QueryId (string) –

            QueryId can be used to complete a follow up query through the SearchText API. The QueryId retains context from the original Suggest request such as filters, political view and language. See the SearchText API documentation for more details SearchText API docs.

          • QueryType (string) –

            The query type. Category qeuries will search for places which have an entry matching the given category, for example “doctor office”. BusinessChain queries will search for instances of a given business.

        • Highlights (dict) –

          Describes how the parts of the response element matched the input query by returning the sections of the response which matched to input query terms.

          • Title (list) –

            Indicates the starting and ending index of the title in the text query that match the found title.

            • (dict) –

              Describes how parts of the result response match the input query.

              • StartIndex (integer) –

                Start index of the highlight.

              • EndIndex (integer) –

                End index of the highlight.

              • Value (string) –

                The highlight’s value.

          • Address (dict) –

            The place’s address.

            • Label (list) –

              Indicates the starting and ending indexes of the places in the result which were identified to match the textQuery. This result is useful for providing emphasis to results where the user query directly matched to make selecting the correct result from a list easier for an end user.

              • (dict) –

                Describes how parts of the result response match the input query.

                • StartIndex (integer) –

                  Start index of the highlight.

                • EndIndex (integer) –

                  End index of the highlight.

                • Value (string) –

                  The highlight’s value.

    • QueryRefinements (list) –

      Maximum number of query terms to be returned for use with a search text query.

      • (dict) –

        Suggestions for refining individual query terms. Suggestions are returned as objects which note the term, suggested replacement, and its index in the query.

        • RefinedTerm (string) –

          The term that will be suggested to the user.

        • OriginalTerm (string) –

          The sub-string of the original query that is replaced by this query term.

        • StartIndex (integer) –

          Start index of the parsed component.

        • EndIndex (integer) –

          End index of the parsed query.

Exceptions

  • LocationServicePlacesV2.Client.exceptions.InternalServerException

  • LocationServicePlacesV2.Client.exceptions.AccessDeniedException

  • LocationServicePlacesV2.Client.exceptions.ValidationException

  • LocationServicePlacesV2.Client.exceptions.ThrottlingException