Geolocate Add-On not making Lat and Lng Accessible

Hi All,

I’m having trouble accessing lat and lng data from the geolocation add-on. I can see the values in my database:

add_action( 'gform_advancedpostcreation_post_after_creation', 'update_vendor_information', 10, 4 );


function update_vendor_information( $post, $feed, $entry, $form ){

	
	$street = $entry['13.1'];
    $street_2 =  $entry['13.2'];
    $city =  $entry['13.3'];
    $state =   $entry['13.4'];
    $zip =  $entry['13.5'];
    $lng = $entry['13.geolocation_longitude'];
    $lat =$entry['13.geolocation_latitude'];

    $full_address = $street.' '. $street2.' '.$city.' '.$state.' '.$zip;
   	

     GFCommon::log_debug ('******* MAPZ *************');
     GFCommon::log_debug( 'full address:'.$full_address);
	 GFCommon::log_debug( 'address:'.$street);
 	 GFCommon::log_debug( 'city:'.$city);
 	 GFCommon::log_debug( 'state:'.$state);
 	 GFCommon::log_debug( 'zip:'.$zip);
 	 GFCommon::log_debug( 'lat:'.$lat);
 	 GFCommon::log_debug( 'lng:'.$lng);
	 GFCommon::log_debug ('******* ENDZ *************');

	 $value = array("address" => $full_address, "lat" => $lat, "lng" => $lng, "zoom" => '13');

 
    //update the map field with an array
  	$map_field = "field_65db7c89dadd3";
 	update_field($map_field, $value, $post_id);

 	return post;
    
 
}

This is my debug log showing all other fields being queried correctly:

2024-03-06 22:56:34.503565 - DEBUG --> ******* MAPZ ************* 
2024-03-06 22:56:34.503603 - DEBUG --> full address:6415 Churchill Road  Harrisburg PA 17111 4817 
2024-03-06 22:56:34.503628 - DEBUG --> address:6415 Churchill Road 
2024-03-06 22:56:34.503654 - DEBUG --> city:Harrisburg 
2024-03-06 22:56:34.503676 - DEBUG --> state:PA 
2024-03-06 22:56:34.503699 - DEBUG --> zip:17111 4817 
2024-03-06 22:56:34.503717 - DEBUG --> lat: 
2024-03-06 22:56:34.503741 - DEBUG --> lng: 
2024-03-06 22:56:34.503776 - DEBUG --> ******* ENDZ *************

Even if I try to pair the data via Advanced Post Creation, it also returns empty values:

2024-03-06 23:15:43.394726 - DEBUG --> GF_Advanced_Post_Creation::maybe_set_post_meta(): Empty value for Custom Field vendor_lat 
2024-03-06 23:15:43.394753 - DEBUG --> GF_Advanced_Post_Creation::maybe_set_post_meta(): Empty value for Custom Field vendor_lng

The whole reason for running this function is I have an ACF Google Maps field that when passing the address field from GF to ACF via the Advanced Post Creation, it’s trying to pass the full address and doesn’t pass an array with that address, lat, lng. Any thoughts?

This was recently fixed with Geolocation version 1.1.1 and Gravity Forms version 2.8.5

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.