GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
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

◆ G_ellipsoid_description()

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

References G_read_ellipsoid_table().

◆ G_ellipsoid_name()

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

References G_read_ellipsoid_table().

◆ G_get_ellipsoid_by_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.

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

Definition at line 104 of file get_ellipse.c.

◆ G_get_ellipsoid_parameters()

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.

◆ G_get_spheroid_by_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 153 of file get_ellipse.c.

◆ G_read_ellipsoid_table()

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

References file, and GPATH_MAX.

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