if (j > 0) {
/* trim allocation */
- options = repalloc(options, (j+1) * sizeof(char *));
+ options = repalloc(options, (j + 1) * sizeof(char *));
/* add NULL to end */
options[j] = NULL;
drv_set = rt_raster_gdal_drivers(&drv_count, 1);
if (NULL == drv_set || !drv_count) {
elog(NOTICE, "No GDAL drivers found");
+ MemoryContextSwitchTo(oldcontext);
SRF_RETURN_DONE(funcctx);
}
/* Get the geometry */
if (PG_ARGISNULL(0))
- PG_RETURN_NULL();
+ PG_RETURN_NULL();
pggeom = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
geom = lwgeom_from_gserialized(pggeom);
POSTGIS_RT_DEBUG(3, "RASTER_resample: Starting");
/* pgraster is null, return null */
- if (PG_ARGISNULL(0)) PG_RETURN_NULL();
+ if (PG_ARGISNULL(0))
+ PG_RETURN_NULL();
pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
/* raster */
POSTGIS_RT_DEBUG(3, "RASTER_metadata: Starting");
/* pgraster is null, return null */
- if (PG_ARGISNULL(0)) PG_RETURN_NULL();
+ if (PG_ARGISNULL(0))
+ PG_RETURN_NULL();
pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
/* raster */
CHECK_EQUALS(rt_raster_get_height(raster), 8);
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
printf(" in hexwkb: %s\n", hexwkb);
printf("out hexwkb: %s\n", out);
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian...
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian...
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian
}
out = rt_raster_to_hexwkb(raster, &len);
- printf(" in hexwkb len: %u\n", strlen(hexwkb));
+ printf(" in hexwkb len: %u\n", (uint32_t) strlen(hexwkb));
printf("out hexwkb len: %u\n", len);
CHECK_EQUALS(len, strlen(hexwkb));
/* would depend on machine endian
+SELECT CASE
+ WHEN length(
+ ST_AsGDALRaster(
+ NULL,
+ 'GTiff'
+ )
+ ) > 0
+ THEN 1
+ ELSE 0
+END;
SELECT CASE
WHEN length(
ST_AsGDALRaster(
-- scale or width & height, pixtype, value and nodata
INSERT INTO raster_asraster_dst (rid, rast) VALUES (
+ 1.0, (SELECT ST_AsRaster(
+ NULL,
+ 100, 100
+ ))
+), (
1.1, (SELECT ST_AsRaster(
geom,
100, 100
-- upper left
INSERT INTO raster_asraster_dst (rid, rast) VALUES (
+ 2.0, (SELECT ST_AsRaster(
+ NULL,
+ 1000., -1000.,
+ '8BUI',
+ 255,
+ 0,
+ -175453
+ ))
+), (
2.1, (SELECT ST_AsRaster(
geom,
1000., -1000.,
-- skew
INSERT INTO raster_asraster_dst (rid, rast) VALUES (
+ 3.0, (SELECT ST_AsRaster(
+ NULL,
+ 100, 100,
+ '8BUI',
+ 255,
+ 0,
+ NULL, NULL,
+ 0
+ ))
+), (
3.1, (SELECT ST_AsRaster(
geom,
100, 100,
-- snap to grid
INSERT INTO raster_asraster_dst (rid, rast) VALUES (
+ 4.0, (
+ SELECT ST_AsRaster(
+ NULL,
+ rast
+ )
+ FROM raster_asraster_rast
+ )
+), (
4.1, (
SELECT ST_AsRaster(
geom,
NOTICE: The geometry's SRID (993310) is not the same as the raster's SRID (992163). The geometry will be transformed to the raster's projection
NOTICE: The geometry's SRID (993310) is not the same as the raster's SRID (992163). The geometry will be transformed to the raster's projection
NOTICE: The geometry's SRID (993310) is not the same as the raster's SRID (992163). The geometry will be transformed to the raster's projection
+1.0||||||||||||||||
1.1|993310|100|100|1|1406.537|-869.114|0.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|1.000|1.000
1.10|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-175453.086|114987.661|32BF|t|0.000|t|1.000|1.000
1.11|993310|100|100|1|1406.537|-869.114|0.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|1.000|1.000
1.7|993310|1407|869|1|100.000|-100.000|0.000|0.000|-175453.086|114987.661|32BF|t|0.000|t|1.000|1.000
1.8|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|1.000|1.000
1.9|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-175453.086|114987.661|16BUI|t|0.000|t|1.000|1.000
+2.0||||||||||||||||
2.1||||||||||||||||
2.2|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-175400.000|115000.000|8BUI|t|0.000|t|255.000|255.000
2.3|993310|135|87|1|1000.000|-1000.000|0.000|0.000|-170000.000|114988.000|8BUI|t|0.000|t|255.000|255.000
2.5|993310|144|91|1|1000.000|-1000.000|0.000|0.000|-179000.000|119000.000|8BUI|t|0.000|t|255.000|255.000
2.6|993310|100|100|1|1406.537|-869.114|0.000|0.000|-179000.000|119000.000|8BUI|t|0.000|t|255.000|255.000
2.7|993310|100|100|1|1406.537|-869.114|0.000|0.000|-179000.000|119000.000|8BUI|t|0.000|t|255.000|255.000
+3.0||||||||||||||||
3.1|993310|100|100|1|1406.537|-869.114|0.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
3.2|993310|100|100|1|1406.537|-869.114|0.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
3.3|993310|100|100|1|1406.537|-869.114|1.000|0.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
3.4|993310|100|100|1|1406.537|-869.114|0.000|1.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
3.5|993310|100|100|1|1406.537|-869.114|10.000|-5.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
3.6|993310|100|100|1|1406.537|-869.114|-5.000|10.000|-175453.086|114987.661|8BUI|t|0.000|t|255.000|255.000
+4.0||||||||||||||||
4.1|992163|150|116|1|1000.000|-1000.000|0.000|0.000|-1898000.000|-412000.000|8BUI|t|0.000|t|1.000|1.000
4.10|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-176100.000|115100.000|16BUI|t|0.000|t|13.000|13.000
4.11|993310|141|87|1|1000.000|-1000.000|0.000|0.000|-176100.000|115100.000|16BUI|t|0.000|t|13.000|13.000
+SELECT * FROM ST_MetaData(NULL);
SELECT * FROM ST_MetaData(
ST_AddBand(
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,-1)
+|||||||||
10|10|10|10|2|2|0|0|-1|1
-- ST_Resample
INSERT INTO raster_resample_dst (rid, rast) VALUES (
+ 1.0, (SELECT ST_Resample(
+ NULL
+ ))
+), (
1.1, (SELECT ST_Resample(
rast
) FROM raster_resample_src)
ST_MakeEmptyRaster(5, 5, -654321, 123456, 100, 100, 0, 0, 992163),
FALSE
) FROM raster_resample_src)
+), (
+ 1.29, (SELECT ST_Resample(
+ rast,
+ NULL::raster,
+ FALSE
+ ) FROM raster_resample_src)
);
-- ST_Transform
NOTICE: table "raster_resample_dst" does not exist, skipping
NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster
NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster
+1.0|||||||||||||
1.1|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t
1.10|992163|40|40|1|250.000|-250.000|0.000|0.000|-500000.000|600000.000|t|t|t
1.11|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t
1.26|992163|150|150|1|66.667|-66.667|0.000|0.000|-500000.000|600000.000|t|t|t
1.27|993310|150|150|1|80.792|-80.792|0.000|0.000|950732.188|1409281.783|t|t|t
1.28|992163|5|5|1|2064.200|-2291.200|0.000|0.000|-500321.000|601456.000|t|t|t
+1.29|||||||||||||
1.3|993309|12|12|1|1009.916|-1009.916|0.000|0.000|950762.305|1409088.896|t|t|t
1.4|994269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t
1.5|993310|24|24|1|500.000|-500.000|0.000|0.000|950732.188|1409281.783|t|t|t