GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
ellipse.c File Reference

GProj library - Functions for reading datum parameters from the location 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 <grass/gprojects.h>
#include "local_proto.h"
Include dependency graph for ellipse.c:

Go to the source code of this file.

Functions

int GPJ_get_ellipsoid_params (double *a, double *e2, double *rf)
 Get the ellipsoid parameters from the database. More...
 
int GPJ__get_ellipsoid_params (const struct Key_Value *proj_keys, double *a, double *e2, double *rf)
 Get the ellipsoid parameters from proj keys structure. More...
 
int GPJ_get_ellipsoid_by_name (const char *name, struct gpj_ellps *estruct)
 Looks up ellipsoid in ellipsoid table and returns the a, e2 parameters for the ellipsoid. More...
 
struct ellps_list * read_ellipsoid_table (int fatal)
 
void GPJ_free_ellps (struct gpj_ellps *estruct)
 Free ellipsoid data structure. More...
 
void free_ellps_list (struct ellps_list *elist)
 

Detailed Description

GProj library - Functions for reading datum parameters from the location database.

Author
Paul Kelly <paul-grass stjohnspoint.co.uk>

(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 ellipse.c.

Function Documentation

◆ free_ellps_list()

void free_ellps_list ( struct ellps_list *  elist)

Definition at line 316 of file ellipse.c.

References G_free(), and NULL.

Referenced by GPJ_get_ellipsoid_by_name().

◆ GPJ__get_ellipsoid_params()

int GPJ__get_ellipsoid_params ( const struct Key_Value proj_keys,
double *  a,
double *  e2,
double *  rf 
)

Get the ellipsoid parameters from proj keys structure.

If the PROJECTION_FILE exists in the PERMANENT mapset, read info from that file, otherwise return WGS 84 values.

Dies with diagnostic if there is an error.

Parameters
proj_keysproj definition
[out]asemi-major axis
[out]e2first eccentricity squared
[out]rfreciprocal of the ellipsoid flattening term
Returns
1 on success
0 default values used.

Definition at line 73 of file ellipse.c.

◆ GPJ_free_ellps()

void GPJ_free_ellps ( struct gpj_ellps estruct)

Free ellipsoid data structure.

Parameters
estructdata structure to be freed

Definition at line 309 of file ellipse.c.

References G_free(), gpj_ellps::longname, and gpj_ellps::name.

◆ GPJ_get_ellipsoid_by_name()

int GPJ_get_ellipsoid_by_name ( const char *  name,
struct gpj_ellps estruct 
)

Looks up ellipsoid in ellipsoid table and returns the a, e2 parameters for the ellipsoid.

Parameters
nameellipsoid name
[out]estructellipsoid
Returns
1 on success
-1 if not found in table

Definition at line 160 of file ellipse.c.

References gpj_ellps::a, gpj_ellps::es, free_ellps_list(), G_store(), G_strcasecmp(), list, gpj_ellps::longname, gpj_ellps::name, NULL, read_ellipsoid_table(), and gpj_ellps::rf.

◆ GPJ_get_ellipsoid_params()

int GPJ_get_ellipsoid_params ( double *  a,
double *  e2,
double *  rf 
)

Get 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.

Dies with diagnostic if there is an error.

Parameters
[out]asemi-major axis
[out]e2first eccentricity squared
[out]rfreciprocal of the ellipsoid flattening term
Returns
1 on success
0 default values used.

Definition at line 43 of file ellipse.c.

◆ read_ellipsoid_table()

struct ellps_list* read_ellipsoid_table ( int  fatal)

Definition at line 224 of file ellipse.c.

References file, GPATH_MAX, and name.

Referenced by GPJ_get_ellipsoid_by_name().