Support

Account

Home Forums ACF PRO Google Map Field (Pro)

Solving

Google Map Field (Pro)

  • Hi,

    I’m having some issues with the ACF Google Map field.

    My first question is what is the database table ‘acf_google_map_search_geodata’ that is created actually used for? I’ve created several posts (custom post type ‘school’) and all data is saved in to the postmeta table, so what is the ‘acf_google_map_search_geodata’ for?

    My end goal is to create some kind of query that displays the 3/4 nearest schools to the current school by lat/lng, which should be possible as all this data is available for each post.

    The solution here seemed encouraging, but the last ‘working’ example was from 2018 and I can’t make this work.

    Can anyone offer any advice on this?

    TIA x

  • UPDATE

    So, using the code below, I can extract the lat/lng from the data and populate two new acf fields.

    function rhm_update_latlon($post_id, $post, $update) {
    
    	$map = get_post_meta($post_id, 'address', true);
    
    	if (!empty($map)) {
    	    update_post_meta( $post_id, 'lat', $map['lat'] );
    	    update_post_meta( $post_id, 'lng', $map['lng'] );
    	}
    
    }
    add_action('save_post', 'rhm_update_latlon', 90, 3);

    Now, how can I use this to create some kind of ‘nearest 3 schools’ query based on the school they are viewing?

  • Is Google Map Field (Pro) another plugin? ACF does not create any extra tables for storing data. If this table is created in relation to an ACF field then something other and ACF is doing it. If this is the case then your question should be submitted to the developer of that plugin.

  • The Google Map field is part of ACF core.

  • You referenced a table

    My first question is what is the database table ‘acf_google_map_search_geodata’

    ACF does not create any database tables

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

You must be logged in to reply to this topic.