I’m using https://github.com/mcguffin/acf-field-openstreetmap for adding map to posts.
I would like to import posts from CSV file.
Serialized array returned from field looks like:
a:5:{s:10:"center_lat";s:16:"50.3061818714249";s:10:"center_lng";s:17:"21.46160423755646";s:4:"zoom";s:2:"17";s:6:"layers";a:1:{i:0;s:14:"HERE.hybridDay";}s:7:"markers";a:1:{i:0;a:4:{s:13:"default_label";s:63:"Wojska Polskiego 39-300 Mielec województwo podkarpackie Polska";s:3:"lat";d:50.306037971972373;s:3:"lng";d:21.461829543113712;s:5:"label";s:63:"Wojska Polskiego 39-300 Mielec województwo podkarpackie Polska";}}}
I was trying to import with WP All Import but when I insert new coordinates into “center_lat”, “center_lng”, “lat”, “lng” is not placing marker on map.
https://www.dropbox.com/s/1dwvokqxvwjluou/acfosm.png?dl=0
Does anyone have experience with that field and can tell me how to import data to map?
Do you mean that you’re trying to edit the text of the serialized array before the import?
When I click “autodetect” in WP All import it shows me that serialized array but filled with data from other post. So I changed coordinates to importer variables like on screenshot attached to previous post.
“center_lat” and “center_lng” are imported correct but “lat” and “lng” are “undefined”
You can’t just change a value that is serialized. I’ll explain why with part of your example
a:5:
what follows is an array with 5 elements
{
start of first element
s:10:
what follows is a string that is 10 characters long
"center_lat";
the index/key of the first element
s:16:
what follows is a string that is 16 characters long
"50.3061818714249";
the value of the first element
You cannot change the text of a serialized array without adjusting each of the values in the string to adjust the length of that value.
There is no safe way to edit a serialized array. Any error and you will loose all content. The only way to safely edit the values is to unserialize, alter the values in the array and then re-serialize.