Support

Account

Home Forums General Issues Trying to bulk-add map data for multiple existing posts with addresses

Unread

Trying to bulk-add map data for multiple existing posts with addresses

  • tl;dr
    =====
    I am looking for help with the translation of the response received from the geocoding api to what acf stores in the ‘location’ field of the database

    ====

    Hi,

    I have a number of posts which have an an attached address field. There is a need to add a acf google map field to each post, using existing address to create the point for the map.

    My approach was going to be to get all of the addressees and feed them through a script that would geocode them and store the response, and then update with the response back into the database in the ‘location’ field for the map to use.

    Looking at it though, the ‘location’ field is storing a translated version of the response that seems to be be a combination of a subset of the returned fields and their data types.

    example:
    a:14:{s:3:"lat";d:52.1;s:3:"lng";d:-106.656;....

    I am interpreting these result as:
    an array of 14 entries - s:3:"lat" (string of 3 long called 'lat') d:52.1 - (a decimal/double of with value 52.1)....

    So with that in mind, I could translate the addresses and create a similar string, but that seems like a lot of work both because as they are storing more than just lat/lng(14 things, in the example row), and I would need to also need to be sure that I have a full understanding of the format they are storing before going ahead with it. The fields they are storing are not a 1:1 with what is returned from the geocoding api

    I tried to look through the plugin code to find out where this translation is happening to borrow the functionality for this one-time script run – Can anyone point me to where I might be able to find where this happens? .

    If not, is there a way to bulk-translate these addresses that I am not aware of?
    Has this problem been conquered already by someone that I can piggy-back off of? If it hasn’t, would people benefit from me making a solution publicly available, if I decide to go that route? I hope I don’t have to though.

    Barring that, does this sort of storage notation have a name that I could look into for a solution that I don’t have to write, or even to look up the rules for it if I end up having to? I presume at this time that this is a proprietary way of storing this value – am I wrong about that though?

    Thanks for any help, mostly-new to both wordpress and acf, if that wasn’t obvious. Lots of experience in other spaces though, so open to any suggestions or help.

    thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.