跳转至
🎉 Apache Sedona 1.9.1 已正式发布!🗺️ 新增 Geography SQL 函数、Box2D 与 Box3D 类型、栅格 Python UDF 等。查看发布说明 →

RS_WorldToRasterCoordX

Introduction: Returns the X coordinate of the grid coordinate of the given world coordinates as an integer.

RS_WorldToRasterCoordX

Format:

RS_WorldToRasterCoordX(raster: Raster, point: Geometry)

RS_WorldToRasterCoordX(raster: Raster, x: Double, y: Double)

Return type: Integer

Since: v1.5.0

SQL Example

SELECT RS_WorldToRasterCoordX(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0), -53, 51) from rasters;

Output:

1

SQL Example

SELECT RS_WorldToRasterCoordX(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0), ST_GeomFromText('POINT (-53 51)')) from rasters;

Output:

1

Tip

For non-skewed rasters, you can provide any value for latitude and the intended value of world longitude, to get the desired answer