GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
get_ellipse.c File Reference

Getting ellipsoid parameters from the database. More...

#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for get_ellipse.c:

Go to the source code of this file.

Data Structures

struct  table
 

Functions

void ellipsoid_table_file (char *)
 
int G_get_ellipsoid_parameters (double *a, double *e2)
 get ellipsoid parameters More...
 
int G_get_ellipsoid_by_name (const char *name, double *a, double *e2)
 get ellipsoid parameters by name More...
 
char * G_ellipsoid_name (int n)
 get ellipsoid name More...
 
int G_get_spheroid_by_name (const char *name, double *a, double *e2, double *f)
 get spheroid parameters by name More...
 
char * G_ellipsoid_description (int n)
 get description for nth ellipsoid More...
 

Detailed Description

Getting ellipsoid parameters from the database.

This routine returns the ellipsoid parameters from the database. If the PROJECTION_FILE exists in the PERMANENT mapset, read info from that file, otherwise return WGS 84 values.

Returns: 1 ok, 0 default values used. Dies with diagnostic if there is an error

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

Author
CERL

Definition in file get_ellipse.c.

Function Documentation

void ellipsoid_table_file ( char *  file)

Definition at line 249 of file get_ellipse.c.

References G_gisbase(), and sprintf().

char* G_ellipsoid_description ( int  n)

get description for nth ellipsoid

This function returns a pointer to the description text for the nth ellipsoid. If n is less than 0 or greater than the number of known ellipsoids, it returns a NULL pointer.

Parameters
[in]nellipsoid identificator
Returns
pointer to ellipsoid description
NULL if no ellipsoid found

Definition at line 202 of file get_ellipse.c.

References count, n, and NULL.

char* G_ellipsoid_name ( int  n)

get ellipsoid name

This function returns a pointer to the short name for the nth ellipsoid. If n is less than 0 or greater than the number of known ellipsoids, it returns a NULL pointer.

Parameters
[in]nellipsoid identificator
Returns
char * ellipsoid name
NULL if no ellipsoid found

Definition at line 138 of file get_ellipse.c.

References count, n, and NULL.

Referenced by G_ask_ellipse_name().

int G_get_ellipsoid_by_name ( const char *  name,
double *  a,
double *  e2 
)

get ellipsoid parameters by name

This routine returns the semi-major axis a (in meters) and eccentricity squared e2 for the named ellipsoid. Returns 1 if name is a known ellipsoid, 0 otherwise.

Parameters
[in]nameellipsoid name
[out]asemi-major axis
[out]e2eccentricity squared
Returns
1 on success
0 if ellipsoid not found

Definition at line 110 of file get_ellipse.c.

References count, and G_strcasecmp().

Referenced by G_ask_ellipse_name().

int G_get_ellipsoid_parameters ( double *  a,
double *  e2 
)

get ellipsoid parameters

This routine returns the semi-major axis a (in meters) and the eccentricity squared e2 for the ellipsoid associated with the database. If there is no ellipsoid explicitly associated with the database, it returns the values for the WGS 84 ellipsoid.

Parameters
[out]asemi-major axis
[out]e2eccentricity squared
Returns
1 success
0 default values used

Definition at line 66 of file get_ellipse.c.

References G__file_name(), G_fatal_error(), G_free_key_value(), G_read_key_value_file(), NULL, PERMANENT, and stat.

Referenced by G_begin_cell_area_calculations(), G_begin_distance_calculations(), G_begin_polygon_area_calculations(), and G_database_ellipse_name().

int G_get_spheroid_by_name ( const char *  name,
double *  a,
double *  e2,
double *  f 
)

get spheroid parameters by name

This function returns the semi-major axis a (in meters), the eccentricity squared e2 and the inverse flattening f for the named ellipsoid. Returns 1 if name is a known ellipsoid, 0 otherwise.

Parameters
[in]namespheroid name
[out]asemi-major axis
[out]e2eccentricity squared
[out]finverse flattening
Returns
1 on success
0 if no spheroid found

Definition at line 171 of file get_ellipse.c.

References count, and G_strcasecmp().