Searches for a layer with the given name, passes it to the optional callback function (if provided), and returns it. This will search both polygon and marker layers at once. |
Parameters:
name
(string): the name of the layer to search for
callback
(function): (OPTIONAL) A callback function to execute. It will be passed the layer found, which may be null
if no layer matches name
.
Returns: A promise that resolves to layer
(object): The layer matching name
, or null
if no layer matches name
.