GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71806
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
do_proj.c File Reference

GProj library - Functions for re-projecting point data. More...

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <grass/gis.h>
#include <grass/gprojects.h>
#include <grass/glocale.h>
Include dependency graph for do_proj.c:

Go to the source code of this file.

Macros

#define MULTIPLY_LOOP(x, y, c, m)
 
#define DIVIDE_LOOP(x, y, c, m)
 

Functions

int pj_do_proj (double *x, double *y, const struct pj_info *info_in, const struct pj_info *info_out)
 Re-project a point between two co-ordinate systems. More...
 
int pj_do_transform (int count, double *x, double *y, double *h, const struct pj_info *info_in, const struct pj_info *info_out)
 Re-project an array of points between two co-ordinate systems with optional ellipsoidal height conversion. More...
 

Detailed Description

GProj library - Functions for re-projecting point data.

Author
Original Author unknown, probably Soil Conservation Service Eric Miller, Paul Kelly

(C) 2003-2008 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.

Definition in file do_proj.c.

Macro Definition Documentation

#define DIVIDE_LOOP (   x,
  y,
  c,
 
)
Value:
do {\
int i; \
for (i = 0; i < c; ++i) {\
x[i] /= m; \
y[i] /= m; \
}\
} while (0)
#define x
for(cat=0;;cat++)
int
Reads the categories file for map name in mapset and stores the categories in the pcats structure...

Definition at line 35 of file do_proj.c.

Referenced by pj_do_transform().

#define MULTIPLY_LOOP (   x,
  y,
  c,
 
)
Value:
do {\
int i; \
for (i = 0; i < c; ++i) {\
x[i] *= m; \
y[i] *= m; \
}\
} while (0)
#define x
for(cat=0;;cat++)
int
Reads the categories file for map name in mapset and stores the categories in the pcats structure...

Definition at line 26 of file do_proj.c.

Referenced by pj_do_transform().

Function Documentation

int pj_do_proj ( double *  x,
double *  y,
const struct pj_info info_in,
const struct pj_info info_out 
)

Re-project a point between two co-ordinate systems.

This function takes pointers to two pj_info structures as arguments, and projects a point between the co-ordinate systems represented by them. The easting and northing of the point are contained in two pointers passed to the function; these will be overwritten by the co-ordinates of the re-projected point.

Parameters
xPointer to a double containing easting or longitude
yPointer to a double containing northing or latitude
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
Returns
Return value from PROJ pj_transform() function

Definition at line 63 of file do_proj.c.

References _, G_warning(), pj_info::meters, pj_info::pj, and pj_info::proj.

int pj_do_transform ( int  count,
double *  x,
double *  y,
double *  h,
const struct pj_info info_in,
const struct pj_info info_out 
)

Re-project an array of points between two co-ordinate systems with optional ellipsoidal height conversion.

This function takes pointers to two pj_info structures as arguments, and projects an array of points between the co-ordinate systems represented by them. Pointers to the three arrays of easting, northing, and ellipsoidal height of the point (this one may be NULL) are passed to the function; these will be overwritten by the co-ordinates of the re-projected points.

Parameters
countNumber of points in the arrays to be transformed
xPointer to an array of type double containing easting or longitude
yPointer to an array of type double containing northing or latitude
hPointer to an array of type double containing ellipsoidal height. May be null in which case a two-dimensional re-projection will be done
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
Returns
Return value from PROJ pj_transform() function

Definition at line 134 of file do_proj.c.

References _, count, DIVIDE_LOOP, G_free(), G_warning(), pj_info::meters, MULTIPLY_LOOP, NULL, pj_info::pj, and pj_info::proj.