- ST_Tile(raster) to break up a raster into tiles (Bborie Park / UC Davis)
- #739, UpdateRasterSRID()
- #1895, new r-tree node splitting algorithm (Alex Korotkov)
+ - #1709, ST_NotSameAlignmentReason(raster, raster)
* Enhancements *
- #823, tiger geocoder: Make loader_generate_script download portion
</refsection>
<refsection>
<title>See Also</title>
- <para><xref linkend="RT_Loading_Rasters" />, <xref linkend="RT_ST_MakeEmptyRaster" /></para>
+ <para>
+ <xref linkend="RT_Loading_Rasters" />,
+ <xref linkend="RT_ST_NotSameAlignmentReason" />,
+ <xref linkend="RT_ST_MakeEmptyRaster" />
+ </para>
+ </refsection>
+ </refentry>
+
+ <refentry id="RT_ST_NotSameAlignmentReason">
+ <refnamediv>
+ <refname>ST_NotSameAlignmentReason</refname>
+ <refpurpose>Returns text stating if rasters are aligned and if not aligned, a reason why.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>boolean <function>ST_SameAlignment</function></funcdef>
+ <paramdef><type>raster </type><parameter>rastA</parameter></paramdef>
+ <paramdef><type>raster </type><parameter>rastB</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+ <para>Returns text stating if rasters are aligned and if not aligned, a reason why.</para>
+
+ <note>
+ <para>
+ If there are several reasons why the rasters are not aligned, only one reason (the first test to fail) will be returned.
+ </para>
+ </note>
+
+ <para>Availability: 2.1.0</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+ <programlisting>
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0)
+ )
+;
+
+ st_samealignment | st_notsamealignmentreason
+------------------+-------------------------------------------------
+ f | The rasters have different scales on the X axis
+(1 row)
+ </programlisting>
+ </refsection>
+
+ <refsection>
+ <title>See Also</title>
+ <para>
+ <xref linkend="RT_Loading_Rasters" />,
+ <xref linkend="RT_ST_SameAlignment" />
+ </para>
</refsection>
</refentry>
rt_raster_set_geotransform_matrix(rx, x->gt);
rt_raster_set_geotransform_matrix(rref, ref->gt);
- err = rt_raster_same_alignment(rx, rref, &aligned);
+ err = rt_raster_same_alignment(rx, rref, &aligned, NULL);
rt_raster_destroy(rx);
rt_raster_destroy(rref);
if (!err) {
*
* @param rast1 : the first raster for alignment test
* @param rast2 : the second raster for alignment test
- * @param aligned : non-zero value if the two rasters are aligned
+ * @param *aligned : non-zero value if the two rasters are aligned
+ * @param *reason : reason why rasters are not aligned
*
* @return ES_NONE if success, ES_ERROR if error
*/
rt_raster_same_alignment(
rt_raster rast1,
rt_raster rast2,
- int *aligned
+ int *aligned, char **reason
) {
double xr;
double yr;
assert(NULL != rast1);
assert(NULL != rast2);
+ assert(NULL != aligned);
err = 0;
/* same srid */
if (rt_raster_get_srid(rast1) != rt_raster_get_srid(rast2)) {
- RASTER_DEBUG(3, "The two rasters provided have different SRIDs");
+ if (reason != NULL) *reason = "The rasters have different SRIDs";
err = 1;
}
/* scales must match */
else if (FLT_NEQ(fabs(rast1->scaleX), fabs(rast2->scaleX))) {
- RASTER_DEBUG(3, "The two raster provided have different scales on the X axis");
+ if (reason != NULL) *reason = "The rasters have different scales on the X axis";
err = 1;
}
else if (FLT_NEQ(fabs(rast1->scaleY), fabs(rast2->scaleY))) {
- RASTER_DEBUG(3, "The two raster provided have different scales on the Y axis");
+ if (reason != NULL) *reason = "The rasters have different scales on the Y axis";
err = 1;
}
/* skews must match */
else if (FLT_NEQ(rast1->skewX, rast2->skewX)) {
- RASTER_DEBUG(3, "The two raster provided have different skews on the X axis");
+ if (reason != NULL) *reason = "The rasters have different skews on the X axis";
err = 1;
}
else if (FLT_NEQ(rast1->skewY, rast2->skewY)) {
- RASTER_DEBUG(3, "The two raster provided have different skews on the Y axis");
+ if (reason != NULL) *reason = "The rasters have different skews on the Y axis";
err = 1;
}
/* spatial coordinates are identical to that of first raster's upper-left corner */
if (FLT_EQ(xw, rast1->ipX) && FLT_EQ(yw, rast1->ipY)) {
- RASTER_DEBUG(3, "The two rasters are aligned");
+ if (reason != NULL) *reason = "The rasters are aligned";
*aligned = 1;
return ES_NONE;
}
/* no alignment */
- RASTER_DEBUG(3, "The two rasters are NOT aligned");
+ if (reason != NULL) *reason = "The rasters (pixel corner coordinates) are not aligned";
+
*aligned = 0;
return ES_NONE;
}
*noerr = 0;
/* rasters must be aligned */
- if (rt_raster_same_alignment(rast1, rast2, &aligned) != ES_NONE) {
+ if (rt_raster_same_alignment(rast1, rast2, &aligned, NULL) != ES_NONE) {
rterror("rt_raster_from_two_rasters: Unable to test for alignment on the two rasters");
return NULL;
}
/* check custom first if set. also skip if rasters are the same */
if (extenttype == ET_CUSTOM && rast != customextent) {
- if (rt_raster_same_alignment(rast, customextent, &aligned) != ES_NONE) {
+ if (rt_raster_same_alignment(rast, customextent, &aligned, NULL) != ES_NONE) {
rterror("rt_raster_iterator: Unable to test for alignment between reference raster and custom extent");
_rti_iterator_arg_destroy(_param);
if (_param->isempty[i] || rast == _param->raster[i])
continue;
- if (rt_raster_same_alignment(rast, _param->raster[i], &aligned) != ES_NONE) {
+ if (rt_raster_same_alignment(rast, _param->raster[i], &aligned, NULL) != ES_NONE) {
rterror("rt_raster_iterator: Unable to test for alignment between reference raster and raster %d", i);
_rti_iterator_arg_destroy(_param);
*
* @param rast1 : the first raster for alignment test
* @param rast2 : the second raster for alignment test
- * @param aligned : non-zero value if the two rasters are aligned
+ * @param *aligned : non-zero value if the two rasters are aligned
+ * @param *reason : reason why rasters are not aligned
*
* @return ES_NONE if success, ES_ERROR if error
*/
rt_errorstate rt_raster_same_alignment(
rt_raster rast1,
rt_raster rast2,
- int *aligned
+ int *aligned, char **reason
);
/*
/* determine if two rasters are aligned */
Datum RASTER_sameAlignment(PG_FUNCTION_ARGS);
+Datum RASTER_notSameAlignmentReason(PG_FUNCTION_ARGS);
/* one-raster MapAlgebra */
Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS);
uint32_t k;
int rtn;
int aligned = 0;
- int err = 0;
+ char *reason = NULL;
for (i = 0, j = 0; i < set_count; i++) {
/* pgrast is null, return null */
}
}
- err = 0;
- /* SRID must match */
- if (rt_raster_get_srid(rast[0]) != rt_raster_get_srid(rast[1])) {
- elog(NOTICE, "The two rasters provided have different SRIDs");
- err = 1;
- }
- /* scales must match */
- else if (FLT_NEQ(fabs(rt_raster_get_x_scale(rast[0])), fabs(rt_raster_get_x_scale(rast[1])))) {
- elog(NOTICE, "The two rasters provided have different scales on the X axis");
- err = 1;
- }
- else if (FLT_NEQ(fabs(rt_raster_get_y_scale(rast[0])), fabs(rt_raster_get_y_scale(rast[1])))) {
- elog(NOTICE, "The two rasters provided have different scales on the Y axis");
- err = 1;
- }
- /* skews must match */
- else if (FLT_NEQ(rt_raster_get_x_skew(rast[0]), rt_raster_get_x_skew(rast[1]))) {
- elog(NOTICE, "The two rasters provided have different skews on the X axis");
- err = 1;
+ rtn = rt_raster_same_alignment(
+ rast[0],
+ rast[1],
+ &aligned,
+ &reason
+ );
+ for (k = 0; k < set_count; k++) {
+ rt_raster_destroy(rast[k]);
+ PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
}
- else if (FLT_NEQ(rt_raster_get_y_skew(rast[0]), rt_raster_get_y_skew(rast[1]))) {
- elog(NOTICE, "The two rasters provided have different skews on the Y axis");
- err = 1;
+
+ if (rtn != ES_NONE) {
+ elog(ERROR, "RASTER_sameAlignment: Unable to test for alignment on the two rasters");
+ PG_RETURN_NULL();
}
- if (err) {
- for (k = 0; k < set_count; k++) {
- rt_raster_destroy(rast[k]);
- PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
+ if (reason != NULL)
+ elog(NOTICE, "%s", reason);
+
+ PG_RETURN_BOOL(aligned);
+}
+
+/**
+ * Return a reason why two rasters are not aligned
+ */
+PG_FUNCTION_INFO_V1(RASTER_notSameAlignmentReason);
+Datum RASTER_notSameAlignmentReason(PG_FUNCTION_ARGS)
+{
+ const int set_count = 2;
+ rt_pgraster *pgrast[2];
+ int pgrastpos[2] = {-1, -1};
+ rt_raster rast[2] = {NULL};
+
+ uint32_t i;
+ uint32_t j;
+ uint32_t k;
+ int rtn;
+ int aligned = 0;
+ char *reason = NULL;
+ text *result = NULL;
+
+ for (i = 0, j = 0; i < set_count; i++) {
+ /* pgrast is null, return null */
+ if (PG_ARGISNULL(j)) {
+ for (k = 0; k < i; k++) {
+ rt_raster_destroy(rast[k]);
+ PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
+ }
+ PG_RETURN_NULL();
+ }
+ pgrast[i] = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(j), 0, sizeof(struct rt_raster_serialized_t));
+ pgrastpos[i] = j;
+ j++;
+
+ /* raster */
+ rast[i] = rt_raster_deserialize(pgrast[i], TRUE);
+ if (!rast[i]) {
+ elog(ERROR, "RASTER_notSameAlignmentReason: Could not deserialize the %s raster", i < 1 ? "first" : "second");
+ for (k = 0; k <= i; k++) {
+ if (k < i)
+ rt_raster_destroy(rast[k]);
+ PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
+ }
+ PG_RETURN_NULL();
}
- PG_RETURN_BOOL(0);
}
rtn = rt_raster_same_alignment(
rast[0],
rast[1],
- &aligned
+ &aligned,
+ &reason
);
for (k = 0; k < set_count; k++) {
rt_raster_destroy(rast[k]);
}
if (rtn != ES_NONE) {
- elog(ERROR, "RASTER_sameAlignment: Unable to test for alignment on the two rasters");
+ elog(ERROR, "RASTER_notSameAlignmentReason: Unable to test for alignment on the two rasters");
PG_RETURN_NULL();
}
- PG_RETURN_BOOL(aligned);
+ result = cstring2text(reason);
+ PG_RETURN_TEXT_P(result);
}
/**
*/
/* same alignment */
- if (rt_raster_same_alignment(_rast[0], _rast[1], &aligned) != ES_NONE) {
+ if (rt_raster_same_alignment(_rast[0], _rast[1], &aligned, NULL) != ES_NONE) {
elog(ERROR, "RASTER_mapAlgebra2: Unable to test for alignment on the two rasters");
for (k = 0; k < set_count; k++) {
if (_rast[k] != NULL)
FINALFUNC = _st_samealignment_finalfn
);
+-----------------------------------------------------------------------
+-- ST_NotSameAlignmentReason
+-----------------------------------------------------------------------
+
+CREATE OR REPLACE FUNCTION st_notsamealignmentreason(rast1 raster, rast2 raster)
+ RETURNS text
+ AS 'MODULE_PATHNAME', 'RASTER_notSameAlignmentReason'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+
-----------------------------------------------------------------------
-- ST_Intersects(raster, raster)
-----------------------------------------------------------------------
rt_raster rast2;
int rtn;
int aligned;
+ char *reason;
rast1 = rt_raster_new(2, 2);
assert(rast1);
assert(rast2);
rt_raster_set_scale(rast2, 1, 1);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, NULL);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned != 0));
rt_raster_set_scale(rast2, 0.1, 0.1);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, &reason);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned == 0));
+ CHECK(!strcmp(reason, "The rasters have different scales on the X axis"));
rt_raster_set_scale(rast2, 1, 1);
rt_raster_set_skews(rast2, -0.5, 0.5);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, &reason);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned == 0));
+ CHECK(!strcmp(reason, "The rasters have different skews on the X axis"));
rt_raster_set_skews(rast2, 0, 0);
rt_raster_set_offsets(rast2, 1, 1);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, NULL);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned != 0));
rt_raster_set_offsets(rast2, 2, 3);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, NULL);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned != 0));
rt_raster_set_offsets(rast2, 0.1, 0.1);
- rtn = rt_raster_same_alignment(rast1, rast2, &aligned);
+ rtn = rt_raster_same_alignment(rast1, rast2, &aligned, &reason);
CHECK_EQUALS(rtn, ES_NONE);
CHECK((aligned == 0));
+ CHECK(!strcmp(reason, "The rasters (pixel corner coordinates) are not aligned"));
deepRelease(rast2);
deepRelease(rast1);
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
-NOTICE: The two rasters provided have different scales on the X axis
-NOTICE: The two rasters provided have different scales on the X axis
-NOTICE: The two rasters provided have different scales on the X axis
-NOTICE: The two rasters provided have different scales on the X axis
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters have different scales on the X axis
+NOTICE: The rasters have different scales on the X axis
+NOTICE: The rasters have different scales on the X axis
+NOTICE: The rasters have different scales on the X axis
1.0||||||||||||||||
1.1|993310|100|100|1|1406.537|-869.114|0.000|0.000|-175453.086|114987.661|8BUI|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|0.000|t|1.000|1.000|
5.7|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600991.000|t|t|t
5.8|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600001.000|t|t|t
5.9|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600009.000|t|t|t
+NOTICE: The rasters are aligned
+NOTICE: The rasters (pixel corner coordinates) are not aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
+NOTICE: The rasters are aligned
t|f|t
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0.1)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 1, 1, 1, 1, 0, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
- ST_MakeEmptyRaster(1, 1, 0.1, 0.1, 1, 1, 0, 0)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
-);
-SELECT ST_SameAlignment(
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
- ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
-);
+SET client_min_messages TO warning;
+
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1.1, 1.1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0.1)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0.1)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 1, 1, 1, 1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 1, 1, 1, 1, 0, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0.1, 0.1, 1, 1, 0, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, 0, 0),
+ ST_MakeEmptyRaster(1, 1, 0.1, 0.1, 1, 1, 0, 0)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1)
+ )
+;
+SELECT
+ ST_SameAlignment(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
+ ),
+ ST_NotSameAlignmentReason(
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0.1),
+ ST_MakeEmptyRaster(1, 1, 0, 0, 1, 1, -0.1, 0)
+ )
+;
DROP TABLE IF EXISTS raster_alignment_test;
CREATE TABLE raster_alignment_test AS
+t|The rasters are aligned
+f|The rasters have different scales on the X axis
+f|The rasters have different scales on the X axis
+f|The rasters have different skews on the X axis
+f|The rasters have different skews on the Y axis
+f|The rasters have different skews on the X axis
+t|The rasters are aligned
+f|The rasters (pixel corner coordinates) are not aligned
+t|The rasters are aligned
+f|The rasters have different skews on the Y axis
t
-NOTICE: The two rasters provided have different scales on the X axis
f
-NOTICE: The two rasters provided have different scales on the X axis
f
-NOTICE: The two rasters provided have different skews on the X axis
f
-NOTICE: The two rasters provided have different skews on the Y axis
-f
-NOTICE: The two rasters provided have different skews on the X axis
-f
-t
-f
-t
-NOTICE: The two rasters provided have different skews on the Y axis
-f
-NOTICE: table "raster_alignment_test" does not exist, skipping
-t
-f
-NOTICE: The two rasters provided have different skews on the X axis
-f
-NOTICE: The two rasters provided have different skews on the X axis
-f
-NOTICE: The two rasters provided have different skews on the Y axis
f
f