Opened 14 years ago

Closed 13 years ago

#651 closed defect (fixed)

[raster] ST_makeemptyraster inconsistent with documentation

Reported by: etiennebr Owned by: pracine
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc: etiennebr

Description

To recreate this box BOX(0 0,100 100) one would expect to use the upper left corner (as documented[1])

select 	st_box2d(ST_MakeEmptyRaster(100, 100, 0, 100, 1)) as upperl, 
	st_box2d(ST_MakeEmptyRaster(100, 100, 0, 0, 1)) as lowerl;

but it is in fact the lower left corner, wich I personnaly prefer.

On a personal touch, I must say I am new to PostGIS raster, but I'd like to add I couldn't understand from the documentation what ipx, ipy, scalex, scaley, skewx, skewy where standing for and what were their effects.

[1] http://postgis.refractions.net/documentation/manual-svn/RT_ST_MakeEmptyRaster.html

Change History (14)

comment:1 by pracine, 14 years ago

Milestone: PostGIS 1.5.3PostGIS 2.0.0

comment:2 by robe, 14 years ago

I made some changes to the documentation. Please check and see if things are a bit clearer.

in reply to:  2 comment:3 by etiennebr, 14 years ago

Cc: etiennebr added

Yes, that's much clearer for ipx and ipy. Thank's.

comment:4 by robe, 14 years ago

Resolution: fixed
Status: newclosed

Okay closing this out. Regarding the upper left corner — I think what you want to look at is the pixel y size. The pixel y size should be negative in general to go in the direction I think you are expecting. Take a look at the ST_PixelYSize and link at bottom — as well as the world file description.

comment:5 by pracine, 14 years ago

Resolution: fixed
Status: closedreopened

I reoppen the ticket as the documentation is still confusing.

1-The ipx and ipy where replaced in rtpostgis.sql to better express their meaning: "ipx" to "upperleftx" and "ipy" to "upperlefty"

2-The type of these parameter are float8

3-The description of these parameters is wrong in the documentation. It should read something like:

"Returns an empty raster (having no band) of given dimensions (width & height) and georeferenced in spatial (or world) coordinates with upper left x (upperleftx), upper left y (upperlefty), pixel size expressed as scalex, scaley, skewx, skewy and reference system (srid). The last version use a single parameter to specify the pixel size (pixelsize). In this case scalex and scaley are set to this parameter and skewx and skewy are set to 0. If an existing raster is passed in, it returns a new raster with the same meta data settings (without the bands). If no srid is specified it defaults to -1, though this may change to 0 in future. After you create an empty raster you probably want to add bands to it and maybe edit it. Refer to ST_AddBand to define bands and ST_SetValue to set pixel values."

This introduce two things to fix:

1-The last version in the doc name the last parameter "pixelsize" when rtpostgis.sql names it scale. It should probably better to modify rtpostgis.sql to match the doc.

2-This same last version is kind of useless right now as the scaley parameter should be negated in the function and is not. Rasters created using this function are upside down in most reference systems.

comment:6 by pracine, 14 years ago

Also it would good, in every page documenting a function making reference to scalex, scaley, skewx and skewy, to include a link to

http://en.wikipedia.org/wiki/World_file

I worked a lot last year to make this article comprehensible.

comment:7 by pracine, 14 years ago

Status: reopenednew

comment:8 by pracine, 14 years ago

Status: newassigned

comment:9 by pracine, 14 years ago

Owner: changed from pracine to robe
Status: assignednew

Robe I reassign this ticket to you untill you fix the doc part of it. Just reassign it to me after so I will take care of two thing I identified to change in the code. Thanks.

comment:10 by robe, 14 years ago

Owner: changed from robe to pracine

okay updated the docs.

comment:11 by pracine, 14 years ago

Milestone: PostGIS 2.0.0PostGIS Raster Future

There was still a mistake in the doc for the last variant last parameter: I changed it to "pixelsize". I also updated rtpostgis.sql to "pixelsize" to match this.

r7039 & r7040

We will fix item 2 mentionned above later…

comment:12 by pracine, 13 years ago

Milestone: PostGIS Raster FuturePostGIS 2.0.0

I set it to PostGIS 2.0.0 as it would be harder to fix it later. The idea is simply to negate the y component when using the third variant:

raster ST_MakeEmptyRaster(integer width, integer height, float8 upperleftx, float8 upperlefty, float8 pixelsize);

comment:13 by pracine, 13 years ago

Status: newassigned

comment:14 by pracine, 13 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r9339.

Note: See TracTickets for help on using tickets.