Hi everybody,
I’m trying to fetch some post from an external resource which proved me an address/country and I was trying to import them as a post into WP, using one location ACF filed as a Google Map. I’m seeing that the data that this object save is something like:
a:3:{s:7:"address";s:42:"Poland";s:3:"lat";s:11:"51.919438";s:3:"lng";s:18:"19.145136";}
And I was thinking how to get y Country field and transform it to coordinates, thought google maps API, but I’m getting a different data from this below url:
https://maps.google.com/maps/api/geocode/json?address=Poland&key=YOUR_API
`
{
"results" : [
{
"address_components" : [
{
"long_name" : "Poland",
"short_name" : "PL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Poland",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 54.9054761,
"lng" : 24.1458932
},
"southwest" : {
"lat" : 49.0020252,
"lng" : 14.1228641
}
},
"location" : {
"lat" : 51.919438,
"lng" : 19.145136
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 54.9054761,
"lng" : 24.1458932
},
"southwest" : {
"lat" : 49.0020252,
"lng" : 14.1228641
}
}
},
"place_id" : "ChIJuwtkpGSZAEcR6lXMScpzdQk",
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}
There is no way to parse it (As far as I know) to the other data that acf google maps save, so I was wondering if anyone knows how to set those google map objects from the ACF just from an address (e.g. Poland).
Thanks in advance