RS_SetGeoReference¶
Sets the affine geotransform of a raster from a world-file georeference string of six whitespace-separated numbers in the order scalex, skewy, skewx, scaley, upperleftx, upperlefty — the same order RS_GeoReference emits. The format is ‘GDAL’ (default) or ‘ESRI’; in GDAL the upper-left coordinates refer to the corner of the upper-left pixel, while in ESRI they refer to its center. The transform can also be given as six numeric arguments instead of a string, always as GDAL/corner coordinates. This is metadata-only: raster cell values are not resampled.
Usage¶
raster RS_SetGeoReference(rast: raster, georeference: string)
raster RS_SetGeoReference(rast: raster, georeference: string, format: string)
raster RS_SetGeoReference(rast: raster, upperleftx: numeric, upperlefty: numeric, scalex: numeric, scaley: numeric, skewx: numeric, skewy: numeric)
Arguments¶
- rast (raster): Input raster
- upperleftx (numeric): X of the upper-left pixel’s corner.
- upperlefty (numeric): Y of the upper-left pixel’s corner.
- scalex (numeric): Pixel width.
- scaley (numeric): Pixel height (negative for a north-up raster).
- skewx (numeric): Row rotation term.
- skewy (numeric): Column rotation term.
- georeference (string): Six whitespace-separated numbers — scalex, skewy, skewx, scaley, upperleftx, upperlefty.
- format (string): Coordinate convention for the upper-left values: ‘GDAL’ (default; alias ‘PIXEL’) places them at the pixel corner, ‘ESRI’ (alias ‘NODE’) at the pixel center. The center-to-corner shift maps through the full affine transform, so it is exact for skewed (rotated) rasters too.
See Coordinate Reference Systems for how SedonaDB represents and compares CRS.
Examples¶
SELECT RS_GeoReference(RS_SetGeoReference(RS_Example(), '2 0 0 -3 100 200'));
┌────────────────────────────────────────────────────────────────────────────┐
│ rs_georeference(rs_setgeoreference(rs_example(),Utf8("2 0 0 -3 100 200"))) │
│ utf8 │
╞════════════════════════════════════════════════════════════════════════════╡
│ 2.0000000000… │
└────────────────────────────────────────────────────────────────────────────┘
SELECT RS_GeoReference(RS_SetGeoReference(RS_Example(), '2 0 0 -3 101 198.5', 'ESRI'));
┌──────────────────────────────────────────────────────────────────────────────┐
│ rs_georeference(rs_setgeoreference(rs_example(),Utf8("2 0 0 -3 101 198.5"),U │
│ tf8("ESRI")))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ 2.0000000000… │
└──────────────────────────────────────────────────────────────────────────────┘
The numeric form takes the transform components directly, in the order upperleftx, upperlefty, scalex, scaley, skewx, skewy:
SELECT RS_GeoReference(RS_SetGeoReference(RS_Example(), 100, 200, 2, -3, 0, 0));
┌──────────────────────────────────────────────────────────────────────────────┐
│ rs_georeference(rs_setgeoreference(rs_example(),Int64(100),Int64(200),Int64( │
│ 2),Int64(-3),Int64(0),Int64(0)))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ 2.0000000000… │
└──────────────────────────────────────────────────────────────────────────────┘