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

GIS Library - Functions to create a new location. More...

#include <grass/gis.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <math.h>
Include dependency graph for make_loc.c:

Go to the source code of this file.

Functions

int G_make_location (const char *location_name, struct Cell_head *wind, const struct Key_Value *proj_info, const struct Key_Value *proj_units)
 Create a new location. More...
 
int G_make_location_epsg (const char *location_name, struct Cell_head *wind, const struct Key_Value *proj_info, const struct Key_Value *proj_units, const struct Key_Value *proj_epsg)
 Create a new location. More...
 
int G_compare_projections (const struct Key_Value *proj_info1, const struct Key_Value *proj_units1, const struct Key_Value *proj_info2, const struct Key_Value *proj_units2)
 Compare projections including units. More...
 

Detailed Description

GIS Library - Functions to create a new location.

Creates a new location automatically given a "Cell_head", PROJ_INFO and PROJ_UNITS information.

(C) 2000-2013 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
Frank Warmerdam

Definition in file make_loc.c.

Function Documentation

int G_compare_projections ( const struct Key_Value proj_info1,
const struct Key_Value proj_units1,
const struct Key_Value proj_info2,
const struct Key_Value proj_units2 
)

Compare projections including units.

Parameters
proj_info1projection info to compare
proj_units1projection units to compare
proj_info2projection info to compare
proj_units2projection units to compare
Returns
-1 if not the same projection
-2 if linear unit translation to meters fails
-3 if not the same datum,
-4 if not the same ellipsoid,
-5 if UTM zone differs
-6 if UTM hemisphere differs,
-7 if false easting differs
-8 if false northing differs,
-9 if center longitude differs,
-10 if center latitude differs,
-11 if standard parallels differ,
1 if projections match.

Definition at line 169 of file make_loc.c.

References G_debug(), G_find_key_value(), G_get_ellipsoid_by_name(), G_strcasecmp(), NULL, and TRUE.

int G_make_location ( const char *  location_name,
struct Cell_head wind,
const struct Key_Value proj_info,
const struct Key_Value proj_units 
)

Create a new location.

This function creates a new location in the current database, initializes the projection, default window and current window.

Parameters
location_nameName of the new location. Should not include the full path, the location will be created within the current database.
winddefault window setting for the new location. All fields should be set in this structure, and care should be taken to ensure that the proj/zone fields match the definition in the proj_info parameter(see G_set_cellhd_from_projinfo()).
proj_infoprojection definition suitable to write to the PROJ_INFO file, or NULL for PROJECTION_XY.
proj_unitsprojection units suitable to write to the PROJ_UNITS file, or NULL.
Returns
0 on success
-1 to indicate a system error (check errno).
-2 failed to create projection file (currently not used)
-3 illegal name

Definition at line 51 of file make_loc.c.

References G_file_name(), G_gisdbase(), G_legal_filename(), G_mkdir(), G_put_element_window(), G_setenv_nogisrc(), G_write_key_value_file(), GPATH_MAX, and NULL.

Referenced by G_make_location_epsg().

int G_make_location_epsg ( const char *  location_name,
struct Cell_head wind,
const struct Key_Value proj_info,
const struct Key_Value proj_units,
const struct Key_Value proj_epsg 
)

Create a new location.

This function creates a new location in the current database, initializes the projection, default window and current window, and sets the EPSG code if present

Parameters
location_nameName of the new location. Should not include the full path, the location will be created within the current database.
winddefault window setting for the new location. All fields should be set in this structure, and care should be taken to ensure that the proj/zone fields match the definition in the proj_info parameter(see G_set_cellhd_from_projinfo()).
proj_infoprojection definition suitable to write to the PROJ_INFO file, or NULL for PROJECTION_XY.
proj_unitsprojection units suitable to write to the PROJ_UNITS file, or NULL.
proj_epsgEPSG code suitable to write to the PROJ_EPSG file, or NULL.
Returns
0 on success
-1 to indicate a system error (check errno).
-2 failed to create projection file (currently not used)
-3 illegal name

Definition at line 125 of file make_loc.c.

References G_file_name(), G_make_location(), G_write_key_value_file(), GPATH_MAX, and NULL.