Opened 15 years ago

Closed 15 years ago

#495 closed defect (fixed)

[wktraster] Don't seem to be able to specify non- 0 skews in ST_SetGeoReference

Reported by: robe Owned by: pracine
Priority: medium Milestone: WKTRaster 0.1.6
Component: raster Version: master
Keywords: Cc:

Description

I assume the carriage returns in ST_SetGeoReference are optional since I was able to do this

UPDATE dummy_rast 
SET rast = ST_SetGeoReference(rast, '2 0 0 3 0.5 0.5','GDAL') 
	WHERE rid=1;
	

But if I try to do this:

UPDATE dummy_rast 
SET rast = ST_SetGeoReference(rast, '2 -0.5 0 3 0.5 0.5','GDAL') 
	WHERE rid=1;

I get error:

st_setgeoreference requires a string with 6 floating point values.

I assume the skew/rotation is supposed to be in radians.

On another but related note: I want to verify we are renaming ST_RotationX/Y to ST_SkewX/Y — haven't bothered documenting those since I figure they will change.

Pierre, Also your final spec states the below — I assume this is obsolete and should be changed to ST_GeoReference, ST_SetGeoReference?

ST_ESRIWorldFile(raster) -> string
Return the georeference of the raster as a string representing the 6 doubles (separated by a carriage return) of an equivalent ESRI World File . See.

ST_GDALGeoTransform(raster) -> string
Return the georeference of the raster as a string representing the 6 doubles (separated by a carriage return) used by GDAL to georeference a raster.

Attachments (1)

rtpostgis.sql.in.c.patch (725 bytes ) - added by robe 15 years ago.
ST_SetGeoReference patch

Download all attachments as: .zip

Change History (4)

by robe, 15 years ago

Attachment: rtpostgis.sql.in.c.patch added

ST_SetGeoReference patch

comment:1 by robe, 15 years ago

Hmm my comment didn't go thru. I attached a patch to fix the regular expression. It seems it doesn't allow any negatives. My regex skills are a bit rusty, but that seems to work for me for various valid permutations.

comment:2 by pracine, 15 years ago

Status: newassigned

I fixed st_setgeoreference so now it accept minus numbers.

skew/rotation is not in gradient nor in degree. The doc on world files and the 4 first parameters is really misleading. I uploaded a graphic in the wikipedia page for world file trying to show graphically the different parameters. Some call the D and B parameters "skew" but I am not convinced by this terminology. I would prefer:

A is the x component of the pixel width, D is the y component of the pixel width, B is the x component of the pixel height and E is the y component of the pixel height.

D and B are equal to 0 when the raster is not rotated. A is equal to -E when the pixel are squares.

There is nothing such as a rotation in angle but we can derive it from those parameters and we can derive those params from a provided angle. This is the intent of the planned ST_Rotation() and ST_SetRotation() functions.

I will rename the actual ST_Rotation() to ST_Skew()…

I hope my graphic makes all this clearer. You can use it wherever you want. I might also update the text of the article.

I updated the spec about ST_Georeference.

comment:3 by pracine, 15 years ago

Resolution: fixed
Status: assignedclosed

I renamed all ST_Rotation() to ST_Skew()…

Note: See TracTickets for help on using tickets.