I am using the Geofield Map module which depends on the geofield and I want to save lng and lat pragmatically in the geofield via my controller. I have tried the methods below and they didn't work:
$WayPointEntity->field_geo_field->setValue("POINT(" .$waypoint['lng']." " .$waypoint['lat'].")");
I also tried:
$WayPointEntity->field_geo_field = array(
'input_format' => GEOFIELD_INPUT_LAT_LON,
'geom' => array('lat' => $waypoint['lat'], 'lon' => $waypoint['lng']),
);
$WayPointEntity->save();