Loading...
Searching...
No Matches
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
int | G_get_ellipsoid_by_name (const char *name, double *a, double *e2)
| Get ellipsoid parameters by name.
const char * | G_ellipsoid_name (int n)
| Get ellipsoid name.
int | G_get_spheroid_by_name (const char *name, double *a, double *e2, double *f)
| Get spheroid parameters by name.
const char * | G_ellipsoid_description (int n)
| Get description for nth ellipsoid.
int | G_read_ellipsoid_table (int fatal)
| Read ellipsoid table.

## 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

  n | ellipsoid 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(), and NULL.

## G_ellipsoid_name()

const char * G_ellipsoid_name | ( | int | n | ) |

Get ellipsoid name.

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

Parameters

  n | ellipsoid identificator

Returns
  ellipsoid name
  NULL if no ellipsoid found

Definition at line 132 of file get_ellipse.c.

References G_read_ellipsoid_table(), and NULL.

## 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

  | name | ellipsoid name
  [out] | a | semi-major axis
  [out] | e2 | eccentricity squared

Returns
  1 on success
  0 if ellipsoid not found

Definition at line 104 of file get_ellipse.c.

References G_read_ellipsoid_table(), G_strcasecmp(), and name.

Referenced by G_compare_projections().

## 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] | a | semi-major axis
  [out] | e2 | eccentricity squared

Returns
  1 success
  0 default values used

Definition at line 66 of file get_ellipse.c.

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

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

## 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

  | name | spheroid name
  [out] | a | semi-major axis
  [out] | e2 | eccentricity squared
  [out] | f | inverse flattening

Returns
  1 on success
  0 if no spheroid found

Definition at line 153 of file get_ellipse.c.

References G_read_ellipsoid_table(), G_strcasecmp(), and name.

## G_read_ellipsoid_table()

int G_read_ellipsoid_table | ( | int | fatal | ) |

Read ellipsoid table.

Parameters

  fatal | non-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 err(), file, G_fatal_error(), G_getl2(), G_gisbase(), G_initialize_done(), G_is_initialized(), G_store(), G_strip(), G_strlcat(), G_warning(), 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().