geocode
¶
geocode(
*,
config_overrides: Optional[GeoPlacesClientConfig] = None,
query_text: Optional[SensitiveString] = None,
query_components: Optional[GeocodeQueryComponents] = None,
max_results: Optional[int] = None,
bias_position: Optional[Position] = None,
filter: Optional[GeocodeFilter] = None,
additional_features: Optional[GeocodeAdditionalFeatureList] = None,
language: Optional[LanguageTag] = None,
political_view: Optional[CountryCode] = None,
intended_use: Optional[GeocodeIntendedUse] = None,
key: Optional[ApiKey] = None,
postal_code_mode: Optional[PostalCodeMode] = None,
address_translations: Optional[AddressTranslationComponentList] = None,
address_names_mode: Optional[GeocodeAddressNamesMode] = None,
) -> GeocodeResponse
Geocode converts a textual address or place into geographic coordinates. You can obtain geographic coordinates, address component, and other related information. It supports flexible queries, including free-form text or structured queries with components like street names, postal codes, and regions. The Geocode API can also provide additional features such as time zone information and the inclusion of political views. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.
For more information, see Geocode in the Amazon Location Service Developer Guide.
Parameters:
-
query_text(Optional[SensitiveString], default:None) –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.
-
max_results(Optional[int], default:None) –An optional limit for the number of results returned in a single call.
Default value: 20
-
bias_position(Optional[Position], default:None) –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 WGS 84 format. -
filter(Optional[GeocodeFilter], default:None) –A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.
-
additional_features(Optional[GeocodeAdditionalFeatureList], default:None) –A list of optional additional parameters, such as time zone, that can be requested for each result.
-
language(Optional[LanguageTag], default:None) –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.
-
political_view(Optional[CountryCode], default:None) –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.
-
intended_use(Optional[GeocodeIntendedUse], default:None) –Indicates if the query results will be persisted in customer infrastructure. Defaults to
SingleUse(not stored). Not supported inap-southeast-1andap-southeast-5regions for GrabMaps customers.When storing
Geocoderesponses, you must set this field toStorageto comply with the terms of service. These requests will be charged at a higher rate. Please review the user agreement and service pricing structure to determine the correct setting for your use case. -
key(Optional[ApiKey], default:None) –Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
-
postal_code_mode(Optional[PostalCodeMode], default:None) –The
PostalCodeModeaffects how postal code results are returned. If a postal code spans multiple localities and this value is empty, partial district or locality information may be returned under a single postal code result entry. If it's populated with the valueEnumerateSpannedLocalities, all cities in that postal code are returned. If it's populated with the valueEnumerateSpannedDistricts, all combinations of the postal code with the corresponding district and city names are returned. -
address_translations(Optional[AddressTranslationComponentList], default:None) –Specifies which address components to include translations for. Translations include all name variants and alternative names for the requested fields in all available languages. Valid values are
District,Locality,Region, andSubRegion. -
address_names_mode(Optional[GeocodeAddressNamesMode], default:None) –Specifies how address names are returned. If not set, the service returns normalized (official) names by default. When set to
Matched, address names in the response are based on the input query rather than official names. When set toAdministrative, the service returns the official administrative names for address components.Administrativecurrently applies only to addresses in the United States.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this action.
-
InternalServerException–The request processing has failed because of an unknown error, exception or failure.
-
ThrottlingException–The request was denied due to request throttling.
-
ValidationException–The input fails to satisfy the constraints specified by an AWS service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_geo_places/_services/geo_places.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |