---
title: "Layer"
description: "GDS layer identity defined by a number and datatype pair."
canonical_url: "https://www.rosette.dev/docs/api-reference/Layer"
markdown_url: "https://www.rosette.dev/docs/api-reference/Layer.md"
source_url: "https://github.com/PreFab-Photonics/rosette/blob/f086d7670645fd36c05362d696d442a2b2e74850/www/content/docs/api-reference/Layer.mdx"
docs_channel: "main"
docs_revision: "f086d7670645fd36c05362d696d442a2b2e74850"
---

# Layer

GDS layer identity defined by a (number, datatype) pair.

Every polygon, path, and text element in a GDS file belongs to a layer.
Layer encodes the two integers that GDS uses to identify layers: a layer
`number` and a `datatype`. By convention, `datatype` defaults to 0.

```python
silicon = Layer(1, 0)   # Silicon waveguide layer
cladding = Layer(2, 0)  # Cladding layer
text = Layer(10)        # Text annotations (datatype defaults to 0)
```

Layer objects are hashable and can be used as dictionary keys or in sets.

## Attributes



### `number`

```python
number: int
```

Layer number (0--65535). GDS export supports values through 32767.





### `datatype`

```python
datatype: int
```

Datatype (0--65535). GDS export supports values through 32767. Defaults to 0.



## Methods



### `__init__`

```python
__init__(number, datatype=0) -> None
```

Create a new Layer.



> **Example**
>
> ```python
> Layer(1, 0)   # Explicit number and datatype
> Layer(1)      # Equivalent: datatype defaults to 0
> ```





- **`number`** (`int`)

  Layer number. Values above 32767 cannot be exported to GDS.





- **`datatype`** (`int`, default `0`)

  Datatype. Values above 32767 cannot be exported to GDS. Defaults to 0.





**Returns:** `None`