GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
ascii.c File Reference

Vector library - GRASS ASCII vector format. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <grass/vector.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
Include dependency graph for ascii.c:

Go to the source code of this file.

Macros

#define BUFFSIZE   128
 

Functions

int Vect_read_ascii (FILE *ascii, struct Map_info *Map)
 Read data in GRASS ASCII vector format. More...
 
int Vect_read_ascii_head (FILE *dascii, struct Map_info *Map)
 Read header of GRASS ASCII vector format. More...
 
int Vect_write_ascii (FILE *ascii, FILE *att, struct Map_info *Map, int ver, int format, int dp, char *fs, int region_flag, int type, int field, const struct cat_list *Clist, const char *where, const char **column_names, int header)
 Write data to GRASS ASCII vector format. More...
 
void Vect_write_ascii_head (FILE *dascii, struct Map_info *Map)
 Write data to GRASS ASCII vector format. More...
 

Detailed Description

Vector library - GRASS ASCII vector format.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2015 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
Updated for GRASS 7 (SF support) by Martin Landa <landa.martin gmail.com>

Definition in file ascii.c.

Macro Definition Documentation

◆ BUFFSIZE

#define BUFFSIZE   128

Definition at line 26 of file ascii.c.

Function Documentation

◆ Vect_read_ascii()

int Vect_read_ascii ( FILE *  ascii,
struct Map_info Map 
)

Read data in GRASS ASCII vector format.

Parameters
asciipointer to the input ASCII file
[out]Mappointer to the output Map_info structure
Returns
number of read features
-1 on error

Definition at line 42 of file ascii.c.

References BUFFSIZE, and x.

◆ Vect_read_ascii_head()

int Vect_read_ascii_head ( FILE *  dascii,
struct Map_info Map 
)

Read header of GRASS ASCII vector format.

Parameters
dasciipointer to the ASCII file
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 257 of file ascii.c.

References _, G_getl2(), G_warning(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().

◆ Vect_write_ascii()

int Vect_write_ascii ( FILE *  ascii,
FILE *  att,
struct Map_info Map,
int  ver,
int  format,
int  dp,
char *  fs,
int  region_flag,
int  type,
int  field,
const struct cat_list Clist,
const char *  where,
const char **  column_names,
int  header 
)

Write data to GRASS ASCII vector format.

Prints message if some features without category are skipped.

Parameters
[out]asciipointer to the output ASCII file
[out]attatt file (< version 5 only)
Mappointer to Map_info structure
verversion number 4 or 5
formatformat GV_ASCII_FORMAT_POINT or GV_ASCII_FORMAT_STD
dpnumber of significant digits
fsfield separator
region_flagcheck region
typefeature type filter
fieldfield number
Clistlist of categories to filter features or NULL
whereSQL select where statement to filter features or NULL
column_namesarray of columns to be included to the output or NULL "*" as the first item in the array indicates all columns
headerTRUE to print also header
Returns
number of written features
-1 on error

Definition at line 337 of file ascii.c.

◆ Vect_write_ascii_head()

void Vect_write_ascii_head ( FILE *  dascii,
struct Map_info Map 
)

Write data to GRASS ASCII vector format.

Parameters
[out]dasciipointer to the output ASCII file
Mappointer to Map_info structure

Definition at line 945 of file ascii.c.

References HOST_NEWLINE, Vect_get_comment(), Vect_get_date(), Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), Vect_get_person(), Vect_get_scale(), Vect_get_thresh(), and Vect_get_zone().