Hi,
I need assistance in extracting the values display under property “long_name” under “address_components” list; so I can get the enterie address base on a latitude and logitude values; I’m using the location sensor component and a web api from google maps
Thanks,
the json that comes out of the google geocoding api is:
{
“plus_code” : {
“compound_code” : “RHR3+98 Santa Lucia, El Salvador”,
“global_code” : “765GRHR3+98”
},
“results” : [
{
“address_components” : [
{
“long_name” : “Calle Francisco Gavidia”,
“short_name” : “Calle Francisco Gavidia”,
“types” : [ “route” ]
},
{
“long_name” : “Ciudad Arce”,
“short_name” : “Cd Arce”,
“types” : [ “locality”, “political” ]
},
{
“long_name” : “Ciudad Arce”,
“short_name” : “Cd Arce”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“long_name” : “La Libertad”,
“short_name” : “La Libertad”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “Calle Francisco Gavidia, Cd Arce, El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 13.841047,
“lng” : -89.44653409999999
},
“southwest” : {
“lat” : 13.8408049,
“lng” : -89.44662219999999
}
},
“location” : {
“lat” : 13.8409264,
“lng” : -89.44657699999999
},
“location_type” : “GEOMETRIC_CENTER”,
“viewport” : {
“northeast” : {
“lat” : 13.8422749302915,
“lng” : -89.44522916970848
},
“southwest” : {
“lat” : 13.8395769697085,
“lng” : -89.44792713029149
}
}
},
“place_id” : “ChIJC5bVJcPeYo8R6st1j-xy_Ms”,
“types” : [ “route” ]
},
{
“address_components” : [
{
“long_name” : “Ciudad Arce Centro”,
“short_name” : “Cd Arce Centro”,
“types” : [ “neighborhood”, “political” ]
},
{
“long_name” : “Santa Lucia”,
“short_name” : “Santa Lucia”,
“types” : [ “locality”, “political” ]
},
{
“long_name” : “Ciudad Arce”,
“short_name” : “Cd Arce”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“long_name” : “La Libertad”,
“short_name” : “La Libertad”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “Cd Arce Centro, Santa Lucia, El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 13.8445803,
“lng” : -89.44004059999999
},
“southwest” : {
“lat” : 13.8367674,
“lng” : -89.4481945
}
},
“location” : {
“lat” : 13.8391144,
“lng” : -89.4440774
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 13.8445803,
“lng” : -89.44004059999999
},
“southwest” : {
“lat” : 13.8367674,
“lng” : -89.4481945
}
}
},
“place_id” : “ChIJ9fji6NzeYo8R3iLj-UUGxg4”,
“types” : [ “neighborhood”, “political” ]
},
{
“address_components” : [
{
“long_name” : “Santa Lucia”,
“short_name” : “Santa Lucia”,
“types” : [ “locality”, “political” ]
},
{
“long_name” : “Ciudad Arce”,
“short_name” : “Cd Arce”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“long_name” : “La Libertad”,
“short_name” : “La Libertad”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “Santa Lucia, El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 13.8498722,
“lng” : -89.41884039999999
},
“southwest” : {
“lat” : 13.8189031,
“lng” : -89.45274350000001
}
},
“location” : {
“lat” : 13.8354794,
“lng” : -89.4387562
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 13.8498722,
“lng” : -89.41884039999999
},
“southwest” : {
“lat” : 13.8189031,
“lng” : -89.45274350000001
}
}
},
“place_id” : “ChIJb6L_kSffYo8RB4JT3_9nCKs”,
“types” : [ “locality”, “political” ]
},
{
“address_components” : [
{
“long_name” : “Ciudad Arce”,
“short_name” : “Ciudad Arce”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“long_name” : “La Libertad Department”,
“short_name” : “La Libertad Department”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “Ciudad Arce, El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 13.8794127,
“lng” : -89.3895721
},
“southwest” : {
“lat” : 13.7587273,
“lng” : -89.47196959999999
}
},
“location” : {
“lat” : 13.7977568,
“lng” : -89.41746409999999
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 13.8794127,
“lng” : -89.3895721
},
“southwest” : {
“lat” : 13.7587273,
“lng” : -89.47196959999999
}
}
},
“place_id” : “ChIJSfdXXNDYYo8R767pb8QwJd8”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“address_components” : [
{
“long_name” : “La Libertad Department”,
“short_name” : “La Libertad Department”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “La Libertad Department, El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 14.0608631,
“lng” : -89.133437
},
“southwest” : {
“lat” : 13.4222451,
“lng” : -89.6249409
}
},
“location” : {
“lat” : 13.6817661,
“lng” : -89.3606298
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 14.0608631,
“lng” : -89.133437
},
“southwest” : {
“lat” : 13.4222451,
“lng” : -89.6249409
}
}
},
“place_id” : “ChIJj7ku93kjY48RJGGpDtNMEcI”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“address_components” : [
{
“long_name” : “El Salvador”,
“short_name” : “SV”,
“types” : [ “country”, “political” ]
}
],
“formatted_address” : “El Salvador”,
“geometry” : {
“bounds” : {
“northeast” : {
“lat” : 14.4505567,
“lng” : -87.6682
},
“southwest” : {
“lat” : 13.0473999,
“lng” : -90.19229999999999
}
},
“location” : {
“lat” : 13.794185,
“lng” : -88.89653
},
“location_type” : “APPROXIMATE”,
“viewport” : {
“northeast” : {
“lat” : 14.4505567,
“lng” : -87.6682
},
“southwest” : {
“lat” : 13.0473999,
“lng” : -90.19229999999999
}
}
},
“place_id” : “ChIJVwZkWaYnY48RMkiFmOsWmm8”,
“types” : [ “country”, “political” ]
}
],
“status” : “OK”
}