---
title: "findDataSourceByLayerName()"
canonical: "https://onesaitplatform.refined.site/space/DOCT/2220801016/findDataSourceByLayerName()"
format: markdown
---
> ℹ️ **Information**
> ℹ️ 
> ℹ️ Implementation version: beta 1.03

# Description

<span style="color: #091e42">It finds and defines one of the dataSources of the map from the name of the layer. If none can be found, it returns an undefined and a warning message. If it finds more than one dataSource with the same name, it specifies the number of repetitions, returning the first one found according to the hierarchy: entities > primitives > images.</span>

# Invocation

```javascript
findDataSourceByLayerName(
	layerName
)
```

# Input parameters

## layerName

The name of the layer from which the dataSource will be selected. This name corresponds to the name of the entity collection (featureCollection.name). It is entered as a text string.

# Use examples

Search and select the dataSource corresponding to the 'points single' layer:

```javascript
findDataSourceByLayerName(
	'points single'
)
```

![image](media://0132647c-20e3-4b85-bfad-53885ebf0276)