Getting "Fatal error: Class not found" by bootstrapping external script and executing user_save function
The correct answer could be to also use the necessary namespacing when instantiating the GmapDefaults class:

include_once(DRUPAL_ROOT . base_path() . drupal_get_path('module', 'gmap') . '/lib/Drupal/gmap/GmapDefaults.php');

$macro = !empty($field['settings']['gmap_macro']) ? $field['settings']['gmap_macro'] : '[gmap ]';
$map = array_merge(Drupal\gmap\GmapDefaults::getInstance()-&gt;getDefaults(), gmap_parse_macro($macro));


Note that I also converted the original include to an absolute path based include to make sure the path is correct...

I just prepended the necessary namespace before "GmapDefaults::" and it works.