Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Cara membuat geokode alamat
Geocode API memungkinkan Anda untuk membuat geokode alamat titik tertentu, alamat yang diinterpolasi, atau jalan. Respons API berisi informasi lokasi, termasuk koordinat geografis dan skor kecocokan yang saya tentukan seberapa akurat hasilnya selaras dengan kueri.
Kasus penggunaan potensial
-
Database alamat bersih: Tingkatkan kualitas data dengan mengidentifikasi dan memperbaiki kesalahan dalam catatan alamat.
-
Menormalkan dan menstandarisasi alamat: Pastikan pemformatan alamat yang konsisten di seluruh kumpulan data untuk meningkatkan interoperabilitas data.
-
Perkaya alamat dengan informasi tambahan: Tambahkan koordinat geografis dan detail relevan lainnya untuk menangani catatan guna mendukung analisis dan wawasan berbasis lokasi.
Contoh
- Sample request
-
{ "QueryText": "510 W Georgia St, Vancouver, BC" }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada", "Address": { "Label": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada", "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" }, "Region": { "Code": "BC", "Name": "British Columbia" }, "SubRegion": { "Name": "Metro Vancouver" }, "Locality": "Vancouver", "District": "Downtown Vancouver", "PostalCode": "V6B 0M3", "Street": "W Georgia St", "StreetComponents": [ { "BaseName": "Georgia", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Prefix": "W", "Language": "en" } ], "AddressNumber": "510" }, "Position": [ -123.11694, 49.28126 ], "MapView": [ -123.11832, 49.28036, -123.11556, 49.28216 ], "AccessPoints": [ { "Position": [ -123.11656, 49.28151 ] } ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Region": 1, "Locality": 1, "Intersection": [ 1 ], "AddressNumber": 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": "510 W Georgia St, Vancouver, BC"}'
- AWS CLI
-
aws geo-places geocode --key ${
YourAPIKey
} --query-text "510 W Georgia St, Vancouver, BC"
- Sample request
-
{ "QueryComponents": { "AddressNumber": "510", "Locality": "Vancouver", "Region": "BC", "Country": "Canada", "Street": "Georgia" } }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada", "Address": { "Label": "510 W Georgia St, Vancouver, BC V6B 0M3, Canada", "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" }, "Region": { "Code": "BC", "Name": "British Columbia" }, "SubRegion": { "Name": "Metro Vancouver" }, "Locality": "Vancouver", "District": "Downtown Vancouver", "PostalCode": "V6B 0M3", "Street": "W Georgia St", "StreetComponents": [ { "BaseName": "Georgia", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Prefix": "W", "Language": "en" } ], "AddressNumber": "510" }, "Position": [ -123.11694, 49.28126 ], "MapView": [ -123.11832, 49.28036, -123.11556, 49.28216 ], "AccessPoints": [ { "Position": [ -123.11656, 49.28151 ] } ], "MatchScores": { "Overall": 0.99, "Components": { "Address": { "Country": 1, "Region": 1, "Locality": 1, "Intersection": [ 0.78 ], "AddressNumber": 1 } } } }, { "PlaceId": "<Redacted>", "PlaceType": "InterpolatedAddress", "Title": "510 E Georgia St, Vancouver, BC V6A 1Z9, Canada", "Address": { "Label": "510 E Georgia St, Vancouver, BC V6A 1Z9, Canada", "Country": { "Code2": "CA", "Code3": "CAN", "Name": "Canada" }, "Region": { "Code": "BC", "Name": "British Columbia" }, "SubRegion": { "Name": "Metro Vancouver" }, "Locality": "Vancouver", "District": "Strathcona", "PostalCode": "V6A 1Z9", "Street": "E Georgia St", "StreetComponents": [ { "BaseName": "Georgia", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Prefix": "E", "Language": "en" } ], "AddressNumber": "510" }, "Position": [ -123.0932, 49.27829 ], "MapView": [ -123.09458, 49.27739, -123.09182, 49.27919 ], "AccessPoints": [ { "Position": [ -123.0932, 49.27842 ] } ], "MatchScores": { "Overall": 0.99, "Components": { "Address": { "Country": 1, "Region": 1, "Locality": 1, "Intersection": [ 0.78 ], "AddressNumber": 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 '{"QueryComponents": {"AddressNumber": "510", "Locality": "Vancouver", "Region": "BC", "Country": "Canada", "Street": "Georgia"}}'
- AWS CLI
-
./aws geo-places geocode --key ${
YourAPIKey
} --query-components '{ "AddressNumber" : "510", "Locality": "vancouver", "Region": "BC", "Country": "Canada", "Street": "Georgia"}'
- Sample request
-
{ "QueryText": "W. 6th St", "QueryComponents": { "AddressNumber": "415", "Locality": "Vancouver" } }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "415 W 6th St, Vancouver, WA 98660-3375, United States", "Address": { "Label": "415 W 6th St, Vancouver, WA 98660-3375, United States", "Country": { "Code2": "US", "Code3": "USA", "Name": "United States" }, "Region": { "Code": "WA", "Name": "Washington" }, "SubRegion": { "Name": "Clark" }, "Locality": "Vancouver", "District": "Esther Short", "PostalCode": "98660-3375", "Street": "W 6th St", "StreetComponents": [ { "BaseName": "6th", "Type": "St", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Prefix": "W", "Language": "en" } ], "AddressNumber": "415" }, "Position": [ -122.67543, 45.62527 ], "MapView": [ -122.67672, 45.62437, -122.67414, 45.62617 ], "AccessPoints": [ { "Position": [ -122.67543, 45.62506 ] } ], "MatchScores": { "Overall": 1, "Components": { "Address": { "Locality": 1, "Intersection": [ 1 ], "AddressNumber": 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": "W. 6th St", "QueryComponents": {"AddressNumber": "415", "Locality": "Vancouver"}}'
- AWS CLI
-
./aws geo-places geocode -key ${
YourAPIKey
} --query-text "W. 6th St" \ --query-components '{"AddressNumber" : "415", "Locality": "Vancouver"}'
Kiat Pengembang
Gunakan filter seperti IncludeCountries
dan IncludePlaceTypes
untuk mendapatkan hasil yang akurat. Misalnya, jika Anda membutuhkan Vancouver dari AS, ajukan permohonan "IncludeCountries": ["USA"]
untuk memprioritaskan hasil di AS. Untuk mempelajari informasi lebih lanjut, lihat Cara geocode menggunakan filter.
{ "QueryText": "Vancouver", "Filter": { "IncludeCountries": ["USA"], "IncludePlaceTypes": ["City"] } }