Hi, In this page we can see how we can populate the geolocation field programmatically,

On several cases while updating and creating the node we need to add the geolocation field, the problem with the geolocation field we need to enter latitude and longitude both as compare to other field like text field need to enter string simply.

Geolocation field takes the input in form of array with specified key value pair

For updating:

$nid = 1;
$node = Node::load($nid);
$node->field_geolocation = array('lat'=> -33.264, 'lng' => 144.353);
$node->save();

For Creating:

$latlong = array('lat'=> -33.264, 'lng' => 144.353);
$node = Node::create(
  'type' => 'content-type-name',
  'title' => 'Title of the node',
  'geolocation_field' => $latlong
);
$node->save();

Hopes this help

Happy Searching, happy Learning