GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72999
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

#define BUFFSIZE   128

Definition at line 24 of file ascii.c.

Referenced by Vect_read_ascii().

Function Documentation

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 40 of file ascii.c.

References _, buff, BUFFSIZE, cat, FALSE, G_chop(), G_debug(), G_getl2(), G_projection(), G_scan_easting(), G_scan_northing(), G_warning(), GV_BOUNDARY, GV_CENTROID, GV_FACE, GV_KERNEL, GV_LINE, GV_POINT, line_cats::n_cats, TRUE, Vect_cat_set(), Vect_copy_xyz_to_pnts(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_get_name(), Vect_is_3d(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_reset_cats(), Vect_write_line(), and x.

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 256 of file ascii.c.

References _, buff, 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().

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 336 of file ascii.c.

References _, Cell_head::bottom, cat, line_cats::cat, columns, count, field_info::database, DB_C_TYPE_DATETIME, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, DB_C_TYPE_STRING, db_close_cursor(), db_close_database(), db_column_Ctype(), db_describe_table(), db_fetch(), db_free_table(), db_get_column_name(), db_get_column_value(), db_get_cursor_table(), db_get_table_column(), db_get_table_number_of_columns(), db_get_value_double(), db_get_value_int(), db_get_value_string(), db_init_handle(), db_init_string(), DB_NEXT, DB_OK, db_open_database(), db_open_select_cursor(), db_select_int(), db_select_value(), DB_SEQUENTIAL, db_set_handle(), db_set_string(), db_shutdown_driver(), db_start_driver(), db_test_value_isnull(), db_zero_string(), driver, field_info::driver, Cell_head::east, line_cats::field, G_debug(), G_fatal_error(), G_free(), G_get_window(), G_important_message(), G_rasprintf(), G_store(), G_trim_decimal(), G_warning(), G_zero(), GV_AREA, GV_ASCII_FORMAT_POINT, GV_ASCII_FORMAT_STD, GV_ASCII_FORMAT_WKT, GV_BOUNDARY, GV_CENTROID, GV_FACE, GV_KERNEL, GV_LINE, GV_POINT, GV_POINTS, Map_info::head, HOST_NEWLINE, field_info::key, line_cats::n_cats, line_pnts::n_points, ilist::n_values, Cell_head::north, NULL, Cell_head::south, field_info::table, Cell_head::top, TRUE, Vect_area_alive(), Vect_cat_get(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_field_cat_get(), Vect_get_area_cat(), Vect_get_area_cats(), Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_field(), Vect_get_isle_area(), Vect_get_isle_points(), Vect_get_line_areas(), Vect_get_num_areas(), Vect_is_3d(), Vect_level(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_new_list(), Vect_read_next_line(), Vect_rewind(), Vect_sfa_line_astext(), Cell_head::west, dig_head::with_z, x, line_pnts::x, line_pnts::y, and line_pnts::z.

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 917 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().