> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RS_AsCOG

Returns a Cloud Optimized GeoTiff (COG) binary from a raster. COG is a GeoTiff file format optimized for efficient cloud-based access, with internal tiling and overviews that enable partial reads over HTTP range requests.

## Signatures

```sql theme={"system"}
RS_AsCOG(raster: Raster)
```

```sql theme={"system"}
RS_AsCOG(raster: Raster, compression: String)
```

```sql theme={"system"}
RS_AsCOG(raster: Raster, compression: String, tileSize: Int)
```

```sql theme={"system"}
RS_AsCOG(raster: Raster, compression: String, tileSize: Int, quality: Double)
```

```sql theme={"system"}
RS_AsCOG(raster: Raster, compression: String, tileSize: Int, quality: Double, resampling: String)
```

```sql theme={"system"}
RS_AsCOG(raster: Raster, compression: String, tileSize: Int, quality: Double, resampling: String, overviewCount: Int)
```

## Parameters

<ParamField body="raster" type="Raster" required>
  The input raster.
</ParamField>

<ParamField body="compression" type="String">
  The compression type. Possible values: `None`, `Deflate`, `LZW`, `JPEG`, `PackBits`, `Huffman`.
</ParamField>

<ParamField body="tileSize" type="Int" default="256">
  The width and height of the internal tiles in the COG file.
</ParamField>

<ParamField body="quality" type="Double">
  The compression quality. A decimal number between 0 and 1, where 0 means lowest quality and 1 means highest quality. Only applicable to `JPEG` compression; ignored for lossless codecs.
</ParamField>

<ParamField body="resampling" type="String">
  The resampling method used for overview generation. Possible values: `NearestNeighbor`, `Bilinear`, `Bicubic`.
</ParamField>

<ParamField body="overviewCount" type="Int">
  The number of overview levels to generate.
</ParamField>

## Return type

<ResponseField type="Binary">
  The raster in Cloud Optimized GeoTiff binary format.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT RS_AsCOG(raster) FROM my_raster_table
```

```sql theme={"system"}
SELECT RS_AsCOG(raster, 'JPEG', 256, 0.75, 'Bilinear') FROM my_raster_table
```
