Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#588 closed task (fixed)

[raster] Implement the one raster version of ST_MapAlgebra

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

Description

I will soon put the specifications in the wiki. See the plpgsql code added in script/plpgsql/mapalgebra.sql

Change History (7)

comment:1 by pracine, 14 years ago

Type: defecttask

comment:2 by pracine, 14 years ago

Summary: [raster] Implement the 1 raster version of ST_MapAlgebra[raster] Implement the one raster version of ST_MapAlgebra

comment:3 by jorgearevalo, 14 years ago

Status: newassigned

comment:4 by jorgearevalo, 13 years ago

Resolution: fixed
Status: assignedclosed

Implemented in r6832. I close the ticket. Reopen it if errors found.

comment:5 by robe, 13 years ago

Jorge,

I've documented this and provided an example, but I don't think the pixeltype setting thing is working right. What is strange is I was able to set it to a 2BB once and then afterwards I couldn't it would stay as my original 8BUI. So might be a memory bug that goes away after I restart my PostgreSQL server (I'll try that next).

Rather than reopen this ticket — wondering if its better if I just file a bug. I think I ran into some other issues, like the rast term doesn't get replaced right if I do a complex expression like CASE WHEN rast… blah blah blah END

comment:6 by jorgearevalo, 13 years ago

Regina,

What query (or queries) caused the errors?

comment:7 by robe, 13 years ago

That's the weird thing - everything was going good and then suddenly I would get errors like SELECT CASE WHEN mod(200.00,2) … rast (RAST does not exist) errors.

Though I can't trip it up now with a case: These work fine for example, but it wasn't the one I was testing yesterday (which is why I thought it was one of those heisenburgs).

However I do keep on getting a notice that my initial value is truncated when I do things like this:

ALTER TABLE dummy_rast ADD COLUMN map_rast raster; UPDATE dummy_rast

SET map_rast = st_mapalgebra(rast, 'CASE WHEN mod(rast,2) = 1 THEN rast WHEN rast = 254 THEN 100 WHEN rast < 253 THEN mod(rast,4) ELSE rast END') WHERE rid = 2;

Is that one of those weird windows bugs?

Gives warning:

WARNING:  Initial pixel value for 8BUI band got truncated from -128.000000 to 128

But result above looks right.

I think the other case with the PixelType not working was user error on my part. I had typed 2BB instead of 1BB or 2BUI. I didn't get a warning message or error, but it didn't convert the pixeltype — it left it as 8BUI. I think maybe we should throw an error if someone types in an invalid PixelType — you know just for people like me :). It wouldn't be pleasant if you thought that you had a 2BB pixel band and 1 million updates later, you realized it was really 8 BUI.

Note: See TracTickets for help on using tickets.