Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Come geocodificare usando i filtri
L'API Geocode consente di utilizzare i filtri per ottenere i risultati desiderati.
Potenziale utilizzo
Utilizza i filtri per limitare i risultati in base alle esigenze aziendali.
Esempi
Specificate un valore IncludeCountries
per restituire i valori per quel paese nei risultati.
- Sample request
-
IncludeCountries": ["USA"]
In caso contrario, l'API Geocode restituirà Vancouver, BC, Canada.
{
"QueryText": "Vancouver",
"Filter" : {
"IncludeCountries": ["USA"]
}
}
- Sample response
-
{
"ResultItems": [
{
"PlaceId": "<Redacted>",
"PlaceType": "Locality",
"Title": "Vancouver, WA, United States",
"Address": {
"Label": "Vancouver, WA, United States",
"Country": {
"Code2": "US",
"Code3": "USA",
"Name": "United States"
},
"Region": {
"Code": "WA",
"Name": "Washington"
},
"SubRegion": {
"Name": "Clark"
},
"Locality": "Vancouver",
"PostalCode": "98660"
},
"Position": [
-122.67156,
45.63248
],
"MapView": [
-122.77466,
45.57714,
-122.46451,
45.69803
],
"MatchScores": {
"Overall": 1,
"Components": {
"Address": {
"Locality": 1
}
}
}
}
]
}
- cURL
-
curl --request POST \
--url 'https://places.geo.eu-central-1.amazonaws.com/v2/geocode?key=Your_Key' \
--header 'Content-Type: application/json' \
--data '{
"QueryText": "Vancouver",
"Filter" : {
"IncludeCountries": ["USA"]
}
}'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "Vancouver" --filter '{"IncludeCountries": ["USA"]}'
Specificate un valore IncludePlaceTypes
per restituire i valori per quella posizione nei risultati.
- Sample request
-
IncludePlaceTypes": ["Street"]
In caso contrario, l'API Geocode restituirà la Georgia, un paese. È possibile affinare ulteriormente i risultati aggiungendoli "IncludeCountries"
con i valori di CAN e USA e confrontare i risultati.
{
"QueryText": "Georgia",
"Filter" : {
"IncludePlaceTypes": ["Street"]
}
}
- Sample response
-
{
"ResultItems": [
{
"PlaceId": "<Redacted>",
"PlaceType": "Street",
"Title": "Georgia, Benito Juárez, CDMX, México",
"Address": {
"Label": "Georgia, Benito Juárez, CDMX, México",
"Country": {
"Code2": "MX",
"Code3": "MEX",
"Name": "México"
},
"Region": {
"Code": "CDMX",
"Name": "Ciudad de México"
},
"SubRegion": {
"Name": "Ciudad de México"
},
"Locality": "Benito Juárez",
"Street": "Georgia",
"StreetComponents": [
{
"BaseName": "Georgia",
"Language": "es"
}
]
},
"Position": [
-99.17754,
19.38887
],
"MapView": [
-99.18133,
19.38755,
-99.17374,
19.39016
],
"MatchScores": {
"Overall": 1,
"Components": {
"Address": {
"Intersection": [
1
]
}
}
}
}
]
}
- cURL
-
curl --request POST \
--url 'https://places.geo.eu-central-1.amazonaws.com/v2/geocode?key=Your_Key' \
--header 'Content-Type: application/json' \
--data '{
"QueryText": "Georgia",
"Filter" : {
"IncludePlaceTypes": ["Street"]
}
}'
- AWS CLI
-
aws geo-places geocode --key ${YourKey} --query-text "Georgia" --filter '{"IncludePlaceTypes": ["Street"]}'
Suggerimenti per gli sviluppatori
Per la geocodifica degli indirizzi, prova a utilizzare indirizzi completi o un componente di interrogazione con una combinazione di posizione di polarizzazione, inclusi paese e località. Per ulteriori informazioni, consulta Come geocodificare un indirizzo.