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

GIS Library - 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.

Functions

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...
 
const 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...
 
const char * G_ellipsoid_description (int n)
 Get description for nth ellipsoid. More...
 
int G_read_ellipsoid_table (int fatal)
 Read ellipsoid table. More...
 

Detailed Description

GIS Library - 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.

New 05/2000 by al: for datum shift the f parameter is needed too. This all is not a clean design, but it keeps backward- compatibility. Looks up ellipsoid in ellipsoid table and returns the a, e2 and f parameters for the ellipsoid

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

const 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
nellipsoid identificator
Returns
pointer to ellipsoid description
NULL if no ellipsoid found

Definition at line 184 of file get_ellipse.c.

References G_read_ellipsoid_table(), and NULL.

const 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
nellipsoid identificator
Returns
ellipsoid name
NULL if no ellipsoid found

Definition at line 133 of file get_ellipse.c.

References G_read_ellipsoid_table(), and NULL.

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.

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

Definition at line 105 of file get_ellipse.c.

References G_read_ellipsoid_table(), and G_strcasecmp().

Referenced by G_compare_projections().

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 67 of file get_ellipse.c.

References G_file_name(), G_free_key_value(), G_read_key_value_file(), GPATH_MAX, NULL, PERMANENT, and PROJECTION_FILE.

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.

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

Definition at line 154 of file get_ellipse.c.

References G_read_ellipsoid_table(), and G_strcasecmp().

int G_read_ellipsoid_table ( int  fatal)

Read ellipsoid table.

Parameters
fatalnon-zero value for G_fatal_error(), otherwise G_warning() is used
Returns
1 on success
0 on error

Definition at line 247 of file get_ellipse.c.

References _, err(), fclose(), fd, file, G_fatal_error(), G_getl2(), G_gisbase(), G_initialize_done(), G_is_initialized(), G_store(), G_strip(), G_warning(), GPATH_MAX, n_, name, and NULL.

Referenced by G_ellipsoid_description(), G_ellipsoid_name(), G_get_ellipsoid_by_name(), G_get_spheroid_by_name(), and G_init_all().