Loading...
Searching...
No Matches
location.c File Reference

GIS library - environment routines (location). More...

`#include <stdio.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include <sys/types.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
`#include "gis_local_proto.h"`
Include dependency graph for location.c:

Go to the source code of this file.

## Functions

const char * | G_location (void)
| Get current location name.
char * | G_location_path (void)
| Get current location UNIX-like path.
char * | G__location_path (void)
| Get current location UNIX-like path (internal use only).

## Detailed Description

GIS library - environment routines (location).

(C) 2001-2008, 2012 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
  Original author CERL

Definition in file location.c.

## Function Documentation

## G__location_path()

char * G__location_path | ( | void |  | ) |

Get current location UNIX-like path (internal use only).

Allocated buffer should be freed by G_free(). See also G_location_path().

Todo
  Support also Windows-like path (?)

Returns
  buffer with location path

Definition at line 77 of file location.c.

References G_gisdbase(), G_location(), and name.

Referenced by G_location_path().

## G_location()

const char * G_location | ( | void |  | ) |

Get current location name.

Returns the name of the current database location. This routine should be used by modules that need to display the current location to the user. See Locations for an explanation of locations.

Returns
  location name

Definition at line 32 of file location.c.

References G_getenv().

Referenced by G__location_path(), G__mapset_path(), G_get_projepsg(), G_get_projinfo(), G_get_projsrid(), G_get_projunits(), G_get_projwkt(), and G_make_mapset().

## G_location_path()

char * G_location_path | ( | void |  | ) |

Get current location UNIX-like path.

Allocated buffer should be freed by G_free(). See G__location_path().

Returns the full UNIX path name of the current database location. For example, if the user is working in location spearfish in the /home/user/grassdata database directory, this routine will return a string which looks like /home/user/grassdata/spearfish.

This function also checks if location path is readable by the current user. It calls G_fatal_error() on failure.

Returns
  buffer with location path

Definition at line 54 of file location.c.

References G__location_path(), and G_fatal_error().

Referenced by G__gisinit(), and G_get_available_mapsets().