Ticket #588 (closed task: fixed)

Opened 3 years ago

Last modified 2 years ago

[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: trunk
Keywords: Cc:

Description

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

Change History

Changed 3 years ago by pracine

  • type changed from defect to task

Changed 3 years ago by pracine

  • summary changed from [raster] Implement the 1 raster version of ST_MapAlgebra to [raster] Implement the one raster version of ST_MapAlgebra

Changed 3 years ago by jorgearevalo

  • status changed from new to assigned

Changed 2 years ago by jorgearevalo

  • status changed from assigned to closed
  • resolution set to fixed

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

Changed 2 years ago by robe

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

Changed 2 years ago by jorgearevalo

Regina,

What query (or queries) caused the errors?

Changed 2 years ago by robe

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.