Add local flag to grid_map function and remove deprecated pg_map function