[GRASS-SVN] r71758 - grass/trunk/raster/r.resamp.filter
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 17 07:11:39 PST 2017
Author: mmetz
Date: 2017-11-17 07:11:39 -0800 (Fri, 17 Nov 2017)
New Revision: 71758
Modified:
grass/trunk/raster/r.resamp.filter/main.c
Log:
r.resamp.filter: fix to support global datasets in latlong
Modified: grass/trunk/raster/r.resamp.filter/main.c
===================================================================
--- grass/trunk/raster/r.resamp.filter/main.c 2017-11-17 10:47:08 UTC (rev 71757)
+++ grass/trunk/raster/r.resamp.filter/main.c 2017-11-17 15:11:39 UTC (rev 71758)
@@ -181,7 +181,7 @@
/*
double x0 = Rast_easting_to_col(dx - f_x_radius, &src_w);
double x1 = Rast_easting_to_col(dx + f_x_radius, &src_w);
- */
+ */
double x0 = (dx - f_x_radius - src_w.west) / src_w.ew_res;
double x1 = (dx + f_x_radius - src_w.west) / src_w.ew_res;
int col0 = (int)floor(x0);
@@ -353,7 +353,12 @@
for (i = num_rows; i < rows; i++) {
G_debug(5, "read: %p = %d", bufs[i], row0 + i);
- Rast_get_d_row(infile, inbuf, row0 + i);
+ /* enlarging the source window to the North and South is
+ * not possible for global maps in ll */
+ if (row0 + i >= 0 && row0 + i < src_w.rows)
+ Rast_get_d_row(infile, inbuf, row0 + i);
+ else
+ Rast_set_d_null_value(inbuf, src_w.cols);
h_filter(bufs[i], inbuf);
}
@@ -522,6 +527,15 @@
int c0 = (int)floor((x0 - f_x_radius - src_w.west) / src_w.ew_res - 0.1);
int c1 = (int)ceil((x1 + f_x_radius - src_w.west) / src_w.ew_res + 0.1);
+ if (G_projection() == PROJECTION_LL) {
+ while (src_w.north + src_w.ns_res * (-r0) > 90 + src_w.ns_res / 2.0) {
+ r0++;
+ }
+ while (src_w.south - src_w.ns_res * (r1 - src_w.rows) < -90 - src_w.ns_res / 2.0) {
+ r1--;
+ }
+ }
+
src_w.south -= src_w.ns_res * (r1 - src_w.rows);
src_w.north += src_w.ns_res * (-r0);
src_w.west -= src_w.ew_res * (-c0);
More information about the grass-commit
mailing list