瀏覽代碼

Rename directories r.univar2 -> r.univar, r.grow2 -> r.grow, r.cats -> r.category
Remove r.proj


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32813 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 17 年之前
父節點
當前提交
1ec0553602

raster/r.cats/Makefile → raster/r.category/Makefile


raster/r.cats/cats.c → raster/r.category/cats.c


raster/r.cats/local_proto.h → raster/r.category/local_proto.h


raster/r.cats/main.c → raster/r.category/main.c


raster/r.cats/r.category.html → raster/r.category/r.category.html


raster/r.grow2/Makefile → raster/r.grow/Makefile


raster/r.grow2/main.c → raster/r.grow/main.c


raster/r.grow2/r.grow.html → raster/r.grow/r.grow.html


+ 0 - 54
raster/r.proj/COMMENT

@@ -1,54 +0,0 @@
-Item: r.proj
-
-I've done some hacking on r.proj:
-       - aborts if the input map is outside current region   
-       - trims the output map to the current region or smaller 
-       - does not allocate more memory than necessary for projecting the 
-          overlapping parts of the input map and output region          
-       - aligns cell edges and centers of the output map exactly to those
-          of output region 
-       - matches (unless changed explicitly) resolution exactly to that     
-           of output region  
-       - during overlap checks, passes cell centers to PROJ instead of   
-         edges (which are invalid in many projections, causing 
-         'Error in do_proj' aborts)                                
-       - allows projecting azimuthal, conical etc maps even if north is   
-          not upward or east is not rightward (no more 'north must be 
-          greater than south' or 'east must be greater than west' errors) 
-
-The question about overlapping cells in projections from adjacent maps that
-have no overlaps (e.g. DEM30 slices): They can't be avoided. E.g.  some of
-the right (east) column cells of one DEM30 map and some of the left (west)
-column cells of the afjacent DEM30 map will eventually be projected into the
-same cell of a conical or azimuthal region. Simply because meridians get
-closer to each other when you approach the poles.  But what is worse is that
-these overlapping cells will probably have different values, because these
-values were resampled from nearest neighbours in different input maps. So
-it's better to r.patch the input maps first, and then do the projection (if
-you have the memory necessary to read in a large input map.)
-                                            
-Most of Martin Schroeder's original code is left untouched. Basically I just
-added a function, boardwalk(), that makes the checks for overlapping parts
-of input map and output region. Plus I moved the memory allocation routine
-forward in the main code, and made some other smaller changes. There are
-some comments in boardwalk.c, and under Changes in main.c
-
-----------------------
-Error message comments:
-
-'Error in pj_do_proj' can happen in any module that uses the proj routines,
-for a variety of reasons:
-
-        -user is trying to project something where source and destination       
-are in the same projection already (like LL->LL). Perhaps the error message
-could be more descriptive in this case, or the module should abort earlier
-(i.e. immediately after checking the PROJ_INFO of source and destination. I
-think m.proj does this, exits with 'No projection needed' message)
-
-        -stepping on a no-no point. This cannot be prevented because in         
-both raster and vector maps there is always a small chance that a node/cell
-falls on a co-ordinate that is a reference point for the projection in
-question, resulting in a division by zero error. (we had an earlier
-discussion on this).
-
-Morten Hulden <morten@ngb.se>

+ 0 - 2
raster/r.proj/DEPRECATED

@@ -1,2 +0,0 @@
-No longer maintained and scheduled for demolition.
-Please use ../r.proj.seg/ instead.

+ 0 - 11
raster/r.proj/Makefile

@@ -1,11 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = r.proj.old
-
-LIBES =  $(GPROJLIB) $(GISLIB)
-DEPENDENCIES = $(GPROJDEP) $(GISDEP)
-EXTRA_INC = $(PROJINC)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 109
raster/r.proj/bilinear.c

@@ -1,109 +0,0 @@
-
-/*
- * Name
- *  bilinear.c -- use bilinear interpolation for given row, col
- *
- * Description
- *  bilinear interpolation for the given row, column indices.
- *  If the given row or column is outside the bounds of the input map,
- *  the point in the output map is set to NULL.
- *  If any of the 4 surrounding points to be used in the interpolation
- *  is NULL it is filled with is neighbor value
- *
- *  See: Press, W.H. et al. (1992), Numerical recipes in C.
- */
-
-#include <math.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-void p_bilinear(FCELL ** ibuffer,	/* input buffer                 */
-		void *obufptr,	/* ptr in output buffer         */
-		int cell_type,	/* raster map type of obufptr   */
-		double *col_idx,	/* column index                 */
-		double *row_idx,	/* row index                    */
-		struct Cell_head *cellhd	/* information of output map    */
-    )
-{
-    int row1,			/* lower row index for interp   */
-      row2,			/* upper row index for interp   */
-      col1,			/* lower column index for interp */
-      col2,			/* upper column index for interp */
-      row, col,			/* Coordinates of pixel center  */
-      x1, x2, y1, y2;		/* temp. buffer indices         */
-    FCELL t, u,			/* intermediate slope           */
-      tu,			/* t * u                        */
-      result;			/* result of interpolation      */
-
-
-
-    /* cut indices to integer */
-    row = (int)floor(*row_idx);
-    col = (int)floor(*col_idx);
-
-    /* check for out of bounds - if out of bounds set NULL value and return */
-    /* check for NULL value                                                 */
-    if (row < 0 || row >= cellhd->rows ||
-	col < 0 || col >= cellhd->cols ||
-	G_is_f_null_value(&ibuffer[row][col])) {
-	G_set_null_value(obufptr, 1, cell_type);
-	return;
-    }
-
-    /* get the four surrounding pixel positions     */
-    row1 = (*row_idx < row) ? row - 1 : row;
-    col1 = (*col_idx < col) ? col - 1 : col;
-
-    row2 = row1 + 1;
-    col2 = col1 + 1;
-
-    x1 = (col1 < 0) ? col2 : col1;
-    x2 = (col2 >= cellhd->cols) ? col1 : col2;
-    y1 = (row1 < 0) ? row2 : row1;
-    y2 = (row2 >= cellhd->rows) ? row1 : row2;
-
-    /* check for NULL value - if a single pixel is NULL,           */
-    /* fill it with neighbor value                                 */
-    if (G_is_f_null_value(&ibuffer[y1][x1])) {
-	y1 = row;
-	x1 = col;
-    }
-
-    if (G_is_f_null_value(&ibuffer[y1][x2])) {
-	y1 = row;
-	x2 = col;
-    }
-
-    if (G_is_f_null_value(&ibuffer[y2][x1])) {
-	y2 = row;
-	x1 = col;
-    }
-
-    if (G_is_f_null_value(&ibuffer[y2][x2])) {
-	y2 = row;
-	x2 = col;
-    }
-
-    /* do the interpolation         */
-    t = *col_idx - col1;
-    u = *row_idx - row1;
-    tu = t * u;
-
-
-    result = ((1 - t - u + tu) * ibuffer[y1][x1]) +
-	((t - tu) * ibuffer[y1][x2]) +
-	((u - tu) * ibuffer[y2][x1]) + (tu * ibuffer[y2][x2]);
-
-    switch (cell_type) {
-    case CELL_TYPE:
-	G_set_raster_value_c(obufptr, (CELL) result, cell_type);
-	break;
-    case FCELL_TYPE:
-	G_set_raster_value_f(obufptr, (FCELL) result, cell_type);
-	break;
-    case DCELL_TYPE:
-	G_set_raster_value_d(obufptr, (DCELL) result, cell_type);
-	break;
-    }
-    return;
-}

+ 0 - 211
raster/r.proj/bordwalk.c

@@ -1,211 +0,0 @@
-/*
- * Function added to r.proj
- * GNU GPL by Morten Hulden <morten@ngb.se>, August 2000
- *
- * bordwalk.c - projects the border cell centers of a map or region
- * to check whether they are inside the borders of another map/region 
- * in a different location, and adjusts the cell header so
- * only overlapping areas are included. The function is called by main,
- * first to project the output region into the input map and trim the
- * borders of this in order to get a smaller map, and faster and less hungry 
- * memory allocation. Then main calls the function again, but reversed,
- * to project the input map on the output region, trimming this down to 
- * the smallest possible rectangular region.
- * 
- * Simply using corner and midpoints (original r.proj) will only work 
- * between cylindrical projections. In other projections, though he input 
- * map is always a rectangular area, the projected output can be of almost 
- * any shape and its position can be rotated any way. It can even be a 
- * discontinous area.
- *
- * In many projections, especially when large areas are displayed, the edges 
- * of rectangular GRASS regions do not necessarily represent east, west, north 
- * and south. Naming the region edges accordingly (as is regions and cellhd) can be 
- * misleading. (Well, invite code readers/writers to make assumptions anyway. Don't 
- * assume north is really direction north in this code ;)
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <grass/gis.h>
-#include <grass/gprojects.h>
-#include <grass/glocale.h>
-
-void bordwalk(struct Cell_head *from_hd, struct Cell_head *to_hd,
-	      struct pj_info *from_pj, struct pj_info *to_pj)
-{
-    double idx;
-    double hx, hy;
-    double xmin, xmax;
-    double ymin, ymax;
-
-    /* Set some (un)reasonable defaults before we walk the borders */
-
-    xmax = to_hd->west - 0.000001;
-    xmin = to_hd->east + 0.000001;
-    ymin = to_hd->north + 0.000001;
-    ymax = to_hd->south - 0.000001;
-
-    /* Start walking */
-
-    /* Top */
-    for (idx = from_hd->west + from_hd->ew_res / 2; idx < from_hd->east;
-	 idx += from_hd->ew_res) {
-	hx = idx;
-	hy = from_hd->north - from_hd->ns_res / 2;
-	if (pj_do_proj(&hx, &hy, from_pj, to_pj) < 0)
-	    continue;
-	/* check if we are within the region, but allow for some 'almost inside' points */
-	/* (should probably be a factor based on input and output resolutions) */
-	if (!(hx < to_hd->west - to_hd->ew_res) &&
-	    !(hx > to_hd->east + to_hd->ew_res) &&
-	    !(hy < to_hd->south - to_hd->ns_res) &&
-	    !(hy > to_hd->north + to_hd->ns_res)) {
-	    xmin = !(hx > xmin) ? hx : xmin;
-	    xmax = !(hx < xmax) ? hx : xmax;
-	    ymin = !(hy > ymin) ? hy : ymin;
-	    ymax = !(hy < ymax) ? hy : ymax;
-	}
-    }
-
-    G_debug(3, "Top: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin, xmax,
-	    ymin, ymax);
-
-    /* Right */
-    for (idx = from_hd->north - from_hd->ns_res / 2; idx > from_hd->south;
-	 idx -= from_hd->ns_res) {
-	hx = from_hd->east - from_hd->ew_res / 2;
-	hy = idx;
-	if (pj_do_proj(&hx, &hy, from_pj, to_pj) < 0)
-	    continue;
-	if (!(hx < to_hd->west - to_hd->ew_res) &&
-	    !(hx > to_hd->east + to_hd->ew_res) &&
-	    !(hy < to_hd->south - to_hd->ns_res) &&
-	    !(hy > to_hd->north + to_hd->ns_res)) {
-	    xmin = !(hx > xmin) ? hx : xmin;
-	    xmax = !(hx < xmax) ? hx : xmax;
-	    ymin = !(hy > ymin) ? hy : ymin;
-	    ymax = !(hy < ymax) ? hy : ymax;
-	}
-    }
-
-    G_debug(3, "Right: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin, xmax,
-	    ymin, ymax);
-
-    /* Bottom */
-    for (idx = from_hd->east - from_hd->ew_res / 2; idx > from_hd->west;
-	 idx -= from_hd->ew_res) {
-	hx = idx;
-	hy = from_hd->south + from_hd->ns_res / 2;
-	if (pj_do_proj(&hx, &hy, from_pj, to_pj) < 0)
-	    continue;
-	if (!(hx < to_hd->west - to_hd->ew_res) &&
-	    !(hx > to_hd->east + to_hd->ew_res) &&
-	    !(hy < to_hd->south - to_hd->ns_res) &&
-	    !(hy > to_hd->north + to_hd->ns_res)) {
-	    xmin = !(hx > xmin) ? hx : xmin;
-	    xmax = !(hx < xmax) ? hx : xmax;
-	    ymin = !(hy > ymin) ? hy : ymin;
-	    ymax = !(hy < ymax) ? hy : ymax;
-	}
-    }
-
-    G_debug(3, "Bottom: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin, xmax,
-	    ymin, ymax);
-
-    /* Left */
-    for (idx = from_hd->south + from_hd->ns_res / 2; idx < from_hd->north;
-	 idx += from_hd->ns_res) {
-	hx = from_hd->west + from_hd->ew_res / 2;
-	hy = idx;
-	if (pj_do_proj(&hx, &hy, from_pj, to_pj) < 0)
-	    continue;
-	if (!(hx < to_hd->west - to_hd->ew_res) &&
-	    !(hx > to_hd->east + to_hd->ew_res) &&
-	    !(hy < to_hd->south - to_hd->ns_res) &&
-	    !(hy > to_hd->north + to_hd->ns_res)) {
-	    xmin = !(hx > xmin) ? hx : xmin;
-	    xmax = !(hx < xmax) ? hx : xmax;
-	    ymin = !(hy > ymin) ? hy : ymin;
-	    ymax = !(hy < ymax) ? hy : ymax;
-	}
-    }
-
-    G_debug(3, "Left: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin, xmax,
-	    ymin, ymax);
-
-    /* check some special cases by reversing the projection */
-
-    if (xmin > to_hd->west) {
-	hx = to_hd->west + to_hd->ew_res / 2;
-	hy = to_hd->south + (to_hd->north - to_hd->south) / 2;
-	if (!(pj_do_proj(&hx, &hy, to_pj, from_pj) < 0) &&
-	    !(hx < from_hd->west) && !(hx > from_hd->east) &&
-	    !(hy < from_hd->south) && !(hy > from_hd->north))
-	    xmin = to_hd->west + to_hd->ew_res / 2;
-    }
-
-    if (xmax < to_hd->east) {
-	hx = to_hd->east - to_hd->ew_res / 2;
-	hy = to_hd->south + (to_hd->north - to_hd->south) / 2;
-	if (!(pj_do_proj(&hx, &hy, to_pj, from_pj) < 0) &&
-	    !(hx < from_hd->west) && !(hx > from_hd->east) &&
-	    !(hy < from_hd->south) && !(hy > from_hd->north))
-	    xmax = to_hd->east - to_hd->ew_res / 2;
-    }
-
-    if (ymin > to_hd->south) {
-	hx = to_hd->west + (to_hd->east - to_hd->west) / 2;
-	hy = to_hd->south + to_hd->ns_res / 2;
-	if (!(pj_do_proj(&hx, &hy, to_pj, from_pj) < 0) &&
-	    !(hx < from_hd->west) && !(hx > from_hd->east) &&
-	    !(hy < from_hd->south) && !(hy > from_hd->north))
-	    ymin = to_hd->south + to_hd->ns_res / 2;
-    }
-
-    if (ymax < to_hd->north) {
-	hx = to_hd->west + (to_hd->east - to_hd->west) / 2;
-	hy = to_hd->north - to_hd->ns_res / 2;
-	if (!(pj_do_proj(&hx, &hy, to_pj, from_pj) < 0) &&
-	    !(hx < from_hd->west) && !(hx > from_hd->east) &&
-	    !(hy < from_hd->south) && !(hy > from_hd->north))
-	    ymax = to_hd->north - to_hd->ns_res / 2;
-    }
-
-    G_debug(3, "Extra check: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin,
-	    xmax, ymin, ymax);
-
-    /* if we still have some unresonable default minmax left, then abort */
-
-    if ((xmin > to_hd->east) || (xmax < to_hd->west)
-	|| (ymin > to_hd->north) || (ymax < to_hd->south))
-	G_fatal_error(_("Input raster map is outside current region"));
-
-    if (xmin < to_hd->west + to_hd->ew_res / 2)
-	xmin = to_hd->west + to_hd->ew_res / 2;
-    if (xmax > to_hd->east - to_hd->ew_res / 2)
-	xmax = to_hd->east - to_hd->ew_res / 2;
-    if (ymin < to_hd->south + to_hd->ns_res / 2)
-	ymin = to_hd->south + to_hd->ns_res / 2;
-    if (ymax > to_hd->north - to_hd->ns_res / 2)
-	ymax = to_hd->north - to_hd->ns_res / 2;
-
-    /* adjust to edges */
-
-    idx = (int)floor(G_easting_to_col(xmin, to_hd));
-    xmin = G_col_to_easting(idx + 0.0, to_hd);
-    idx = (int)floor(G_easting_to_col(xmax, to_hd));
-    xmax = G_col_to_easting(idx + 1.0, to_hd);
-    idx = (int)floor(G_northing_to_row(ymin, to_hd));
-    ymin = G_row_to_northing(idx + 1.0, to_hd);
-    idx = (int)floor(G_northing_to_row(ymax, to_hd));
-    ymax = G_row_to_northing(idx + 0.0, to_hd);
-
-    to_hd->west = (xmin < to_hd->west) ? to_hd->west : xmin;
-    to_hd->east = (xmax > to_hd->east) ? to_hd->east : xmax;
-    to_hd->south = (ymin < to_hd->south) ? to_hd->south : ymin;
-    to_hd->north = (ymax > to_hd->north) ? to_hd->north : ymax;
-
-    G_debug(3, "Final check: xmin: %f; xmax: %f; ymin: %f; ymax: %f", xmin,
-	    xmax, ymin, ymax);
-}

+ 0 - 138
raster/r.proj/cubic.c

@@ -1,138 +0,0 @@
-/*
- * Name
- *  cubic.c -- use cubic convolution interpolation for given row, col
- * 
- * Description
- *  cubic returns the value in the buffer that is the result of cubic
- *  convolution interpolation for the given row, column indices.
- *  If the given row or column is outside the bounds of the input map,
- *  the corresponding point in the output map is set to NULL.
- *  
- *  If single surrounding points in the interpolation matrix are 
- *  NULL they where filled with their neighbor
- * 
- *  See: Richards, John A. (1993), Remote Sensing Digital Image Analysis,
- *       Springer-Verlag, Berlin, 2nd edition.
- */
-
-#include <math.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-
-
-void p_cubic(FCELL ** ibuffer,	/* input buffer                  */
-	     void *obufptr,	/* ptr in output buffer          */
-	     int cell_type,	/* raster map type of obufptr    */
-	     double *col_idx,	/* column index (decimal)        */
-	     double *row_idx,	/* row index (decimal)           */
-	     struct Cell_head *cellhd	/* information of output map     */
-    )
-{
-    int row,			/* row indices for interp        */
-      mrow[4],			/* row in matrix                 */
-      col,			/* column indices for interp     */
-      mcol[4];			/* column in matrix              */
-
-    int i, j;
-    FCELL t, u,			/* intermediate slope            */
-      result,			/* result of interpolation       */
-      val[4];			/* buffer for temporary values   */
-
-
-
-    /* cut indices to integer */
-    row = (int)floor(*row_idx);
-    col = (int)floor(*col_idx);
-
-
-    /* check for out of bounds of map - if out of bounds set NULL value  */
-    /* check for NULL value                                              */
-    if (row < 0 || row >= cellhd->rows ||
-	col < 0 || col >= cellhd->cols ||
-	G_is_f_null_value(&ibuffer[row][col])) {
-	G_set_null_value(obufptr, 1, cell_type);
-	return;
-    }
-
-    /* get matrix                */
-    mrow[1] = (*row_idx < row) ? row - 1 : row;
-    mrow[2] = mrow[1] + 1;
-    mrow[3] = mrow[1] + 2;
-    mrow[0] = mrow[1] - 1;
-
-    mcol[1] = (*col_idx < col) ? col - 1 : col;
-    mcol[2] = mcol[1] + 1;
-    mcol[3] = mcol[1] + 2;
-    mcol[0] = mcol[1] - 1;
-
-    /* get relative index        */
-    t = *col_idx - mcol[1];
-    u = *row_idx - mrow[1];
-
-
-    /* if single pixels out of bounds, fill with nearest neighbor        */
-    mcol[1] = (mcol[1] < 0) ? mcol[2] : mcol[1];
-    mcol[0] = (mcol[0] < 0) ? mcol[1] : mcol[0];
-    mcol[2] = (mcol[2] >= cellhd->cols) ? mcol[1] : mcol[2];
-    mcol[3] = (mcol[3] >= cellhd->cols) ? mcol[2] : mcol[3];
-
-    mrow[1] = (mrow[1] < 0) ? mrow[2] : mrow[1];
-    mrow[0] = (mrow[0] < 0) ? mrow[1] : mrow[0];
-    mrow[2] = (mrow[2] >= cellhd->rows) ? mrow[1] : mrow[2];
-    mrow[3] = (mrow[3] >= cellhd->rows) ? mrow[2] : mrow[3];
-
-
-    /* Check all 16 pixels for NULL value        */
-    /* (not an optimal solution - check later)   */
-    for (i = 0; i < 4; i++)
-	for (j = 0; j < 4; j++)
-	    if (G_is_f_null_value(&ibuffer[mrow[i]][mcol[j]])) {
-		mrow[i] = row;
-		mcol[j] = col;
-	    }
-
-    /* and now the interpolation */
-    G_debug(3, "Matrix used:");
-    for (i = 0; i < 4; i++)
-	G_debug(3, "%d %d %d %d",
-		(int)ibuffer[mrow[i]][mcol[0]],
-		(int)ibuffer[mrow[i]][mcol[1]],
-		(int)ibuffer[mrow[i]][mcol[2]],
-		(int)ibuffer[mrow[i]][mcol[3]]);
-
-    for (i = 0; i < 4; i++) {
-	FCELL *cp = ibuffer[mrow[i]];
-	FCELL c0 = cp[mcol[0]];
-	FCELL c1 = cp[mcol[1]];
-	FCELL c2 = cp[mcol[2]];
-	FCELL c3 = cp[mcol[3]];
-
-	val[i] = (t * (t * (t * (c3 - 3 * c2 + 3 * c1 - c0) +
-			    (-c3 + 4 * c2 - 5 * c1 + 2 * c0)) +
-		       (c2 - c0)) + 2 * c1) / 2;
-
-	G_debug(3, "Ipolval[%d] = %f", i, val[i]);
-    }
-
-    result = (u * (u * (u * (val[3] - 3 * val[2] + 3 * val[1] - val[0]) +
-			(-val[3] + 4 * val[2] - 5 * val[1] + 2 * val[0])) +
-		   (val[2] - val[0])) + 2 * val[1]) / 2;
-
-    G_debug(3, "r1: %d  ridx: %f  c1: %d  cidx: %f  Value: %f",
-	    row, u, col, t, result);
-
-    switch (cell_type) {
-    case CELL_TYPE:
-	G_set_raster_value_c(obufptr, (CELL) result, cell_type);
-	break;
-    case FCELL_TYPE:
-	G_set_raster_value_f(obufptr, (FCELL) result, cell_type);
-	break;
-    case DCELL_TYPE:
-	G_set_raster_value_d(obufptr, (DCELL) result, cell_type);
-	break;
-    }
-
-    return;
-}

+ 0 - 2
raster/r.proj/local_proto.h

@@ -1,2 +0,0 @@
-/* readcell.c */
-FCELL **readcell(int);

+ 0 - 468
raster/r.proj/main.c

@@ -1,468 +0,0 @@
-
-/***************************************************************************
-*
-* MODULE:       r.proj
-*
-* AUTHOR(S):    Martin Schroeder
-*		 University of Heidelberg
-*		 Dept. of Geography
-*		 emes@geo0.geog.uni-heidelberg.de
-*
-* 		 (With the help of a lot of existing GRASS sources, in 
-*		  particular v.proj) 
-*
-* PURPOSE:      r.proj converts a map to a new geographic projection. It reads a
-*	        map from a different location, projects it and write it out
-*	        to the current location. The projected data is resampled with
-*	        one of three different methods: nearest neighbor, bilinear and
-*	        cubic convolution.
-*
-* COPYRIGHT:    (C) 2001 by the GRASS Development Team
-*
-*               This program is free software under the GNU General Public
-*               License (>=v2). Read the file COPYING that comes with GRASS
-*               for details.
-*
-* Changes
-*		 Morten Hulden <morten@ngb.se>, Aug 2000:
-*		 - aborts if input map is outside current location.
-*		 - can handle projections (conic, azimuthal etc) where 
-*		 part of the map may fall into areas where south is 
-*		 upward and east is leftward.
-*		 - avoids passing location edge coordinates to PROJ
-*		 (they may be invalid in some projections).
-*		 - output map will be clipped to borders of the current region.
-*		 - output map cell edges and centers will coinside with those 
-*		 of the current region.
-*		 - output map resolution (unless changed explicitly) will
-*		 match (exactly) the resolution of the current region.
-*		 - if the input map is smaller than the current region, the 
-*		 output map will only cover the overlapping area.
-*                - if the input map is larger than the current region, only the
-*		 needed amount of memory will be allocated for the projection
-*	
-*		 Bugfixes 20050328: added floor() before (int) typecasts to in avoid
-*		 assymetrical rounding errors. Added missing offset outcellhd.ew_res/2 
-*		 to initial xcoord for each row in main projection loop (we want to  project 
-*		 center of cell, not border).
-*****************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/gprojects.h>
-#include <grass/glocale.h>
-#include "r.proj.h"
-
-/* modify this table to add new methods */
-struct menu menu[] = {
-    {p_nearest, "nearest", "nearest neighbor"},
-    {p_bilinear, "bilinear", "bilinear"},
-    {p_cubic, "cubic", "cubic convolution"},
-    {NULL, NULL, NULL}
-};
-
-static char *make_ipol_list(void);
-
-int main(int argc, char **argv)
-{
-    char *mapname,		/* ptr to name of output layer  */
-     *setname,			/* ptr to name of input mapset  */
-     *ipolname;			/* name of interpolation method */
-
-    int fdi,			/* input map file descriptor    */
-      fdo,			/* output map file descriptor   */
-      method,			/* position of method in table  */
-      permissions,		/* mapset permissions           */
-      cell_type,		/* output celltype              */
-      cell_size,		/* size of a cell in bytes      */
-      row, col,			/* counters                     */
-      irows, icols,		/* original rows, cols          */
-      orows, ocols, have_colors,	/* Input map has a colour table */
-      overwrite;		/* overwrite output map         */
-
-    void *obuffer,		/* buffer that holds one output row     */
-     *obufptr;			/* column ptr in output buffer  */
-    FCELL **ibuffer;		/* buffer that holds the input map      */
-    func interpolate;		/* interpolation routine        */
-
-    double xcoord1, xcoord2,	/* temporary x coordinates      */
-      ycoord1, ycoord2,		/* temporary y coordinates      */
-      col_idx,			/* column index in input matrix */
-      row_idx,			/* row index in input matrix    */
-      onorth, osouth,		/* save original border coords  */
-      oeast, owest, inorth, isouth, ieast, iwest;
-
-    struct Colors colr;		/* Input map colour table       */
-    struct History history;
-
-    struct pj_info iproj,	/* input map proj parameters    */
-      oproj;			/* output map proj parameters   */
-
-    struct Key_Value *in_proj_info,	/* projection information of    */
-     *in_unit_info,		/* input and output mapsets     */
-     *out_proj_info, *out_unit_info;
-
-    struct GModule *module;
-
-    struct Flag *list,		/* list files in source location */
-     *nocrop;			/* don't crop output map        */
-
-    struct Option *imapset,	/* name of input mapset         */
-     *inmap,			/* name of input layer          */
-     *inlocation,		/* name of input location       */
-     *outmap,			/* name of output layer         */
-     *indbase,			/* name of input database       */
-     *interpol,			/* interpolation method:
-				   nearest neighbor, bilinear, cubic */
-     *res;			/* resolution of target map     */
-    struct Cell_head incellhd,	/* cell header of input map     */
-      outcellhd;		/* and output map               */
-
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("raster, projection");
-    module->description =
-	_("Re-projects a raster map from one location to the current location.");
-
-    inmap = G_define_standard_option(G_OPT_R_INPUT);
-    inmap->description = _("Name of input raster map to re-project");
-    inmap->required = NO;
-
-    inlocation = G_define_option();
-    inlocation->key = "location";
-    inlocation->type = TYPE_STRING;
-    inlocation->required = YES;
-    inlocation->description = _("Location of input raster map");
-
-    imapset = G_define_option();
-    imapset->key = "mapset";
-    imapset->type = TYPE_STRING;
-    imapset->required = NO;
-    imapset->description = _("Mapset of input raster map");
-
-    indbase = G_define_option();
-    indbase->key = "dbase";
-    indbase->type = TYPE_STRING;
-    indbase->required = NO;
-    indbase->description = _("Path to GRASS database of input location");
-
-    outmap = G_define_standard_option(G_OPT_R_OUTPUT);
-    outmap->required = NO;
-    outmap->description = _("Name for output raster map (default: input)");
-
-    ipolname = make_ipol_list();
-
-    interpol = G_define_option();
-    interpol->key = "method";
-    interpol->type = TYPE_STRING;
-    interpol->required = NO;
-    interpol->answer = "nearest";
-    interpol->options = ipolname;
-    interpol->description = _("Interpolation method to use");
-
-    res = G_define_option();
-    res->key = "resolution";
-    res->type = TYPE_DOUBLE;
-    res->required = NO;
-    res->description = _("Resolution of output map");
-
-    list = G_define_flag();
-    list->key = 'l';
-    list->description = _("List raster maps in input location and exit");
-
-    nocrop = G_define_flag();
-    nocrop->key = 'n';
-    nocrop->description = _("Do not perform region cropping optimization");
-
-    /* The parser checks if the map already exists in current mapset,
-       we switch out the check and do it
-       * in the module after the parser */
-    overwrite = G_check_overwrite(argc, argv);
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    /* get the method */
-    for (method = 0; (ipolname = menu[method].name); method++)
-	if (strcmp(ipolname, interpol->answer) == 0)
-	    break;
-
-    if (!ipolname)
-	G_fatal_error(_("<%s=%s> unknown %s"),
-		      interpol->key, interpol->answer, interpol->key);
-    interpolate = menu[method].method;
-
-    mapname = outmap->answer ? outmap->answer : inmap->answer;
-    if (mapname && !list->answer && !overwrite &&
-	G_find_cell(mapname, G_mapset()))
-	G_fatal_error(_("option <%s>: <%s> exists."), "output", mapname);
-
-    setname = imapset->answer ? imapset->answer : G_store(G_mapset());
-
-    if (!indbase->answer && strcmp(inlocation->answer, G_location()) == 0)
-	G_fatal_error(_("Input and output locations can not be the same"));
-
-    G_get_window(&outcellhd);
-
-    /* Get projection info for output mapset */
-    if ((out_proj_info = G_get_projinfo()) == NULL)
-	G_fatal_error(_("Unable to get projection info of output raster map"));
-
-    if ((out_unit_info = G_get_projunits()) == NULL)
-	G_fatal_error(_("Unable to get projection units of output raster map"));
-
-    if (pj_get_kv(&oproj, out_proj_info, out_unit_info) < 0)
-	G_fatal_error(_("Unable to get projection key values of output raster map"));
-
-    /* Change the location           */
-    G__create_alt_env();
-    G__setenv("GISDBASE", indbase->answer ? indbase->answer : G_gisdbase());
-    G__setenv("LOCATION_NAME", inlocation->answer);
-
-    permissions = G__mapset_permissions(setname);
-    if (permissions < 0)	/* can't access mapset       */
-	G_fatal_error(_("Mapset <%s> in input location <%s> - %s"),
-		      setname, inlocation->answer,
-		      permissions == 0 ? _("permission denied")
-		      : _("not found"));
-
-    /* if requested, list the raster maps in source location - MN 5/2001 */
-    if (list->answer) {
-	if (isatty(0))		/* check if on command line */
-	    G_message(_("Checking location <%s>, mapset <%s>..."),
-		      inlocation->answer, setname);
-	G_list_element("cell", "raster", setname, 0);
-	exit(EXIT_SUCCESS);	/* leave r.proj after listing */
-    }
-
-    if (!inmap->answer)
-	G_fatal_error(_("Required parameter <%s> not set"), inmap->key);
-
-    if (!G_find_cell(inmap->answer, setname))
-	G_fatal_error(_("Raster map <%s> in location <%s> in mapset <%s> not found"),
-		      inmap->answer, inlocation->answer, setname);
-
-    /* Read input map colour table */
-    have_colors = G_read_colors(inmap->answer, setname, &colr);
-
-    /* Get projection info for input mapset */
-    if ((in_proj_info = G_get_projinfo()) == NULL)
-	G_fatal_error(_("Unable to get projection info of input map"));
-
-    if ((in_unit_info = G_get_projunits()) == NULL)
-	G_fatal_error(_("Unable to get projection units of input map"));
-
-    if (pj_get_kv(&iproj, in_proj_info, in_unit_info) < 0)
-	G_fatal_error(_("Unable to get projection key values of input map"));
-
-    G_free_key_value(in_proj_info);
-    G_free_key_value(in_unit_info);
-    G_free_key_value(out_proj_info);
-    G_free_key_value(out_unit_info);
-    pj_print_proj_params(&iproj, &oproj);
-
-    /* this call causes r.proj to read the entire map into memeory */
-    G_get_cellhd(inmap->answer, setname, &incellhd);
-
-    G_set_window(&incellhd);
-
-    if (G_projection() == PROJECTION_XY)
-	G_fatal_error(_("Unable to work with unprojected data (xy location)"));
-
-    /* Save default borders so we can show them later */
-    inorth = incellhd.north;
-    isouth = incellhd.south;
-    ieast = incellhd.east;
-    iwest = incellhd.west;
-    irows = incellhd.rows;
-    icols = incellhd.cols;
-
-    onorth = outcellhd.north;
-    osouth = outcellhd.south;
-    oeast = outcellhd.east;
-    owest = outcellhd.west;
-    orows = outcellhd.rows;
-    ocols = outcellhd.cols;
-
-    /* Cut non-overlapping parts of input map */
-    if (!nocrop->answer)
-	bordwalk(&outcellhd, &incellhd, &oproj, &iproj);
-
-    /* Add 2 cells on each side for bilinear/cubic & future interpolation methods */
-    /* (should probably be a factor based on input and output resolution) */
-    incellhd.north += 2 * incellhd.ns_res;
-    incellhd.east += 2 * incellhd.ew_res;
-    incellhd.south -= 2 * incellhd.ns_res;
-    incellhd.west -= 2 * incellhd.ew_res;
-    if (incellhd.north > inorth)
-	incellhd.north = inorth;
-    if (incellhd.east > ieast)
-	incellhd.east = ieast;
-    if (incellhd.south < isouth)
-	incellhd.south = isouth;
-    if (incellhd.west < iwest)
-	incellhd.west = iwest;
-
-    G_set_window(&incellhd);
-
-    /* And switch back to original location */
-
-    G__switch_env();
-
-    /* Adjust borders of output map */
-
-    if (!nocrop->answer)
-	bordwalk(&incellhd, &outcellhd, &iproj, &oproj);
-
-#if 0
-    outcellhd.west = outcellhd.south = HUGE_VAL;
-    outcellhd.east = outcellhd.north = -HUGE_VAL;
-    for (row = 0; row < incellhd.rows; row++) {
-	ycoord1 = G_row_to_northing((double)(row + 0.5), &incellhd);
-	for (col = 0; col < incellhd.cols; col++) {
-	    xcoord1 = G_col_to_easting((double)(col + 0.5), &incellhd);
-	    pj_do_proj(&xcoord1, &ycoord1, &iproj, &oproj);
-	    if (xcoord1 > outcellhd.east)
-		outcellhd.east = xcoord1;
-	    if (ycoord1 > outcellhd.north)
-		outcellhd.north = ycoord1;
-	    if (xcoord1 < outcellhd.west)
-		outcellhd.west = xcoord1;
-	    if (ycoord1 < outcellhd.south)
-		outcellhd.south = ycoord1;
-	}
-    }
-#endif
-
-    if (res->answer != NULL)	/* set user defined resolution */
-	outcellhd.ns_res = outcellhd.ew_res = atof(res->answer);
-
-    G_adjust_Cell_head(&outcellhd, 0, 0);
-    G_set_window(&outcellhd);
-
-    G_message(NULL);
-    G_message(_("Input:"));
-    G_message(_("Cols: %d (%d)"), incellhd.cols, icols);
-    G_message(_("Rows: %d (%d)"), incellhd.rows, irows);
-    G_message(_("North: %f (%f)"), incellhd.north, inorth);
-    G_message(_("South: %f (%f)"), incellhd.south, isouth);
-    G_message(_("West: %f (%f)"), incellhd.west, iwest);
-    G_message(_("East: %f (%f)"), incellhd.east, ieast);
-    G_message(_("EW-res: %f"), incellhd.ew_res);
-    G_message(_("NS-res: %f"), incellhd.ns_res);
-
-    G_message(NULL);
-    G_message(_("Output:"));
-    G_message(_("Cols: %d (%d)"), outcellhd.cols, ocols);
-    G_message(_("Rows: %d (%d)"), outcellhd.rows, orows);
-    G_message(_("North: %f (%f)"), outcellhd.north, onorth);
-    G_message(_("South: %f (%f)"), outcellhd.south, osouth);
-    G_message(_("West: %f (%f)"), outcellhd.west, owest);
-    G_message(_("East: %f (%f)"), outcellhd.east, oeast);
-    G_message(_("EW-res: %f"), outcellhd.ew_res);
-    G_message(_("NS-res: %f"), outcellhd.ns_res);
-    G_message(NULL);
-
-    /* open and read the relevant parts of the input map and close it */
-    G__switch_env();
-    G_set_window(&incellhd);
-    fdi = G_open_cell_old(inmap->answer, setname);
-    cell_type = G_get_raster_map_type(fdi);
-    ibuffer = (FCELL **) readcell(fdi);
-    G_close_cell(fdi);
-
-    G__switch_env();
-    G_set_window(&outcellhd);
-
-    if (strcmp(interpol->answer, "nearest") == 0) {
-	fdo = G_open_raster_new(mapname, cell_type);
-	obuffer = (CELL *) G_allocate_raster_buf(cell_type);
-    }
-    else {
-	fdo = G_open_fp_cell_new(mapname);
-	cell_type = FCELL_TYPE;
-	obuffer = (FCELL *) G_allocate_raster_buf(cell_type);
-    }
-
-    cell_size = G_raster_size(cell_type);
-
-    xcoord1 = xcoord2 = outcellhd.west + (outcellhd.ew_res / 2);
-    /**/ ycoord1 = ycoord2 = outcellhd.north - (outcellhd.ns_res / 2);
-    /**/ G_important_message(_("Projecting..."));
-    G_percent(0, outcellhd.rows, 2);
-
-    for (row = 0; row < outcellhd.rows; row++) {
-	obufptr = obuffer;
-
-	for (col = 0; col < outcellhd.cols; col++) {
-	    /* project coordinates in output matrix to       */
-	    /* coordinates in input matrix                   */
-	    if (pj_do_proj(&xcoord1, &ycoord1, &oproj, &iproj) < 0)
-		G_set_null_value(obufptr, 1, cell_type);
-	    else {
-		/* convert to row/column indices of input matrix */
-		col_idx = (xcoord1 - incellhd.west) / incellhd.ew_res;
-		row_idx = (incellhd.north - ycoord1) / incellhd.ns_res;
-
-		/* and resample data point               */
-		interpolate(ibuffer, obufptr, cell_type,
-			    &col_idx, &row_idx, &incellhd);
-	    }
-
-	    obufptr = G_incr_void_ptr(obufptr, cell_size);
-	    xcoord2 += outcellhd.ew_res;
-	    xcoord1 = xcoord2;
-	    ycoord1 = ycoord2;
-	}
-
-	if (G_put_raster_row(fdo, obuffer, cell_type) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"), mapname,
-			  row);
-
-	xcoord1 = xcoord2 = outcellhd.west + (outcellhd.ew_res / 2);
-	ycoord2 -= outcellhd.ns_res;
-	ycoord1 = ycoord2;
-	G_percent(row, outcellhd.rows - 1, 2);
-    }
-
-    G_close_cell(fdo);
-
-    if (have_colors > 0) {
-	G_write_colors(mapname, G_mapset(), &colr);
-	G_free_colors(&colr);
-    }
-
-    G_short_history(mapname, "raster", &history);
-    G_command_history(&history);
-    G_write_history(mapname, &history);
-
-    G_done_msg(" ");
-    exit(EXIT_SUCCESS);
-}
-
-static char *make_ipol_list(void)
-{
-    int size = 0;
-    int i;
-    char *buf;
-
-    for (i = 0; menu[i].name; i++)
-	size += strlen(menu[i].name) + 1;
-
-    buf = G_malloc(size);
-    *buf = '\0';
-
-    for (i = 0; menu[i].name; i++) {
-	if (i)
-	    strcat(buf, ",");
-	strcat(buf, menu[i].name);
-    }
-
-    return buf;
-}

+ 0 - 51
raster/r.proj/nearest.c

@@ -1,51 +0,0 @@
-
-/*
- *      nearest.c - returns the nearest neighbor to a given 
- *                  x,y position
- */
-
-#include <math.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-
-void p_nearest(FCELL ** ibuffer,	/* input matrix                  */
-	       void *obufptr,	/* ptr in output buffer          */
-	       int cell_type,	/* raster map type of obufptr    */
-	       double *col_idx,	/* column index in input matrix  */
-	       double *row_idx,	/* row index in input matrix     */
-	       struct Cell_head *cellhd	/* cell header of input layer    */
-    )
-{
-    int row, col;		/* row/col of nearest neighbor   */
-
-
-
-    /* cut indices to integer */
-    row = (int)floor(*row_idx);
-    col = (int)floor(*col_idx);
-
-
-    /* check for out of bounds - if out of bounds set NULL value  */
-    if (row < 0 || row >= cellhd->rows ||
-	col < 0 || col >= cellhd->cols ||
-	G_is_f_null_value(&ibuffer[row][col])) {
-	G_set_null_value(obufptr, 1, cell_type);
-	return;
-    }
-
-
-    switch (cell_type) {
-    case CELL_TYPE:
-	G_set_raster_value_c(obufptr, (CELL) ibuffer[row][col], cell_type);
-	break;
-    case FCELL_TYPE:
-	G_set_raster_value_f(obufptr, (FCELL) ibuffer[row][col], cell_type);
-	break;
-    case DCELL_TYPE:
-	G_set_raster_value_d(obufptr, (DCELL) ibuffer[row][col], cell_type);
-	break;
-    }
-
-    return;
-}

+ 0 - 31
raster/r.proj/r.proj.h

@@ -1,31 +0,0 @@
-/* @(#)r.proj.h v1.2 - 27 Jun 1995      -emes- */
-
-#ifndef R_PROJ_H
-#define R_PROJ_H
-
-typedef void (*func) (FCELL **, void *, int, double *, double *,
-		      struct Cell_head *);
-
-struct menu
-{
-    func method;		/* routine to interpolate new value      */
-    char *name;			/* method name                           */
-    char *text;			/* menu display - full description       */
-};
-
-extern void bordwalk(struct Cell_head *, struct Cell_head *, struct pj_info *,
-		     struct pj_info *);
-extern FCELL **readcell(int);
-
-/* declare resampling methods */
-/* bilinear.c */
-extern void p_bilinear(FCELL **, void *, int, double *, double *,
-		       struct Cell_head *);
-/* cubic.c */
-extern void p_cubic(FCELL **, void *, int, double *, double *,
-		    struct Cell_head *);
-/* nearest.c */
-extern void p_nearest(FCELL **, void *, int, double *, double *,
-		      struct Cell_head *);
-
-#endif

+ 0 - 197
raster/r.proj/r.proj.html

@@ -1,197 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-
-<em>r.proj</em> projects a raster map in a specified mapset of a
-specified location from the projection of the input location to a raster map
-in the current location. The projection information is taken from the
-current PROJ_INFO files, as set with <i><a href="g.setproj.html">g.setproj</a>
-</i> and viewed with <i><a href="g.proj.html">g.proj</a></i>.
-
-<h4>Introduction</h4>
-
-<h5>Map projections</h5>
-
-Map projections are a method of representing information from a
-curved surface (usually a spheroid) in two dimensions, typically to allow
-indexing through cartesian coordinates.  There are a wide variety of
-projections, with common ones divided into a number of classes, including
-cylindrical and pseudo-cylindrical, conic and pseudo-conic, and azimuthal
-methods, each of which may be conformal, equal-area, or neither.  
-<p>
-The particular projection chosen depends on the purpose of the project,
-and the size, shape and location of the area of interest.  For example,
-normal cylindrical projections are good for maps which are of greater extent
-east-west than north-south and in equatorial regions, while conic
-projections are better in mid-latitudes;  transverse cylindrical projections
-are used for maps which are of greater extent north-south than east-west;
-azimuthal projections are used for polar regions.  Oblique versions of any
-of these may also be used.  Conformal projections preserve angular
-relationships, and better preserve arc-length, while equal-area projections
-are more appropriate for statistical studies and work in which the amount of
-material is important.  
-<p>
-Projections are defined by precise mathematical relations, so the method
-of projecting coordinates from a geographic reference frame
-(latitude-longitude) into a projected cartesian reference frame (eg metres)
-is governed by these equations.  Inverse projections can also be achieved. 
-The public-domain Unix software package <i>PROJ</i> [1] has been designed to
-perform these transformations, and the user's manual contains a detailed
-description of over 100 useful projections.  This also includes a
-programmers library of the projection methods to support other software
-development.  
-<p>
-Thus, converting a vector map - in which objects are located
-with arbitrary spatial precision - from one projection into another is
-usually accomplished by a simple two-step process:  first the location of
-all the points in the map are converted from the source through an inverse
-projection into latitude-longitude, and then through a forward projection
-into the target.  (Of course the procedure will be one-step if either the
-source or target is in geographic coordinates.)
-<p>
-Converting a raster map, or image, between different projections, 
-however, involves additional considerations.  
-A raster may be considered to represent a sampling of a
-process at a regular, ordered set of locations.  The set of locations that
-lie at the intersections of a cartesian grid in one projection will not, in
-general, coincide with the sample points in another projection.  Thus, the
-conversion of raster maps involves an interpolation step in which the values
-of points at intermediate locations relative to the source grid are
-estimated.
-
-<h5>Projecting vector maps within the GRASS GIS</h5>
-<!-- move this into v.proj.html !! -->
-GIS data capture, import and transfer often requires a projection
-step, since the source or client will frequently be in a different
-projection to the working projection.
-<p>
-In some cases it is convenient to do the conversion outside the package,
-prior to import or after export, using software such as <i>PROJ.4</i>'s
-<i><a href="http://proj.maptools.org/">cs2cs</a></i> [1]. This is an easy
-method for converting an ASCII file containing a list of coordinate points,
-since there is no topology to be preserved and <i>cs2cs</i> can be used to
-process simple lists using a one-line command.
-<p>
-The format of files containg vector maps with <b>lines</b> and <b>arcs</b> is
-generally more complex, as parts of the data stored in the files will describe
-topology, and not just coordinates. In GRASS GIS the
-<i><a href="v.proj.html">v.proj</a></i> module is provided to reproject
-vector maps, transferring topology and attributes as well as node coordinates.
-This program uses the projection definition and parameters which are stored in
-the PROJ_INFO and PROJ_UNITS files in the PERMANENT mapset directory for every
-GRASS location.
-<br><br>
-
-<h4>Design of r.proj</h4>
-
-As discussed briefly above, the fundamental step in re-projecting a
-raster is resampling the source grid at locations corresponding to the
-intersections of a grid in the target projection. The basic procedure for
-accomplishing this, therefore, is as follows:
-<p>
-<em>r.proj</em> converts a map to a new geographic projection. It reads a
-map from a different location, projects it and write it out to the current
-location.
-<br>
-The projected data is resampled with one of three different methods: 
-nearest neighbor, bilinear and cubic convolution.
-<p>
-The <em>method=nearest</em>, which performs a nearest neighbor assignment,
-is the fastest of the three resampling methods. It is primarily used for
-categorical data such as a land use classification, since it will not change
-the values of the data cells. The <em>method=bilinear</em> determines the new
-value of the cell based on a weighted distance average of the 4 surrounding
-cells in the input map. The <em>method=cubic</em> determines the new value of
-the cell based on a weighted distance average of the 16 surrounding cells in
-the input map.
-<p>
-The bilinear and cubic interpolation methods are most appropriate for
-continuous data and cause some smoothing. Both options should not be used
-with categorical data, since the cell values will be altered.
-<p>
-If nearest neighbor assignment is used, the output map has the same raster
-format as the input map. If any of the both interpolations is used, the
-output map is written as floating point.
-
-<p>
-Note that, following normal GRASS conventions, the coverage and
-resolution of the resulting grid is set by the current region settings,
-which may be adjusted using <i>g.region</i>.  The target raster will be
-relatively unbiased for all cases if its grid has a similar resolution to
-the source, so that the resampling/interpolation step is only a local
-operation.  If the resolution is changed significantly, then the behaviour
-of the generalisation or refinement will depend on the model of the process
-being represented.  This will be very different for categorical versus
-numerical data.  Note that three methods for the local interpolation step
-are provided.
-
-<p>
-<em>r.proj</em> supports general datum transformations, making use of the
-<em>PROJ.4</em> co-ordinate system translation library.
-</p>
-
-<h2>NOTES</h2>
-
-To avoid excessive time consumption when reprojecting a map the region and 
-resolution of the target location should be set appropriately beforehand.
-A simple way to do this is to generate a vector "box" map of the region in  
-the source location using <em><a href="v.in.region.html">v.in.region</a></em>.
-This "box" map is then reprojected into the target location with
-<em><a href="v.proj.html">v.proj</a></em>.
-Next the region in the target location is set to the extent of the new vector
-map with <em><a href="g.region.html">g.region</a></em> along with the desired
-raster resolution (<em>g.region -m</em> can be used in Latitude/Longitude
-locations to measure the geodetic length of a pixel).
-<em>r.proj</em> is then run for the raster map the user wants to reproject.
-In this case a little preparation goes a long way.
-<p>
-When reprojecting whole-world maps the user should disable map-trimming with
-the <em>-n</em> flag. Trimming is not useful here because the module has the
-whole map in memory anyway. Besides that, world "edges" are hard (or
-impossible) to find in projections other than latitude-longitude so results
-may be odd with trimming.
-
-<h2>REFERENCES</h2>
-
-[1] Evenden, G.I.  (1990) <a href="http://proj.maptools.org/">Cartographic projection procedures for
-the UNIX environment - a user's manual.</a>  USGS Open-File Report 90-284 (OF90-284.pdf)
-See also there: Interim Report and 2nd Interim Report on Release 4, Evenden 1994).
-<p>
-Richards, John A. (1993), Remote Sensing Digital Image Analysis,
-Springer-Verlag, Berlin, 2nd edition. 
-<p>
-<a href=http://proj.maptools.org/>PROJ.4</a>: Projection/datum support library.
-<p>
-<b>Further reading</b>
-<ul>
-<li> <a href="http://www.asprs.org/resources/grids/">ASPRS Grids and Datum</a>
-<li> <a href="http://www.remotesensing.org/geotiff/proj_list/">Projections Transform List</a> (PROJ.4)
-<li> <a href="http://www.mapref.org">MapRef - The Collection of Map Projections and Reference Systems for Europe</a> 
-<li> <a href="http://crs.bkg.bund.de/crs-eu/">Information and Service System for European Coordinate Reference Systems - CRS</a>
-</ul>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="g.region.html">g.region</a>,
-<a href="g.proj.html">g.proj</a>,
-<a href="g.setproj.html">g.setproj</a>,
-<a href="i.rectify.html">i.rectify</a>,
-<a href="r.support.html">r.support</a>,
-<a href="r.stats.html">r.stats</a>,
-<a href="v.proj.html">v.proj</a>,
-<a href="v.in.region.html">v.in.region</a>
-</em>
-<p>
-The 'gdalwarp' and 'gdal_translate' utilities are available from the 
-<a href="http://www.gdal.org">GDAL</a> project.
-
-<h2>AUTHORS</h2>
-
-Martin Schroeder, University of Heidelberg, Germany<p>
-Man page text from S.J.D. Cox, AGCRC, CSIRO Exploration &amp; Mining, Nedlands, WA
-<p>
-Updated by <a href="mailto:morten@ngb.se">Morten Hulden</a>
-<p>
-Datum tranformation support and cleanup by Paul Kelly
-
-<p><i>Last changed: $Date$</i>

+ 0 - 31
raster/r.proj/readcell.c

@@ -1,31 +0,0 @@
-/*
- * readcell.c - reads an entire cell layer into a buffer
- *
- */
-
-#include <stdio.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "local_proto.h"
-
-FCELL **readcell(int fdi)
-{				/* handle of input layer           */
-    FCELL **ibuffer;		/* buffer that holds the input map       */
-    int nrows;			/* rows of input layer                   */
-    int row;			/* counter                               */
-
-
-    nrows = G_window_rows();
-
-    ibuffer = (FCELL **) G_malloc(sizeof(FCELL **) * nrows);
-
-    G_important_message(_("Allocating memory and reading input map..."));
-    G_percent(0, nrows, 5);
-    for (row = 0; row < nrows; row++) {
-	ibuffer[row] = (FCELL *) G_allocate_raster_buf(FCELL_TYPE);
-	if (G_get_raster_row(fdi, ibuffer[row], row, FCELL_TYPE) < 0)
-	    G_fatal_error(_("Unable to read raster map row %d"), row);
-	G_percent(row, nrows - 1, 5);
-    }
-    return (ibuffer);
-}

raster/r.univar2/Makefile → raster/r.univar/Makefile


raster/r.univar2/globals.h → raster/r.univar/globals.h


raster/r.univar2/r.univar.html → raster/r.univar/r.univar.html


raster/r.univar2/r.univar_main.c → raster/r.univar/r.univar_main.c


raster/r.univar2/r3.univar.html → raster/r.univar/r3.univar.html


raster/r.univar2/r3.univar_main.c → raster/r.univar/r3.univar_main.c


raster/r.univar2/sort.c → raster/r.univar/sort.c


raster/r.univar2/stats.c → raster/r.univar/stats.c