[postgis-devel] ST_Value performance

Sandro Santilli strk at keybit.net
Tue Jan 31 13:53:27 PST 2012


On Tue, Jan 31, 2012 at 08:39:27PM +0100, Sandro Santilli wrote:
> On Tue, Jan 31, 2012 at 02:07:31PM -0500, Pierre Racine wrote:
> > Could you tell us more about your general goal. Seems to be a case for ST_MapAlgebra...
> 
> Yes, indeed I should be using ST_MapAlgebra.

So, for the record, the expression I would be using in ST_MapAlgebra
could be this:

-- shift_lon (band 1)
(
 st_x(st_centroid(rast)) -
 st_x(
   st_transform(postgis_transform_geometry(st_centroid(rast), '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=CHENYX06a.gsb +no_defs', '+init=epsg:4326', 4150), 4326)
))*3600


-- shift_lat (band 2)
(
 st_y(
   st_transform(postgis_transform_geometry(st_centroid(rast), '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=CHENYX06a.gsb +no_defs', '+init=epsg:4326', 4150), 4326)
 ) - st_y(st_centroid(rast))
)*3600

I've used "rast" for references into the raster itself.
You can see the expression contains a few single quotes.
Haven't tried it.

--strk;

  ,------o-. 
  |   __/  |    Thank you for PostGIS-2.0 Topology !
  |  / 2.0 |    http://www.pledgebank.com/postgistopology
  `-o------'




More information about the postgis-devel mailing list