> ## 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_WorldToRasterCoord

Returns the grid coordinate of the given world coordinates as a Point.

<img src="https://mintcdn.com/wherobots/AayJA2u8CknIeTgt/images/sql-functions/RS_WorldToRasterCoord/RS_WorldToRasterCoord.svg?fit=max&auto=format&n=AayJA2u8CknIeTgt&q=85&s=2b67c50951d952e2035d495ef54a0080" alt="RS_WorldToRasterCoord" width="780" height="400" data-path="images/sql-functions/RS_WorldToRasterCoord/RS_WorldToRasterCoord.svg" />

## Signatures

```sql theme={"system"}
RS_WorldToRasterCoord(raster: Raster, point: Geometry)
```

```sql theme={"system"}
RS_WorldToRasterCoord(raster: Raster, x: Double, y: Point)
```

## Parameters

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

<ParamField body="x" type="Double">
  The X coordinate (longitude).
</ParamField>

<ParamField body="y" type="Double">
  The Y coordinate (latitude).
</ParamField>

<ParamField body="point" type="Geometry">
  The point value.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT RS_WorldToRasterCoord(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0, 4326), -53, 51) from rasters;
```

```
POINT (1 1)
```

```sql theme={"system"}
SELECT RS_WorldToRasterCoord(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0, 4326), ST_GeomFromText('POINT (-52 51)')) from rasters;
```

```
POINT (2 1)
```

<Note>
  If the given geometry point is not in the same CRS as the given raster, the given geometry will be transformed to the given raster's CRS. You can use [ST\_Transform](/reference/wherobots-db/geometry-data/spatial-reference/ST_Transform) to transform the geometry beforehand.
</Note>
