Home Forums Feature Requests Google Map – Save Map Data


Google Map – Save Map Data

  • I noticed that the address, latitude and longitude for a Google Map are saved, but no other data.

    It would be nice if the zoom level and map center were saved separately.

    For example, for a post I wanted to show the Google Map zoomed out far enough that the state lines were showing and I wanted the marker to be in the upper right corner area.

    However, with only the marker location being saved and nothing else, I can’t re-create a map as it looks on the edit page.

  • Hi Dave,

    I see your point. However there’s also a few issues with this. Firstly I’m not sure wether it’s possible to save more data from the map. Sure you could save the current zoom value but other than that? Secondly it would still not be enough to make sure the map you see in admin looks the same as the one you create on the frontend. Since the map in the admin has a relative width it’ll show you different amount of content depending on your screen size. And it’s the same for the front end (if you use responsive design which I sincerely hope).

    You could get the maps height at least (since that never changes) by fetching the field object:
    You’d also get the initial zoom level but I’m guessing that’s not too helpful for you.

    Would you think it’s enough to also save the current zoom level?

  • There is another plugin which does it by saving the current zoom, the current center and all marker positions (it allows for more than one marker).

    I would be happy if you saved just the marker position, the current center position and the zoom. With those 3 items, I could create the map on the front end that looks like it does on the back end.

  • That does sound like a decent improvement! I’ve been working a lot with google maps these past few days (not with ACF tho) and it’s got a lot more features than you’d think!

    I’ll go ahead and create a feature request for this in the Github repo and perhaps it will be implemented in a future update. It’s possible I’ll fork it and do the update myself if I can ever find some spare time 🙂

  • I like the idea, and think the bet way forward is to add in some kind of JS filter which will allow you to specify which data you want to save.

    Leave it with me for now, and I”ll add it to my to-do

  • Thanks Elliot. Maybe an easy short code [acf_render_map id="div-id-of-map-container" mapid="acf-field-name"]

  • Hey Dave,

    checkout a new plugin, which we recently released ACF Google Map Extended.

    It saves map zooming and center like you was looking for and backward compatible with the data format of the original field.

    We made it at CodeFish, as we wanted the same functionality you were looking for.

    Best wishes,
    CodeFish team

  • Hello @elliot – did this end up getting implemented?
    Our use case is our content authors need to be able to select a whole country to be “the center”. Searching for a country doesn’t appear to work (requires an actual address), so panning and zooming would work as an alternative.

  • @cjke7777 you wrote “Searching for a country doesn’t appear to work”. Well for me it does work.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Google Map – Save Map Data’ is closed to new replies.