Puoi fare una riechiesta GET a questo URL:
https://maps.googleapis.com/maps/api/geocode/json?address={indirizzo}&key={apikey}
ad esempio:
https://maps.googleapis.com/maps/api/geocode/json?address=via%20Roma,%20Rimini&key=xxxxxxxxx
e riceverai come risposta:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Via Roma",
"short_name" : "Via Roma",
"types" : [ "route" ]
},
{
"long_name" : "Rimini",
"short_name" : "Rimini",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Rimini",
"short_name" : "Rimini",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Provincia di Rimini",
"short_name" : "RN",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Emilia-Romagna",
"short_name" : "Emilia-Romagna",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Italy",
"short_name" : "IT",
"types" : [ "country", "political" ]
},
{
"long_name" : "47921",
"short_name" : "47921",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Via Roma, 47921 Rimini RN, Italy",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 44.06445859999999,
"lng" : 12.5782135
},
"southwest" : {
"lat" : 44.0581885,
"lng" : 12.569247
}
},
"location" : {
"lat" : 44.0617069,
"lng" : 12.5746148
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 44.06445859999999,
"lng" : 12.5782135
},
"southwest" : {
"lat" : 44.0581885,
"lng" : 12.569247
}
}
},
"place_id" : "ChIJZYBB15jDLBMRnqCPcqzZIGs",
"types" : [ "route" ]
}
],
"status" : "OK"
}
Puoi generare la tua APIKEY qui:
https://cloud.google.com/maps-platform , clickando su
get started