From 564470832632cce09bfc60a4bd7cc8355bb5f199 Mon Sep 17 00:00:00 2001 From: David Zwarg Date: Thu, 9 Feb 2012 20:12:18 +0000 Subject: [PATCH] Performance improvement by keeping x and y pixel coordinates as floats. git-svn-id: http://svn.osgeo.org/postgis/trunk@9137 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rt_pg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index a5ee09f4d..a8cc94824 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -2598,9 +2598,8 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS) const int argkwcount = 3; enum KEYWORDS { kVAL=0, kX=1, kY=2 }; char *argkw[] = {"[rast]", "[rast.x]", "[rast.y]"}; - Oid argkwtypes[] = { FLOAT8OID, INT4OID, INT4OID }; int argcount = 0; - Oid argtype[] = { FLOAT8OID, INT4OID, INT4OID }; + Oid argtype[] = { FLOAT8OID, FLOAT8OID, FLOAT8OID }; uint8_t argpos[3] = {0}; char place[5]; int idx = 0; @@ -3041,7 +3040,6 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS) newexpr = rtpg_strreplace(initexpr, argkw[i], place, &len); pfree(initexpr); initexpr=newexpr; if (len > 0) { - argtype[argcount] = argkwtypes[i]; argcount++; argpos[i] = j++; @@ -3133,12 +3131,12 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS) if (i == kX ) { /* x is 0 based index, but SQL expects 1 based index */ - values[idx] = Int32GetDatum(x+1); + values[idx] = Float8GetDatum((float)(x+1)); nulls[idx] = ' '; } else if (i == kY) { /* y is 0 based index, but SQL expects 1 based index */ - values[idx] = Int32GetDatum(y+1); + values[idx] = Float8GetDatum((float)(y+1)); nulls[idx] = ' '; } else if (i == kVAL ) { -- 2.40.0