How to set geolocation field programmatically in drupal 8 [example]

Jun
2020
26
Setting the proper values at a geolocation field programmatically in drupal 8 is different from typical field values. This code will do the trick:
<?php
use \Drupal\node\Entity\Node;
$node = Node::create(
 
'type' => 'location',
 
'title' => 'Attraction Location',
 
'geolocation_cords_field' => ['lat'=> 36.386122, 'lng' => 25.428413]
);
$node->save();
?>
Cats: 
this is an arrow pointing back to the top of the page