GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
defs/vector.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct line_pntsVect_new_line_struct (void)
 Creates and initializes a line_pnts structure. More...
 
int Vect_append_point (struct line_pnts *, double, double, double)
 Appends one point to the end of a line. More...
 
int Vect_append_points (struct line_pnts *, const struct line_pnts *, int)
 Appends points to the end of a line. More...
 
int Vect_line_insert_point (struct line_pnts *, int, double, double, double)
 Insert new point at index position and move all old points at that position and above up. More...
 
int Vect_line_delete_point (struct line_pnts *, int)
 Delete point at given index and move all points above down. More...
 
int Vect_line_get_point (const struct line_pnts *, int, double *, double *, double *)
 Get line point of given index. More...
 
int Vect_get_num_line_points (const struct line_pnts *)
 Get number of line points. More...
 
int Vect_line_prune (struct line_pnts *)
 Remove duplicate points, i.e. zero length segments. More...
 
int Vect_line_prune_thresh (struct line_pnts *, double)
 Remove points in threshold. More...
 
void Vect_line_reverse (struct line_pnts *)
 Reverse the order of vertices. More...
 
int Vect_copy_xyz_to_pnts (struct line_pnts *, const double *, const double *, const double *, int)
 Copy points from array to line_pnts structure. More...
 
int Vect_copy_pnts_to_xyz (const struct line_pnts *, double *, double *, double *, int *)
 Copy points from line structure to array. More...
 
void Vect_reset_line (struct line_pnts *)
 Reset line. More...
 
void Vect_destroy_line_struct (struct line_pnts *)
 Frees all memory associated with a line_pnts structure, including the structure itself. More...
 
int Vect_point_on_line (const struct line_pnts *, double, double *, double *, double *, double *, double *)
 Find point on line in the specified distance. More...
 
int Vect_line_segment (const struct line_pnts *, double, double, struct line_pnts *)
 Create line segment. More...
 
double Vect_line_length (const struct line_pnts *)
 Calculate line length, 3D-length in case of 3D vector line. More...
 
double Vect_line_geodesic_length (const struct line_pnts *)
 Calculate line length. More...
 
int Vect_line_distance (const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
 Calculate distance of point to line. More...
 
int Vect_line_geodesic_distance (const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
 Calculate geodesic distance of point to line in meters. More...
 
void Vect_line_box (const struct line_pnts *, struct bound_box *)
 Get bounding box of line. More...
 
void Vect_line_parallel (struct line_pnts *, double, double, int, struct line_pnts *)
 Create parallel line. More...
 
void Vect_line_parallel2 (struct line_pnts *, double, double, double, int, int, double, struct line_pnts *)
 
void Vect_line_buffer (const struct line_pnts *, double, double, struct line_pnts *)
 Create buffer around the line line. More...
 
void Vect_line_buffer2 (const struct line_pnts *, double, double, double, int, int, double, struct line_pnts **, struct line_pnts ***, int *)
 Creates buffer around line. More...
 
void Vect_area_buffer2 (struct Map_info *, int, double, double, double, int, int, double, struct line_pnts **, struct line_pnts ***, int *)
 Creates buffer around area. More...
 
void Vect_point_buffer2 (double, double, double, double, double, int, double, struct line_pnts **)
 Creates buffer around the point (px, py). More...
 
struct line_catsVect_new_cats_struct (void)
 Creates and initializes line_cats structure. More...
 
int Vect_cat_set (struct line_cats *, int, int)
 Add new field/cat to category structure if doesn't exist yet. More...
 
int Vect_cat_get (const struct line_cats *, int, int *)
 Get first found category of given field. More...
 
int Vect_cat_del (struct line_cats *, int)
 Delete all categories of given layer. More...
 
int Vect_field_cat_del (struct line_cats *, int, int)
 Delete field/cat from line_cats structure. More...
 
int Vect_field_cat_get (const struct line_cats *, int, struct ilist *)
 Get list of categories of given field. More...
 
int Vect_cat_in_array (int, const int *, int)
 Check if category is in ordered array of integers. More...
 
int Vect_reset_cats (struct line_cats *)
 Reset category structure to make sure cats structure is clean to be re-used. More...
 
void Vect_destroy_cats_struct (struct line_cats *)
 Frees all memory associated with line_cats structure, including the struct itself. More...
 
int Vect_get_area_cats (struct Map_info *, int, struct line_cats *)
 Get area categories. More...
 
int Vect_get_area_cat (struct Map_info *, int, int)
 Find FIRST category of given field and area. More...
 
int Vect_get_line_cat (struct Map_info *, int, int)
 Fetches FIRST category number for given vector line and field. More...
 
struct cat_listVect_cats_set_constraint (struct Map_info *, int, char *, char *)
 Set category constraints using 'where' or 'cats' option and layer number. More...
 
int Vect_cats_in_constraint (struct line_cats *, int, struct cat_list *)
 Check if categories match with category constraints. More...
 
struct cat_listVect_new_cat_list (void)
 Allocate memory for cat_list structure. More...
 
int Vect_str_to_cat_list (const char *, struct cat_list *)
 Converts string of categories and cat ranges separated by commas to cat_list. More...
 
int Vect_array_to_cat_list (const int *, int, struct cat_list *)
 Convert ordered array of integers to cat_list structure. More...
 
int Vect_cat_list_to_array (const struct cat_list *, int **, int *)
 Convert cat_list struct to ordered array of unique integers. More...
 
int Vect_cat_in_cat_list (int, const struct cat_list *)
 Check if category number is in list. More...
 
void Vect_destroy_cat_list (struct cat_list *)
 Frees allocated cat_list memory. More...
 
struct varrayVect_new_varray (int)
 Create new struct varray and allocate space for given number of items. More...
 
int Vect_set_varray_from_cat_string (struct Map_info *, int, const char *, int, int, struct varray *)
 Set values in 'varray' to 'value' from category string. More...
 
int Vect_set_varray_from_cat_list (struct Map_info *, int, struct cat_list *, int, int, struct varray *)
 Set values in 'varray' to 'value' from category list. More...
 
int Vect_set_varray_from_db (struct Map_info *, int, const char *, int, int, struct varray *)
 Set values in 'varray' to 'value' from DB (where statement) More...
 
struct dblinksVect_new_dblinks_struct (void)
 Create and init new dblinks structure. More...
 
void Vect_reset_dblinks (struct dblinks *)
 Reset dblinks structure (number of fields) More...
 
int Vect_add_dblink (struct dblinks *, int, const char *, const char *, const char *, const char *, const char *)
 Add new DB connection to dblinks structure. More...
 
int Vect_check_dblink (const struct dblinks *, int, const char *)
 Check if DB connection exists in dblinks structure. More...
 
int Vect_map_add_dblink (struct Map_info *, int, const char *, const char *, const char *, const char *, const char *)
 Add new db connection to Map_info structure. More...
 
int Vect_map_del_dblink (struct Map_info *, int)
 Delete db connection from Map_info structure. More...
 
void Vect_copy_map_dblinks (struct Map_info *, struct Map_info *, int)
 Copy DB links from input vector map to output vector map. More...
 
int Vect_map_check_dblink (struct Map_info *, int, const char *)
 Check if DB connection exists in dblinks structure. More...
 
int Vect_read_dblinks (struct Map_info *)
 Read dblinks to existing structure. More...
 
int Vect_write_dblinks (struct Map_info *)
 Write dblinks to file. More...
 
struct field_infoVect_default_field_info (struct Map_info *, int, const char *, int)
 Get default information about link to database for new dblink. More...
 
struct field_infoVect_get_dblink (struct Map_info *, int)
 Get information about link to database. More...
 
struct field_infoVect_get_field (struct Map_info *, int)
 Get information about link to database (by layer number) More...
 
struct field_infoVect_get_field_by_name (struct Map_info *, const char *)
 Get information about link to database (by layer name) More...
 
struct field_infoVect_get_field2 (struct Map_info *, const char *)
 Get information about link to database (by layer number or layer name) More...
 
int Vect_get_field_number (struct Map_info *, const char *)
 Get field number of given field. More...
 
void Vect_set_db_updated (struct Map_info *)
 Rewrite 'dbln' file. More...
 
const char * Vect_get_column_names (struct Map_info *, int)
 Fetches list of DB column names of vector map attribute table. More...
 
const char * Vect_get_column_types (struct Map_info *, int)
 Fetches list of DB column types of vector map attribute table. More...
 
const char * Vect_get_column_names_types (struct Map_info *, int)
 Fetches list of DB column names and types of vector map attribute table. More...
 
void Vect_destroy_field_info (struct field_info *)
 Free a struct field_info and all memory associated with it. More...
 
struct ilistVect_new_list (void)
 Creates and initializes a struct ilist. More...
 
int Vect_list_append (struct ilist *, int)
 Append new item to the end of list if not yet present. More...
 
int Vect_list_append_list (struct ilist *, const struct ilist *)
 Append new items to the end of list if not yet present. More...
 
int Vect_list_delete (struct ilist *, int)
 Remove a given value (item) from list. More...
 
int Vect_list_delete_list (struct ilist *, const struct ilist *)
 Delete list from existing list. More...
 
int Vect_val_in_list (const struct ilist *, int)
 Find a given item in the list. More...
 
int Vect_reset_list (struct ilist *)
 Reset ilist structure. More...
 
void Vect_destroy_list (struct ilist *)
 Frees all memory associated with a struct ilist, including the struct itself. More...
 
struct boxlistVect_new_boxlist (int)
 Creates and initializes a struct boxlist. More...
 
int Vect_boxlist_append (struct boxlist *, int, const struct bound_box *)
 Append new item to the end of list if not yet present. More...
 
int Vect_boxlist_append_boxlist (struct boxlist *, const struct boxlist *)
 Append new items to the end of list if not yet present. More...
 
int Vect_boxlist_delete (struct boxlist *, int)
 Remove a given value (item) from list. More...
 
int Vect_boxlist_delete_boxlist (struct boxlist *, const struct boxlist *)
 Delete list from existing list. More...
 
int Vect_val_in_boxlist (const struct boxlist *, int)
 Find a given item in the list. More...
 
int Vect_reset_boxlist (struct boxlist *)
 Reset boxlist structure. More...
 
void Vect_destroy_boxlist (struct boxlist *)
 Frees all memory associated with a struct boxlist, including the struct itself. More...
 
int Vect_point_in_box (double, double, double, const struct bound_box *)
 Tests if point is in 3D box. More...
 
int Vect_point_in_box_2d (double, double, const struct bound_box *)
 Tests if point is in 2D box. More...
 
int Vect_box_overlap (const struct bound_box *, const struct bound_box *)
 Tests for overlap of two boxes. More...
 
int Vect_box_copy (struct bound_box *, const struct bound_box *)
 Copy box B to box A. More...
 
int Vect_box_extend (struct bound_box *, const struct bound_box *)
 Extend box A by box B. More...
 
int Vect_box_clip (double *, double *, double *, double *, const struct bound_box *)
 Clip coordinates to box, if necessary, lines extending outside of a box. More...
 
int Vect_region_box (const struct Cell_head *, struct bound_box *)
 Copy region window to bounding box. More...
 
int Vect_cidx_get_num_fields (struct Map_info *)
 Get number of layers in category index. More...
 
int Vect_cidx_get_field_number (struct Map_info *, int)
 Get layer number for given index. More...
 
int Vect_cidx_get_field_index (struct Map_info *, int)
 Get layer index for given layer number. More...
 
int Vect_cidx_get_num_unique_cats_by_index (struct Map_info *, int)
 Get number of unique categories for given layer index. More...
 
int Vect_cidx_get_num_cats_by_index (struct Map_info *, int)
 Get number of categories for given layer index. More...
 
int Vect_cidx_get_num_types_by_index (struct Map_info *, int)
 Get number of feature types for given layer index. More...
 
int Vect_cidx_get_type_count_by_index (struct Map_info *, int, int, int *, int *)
 Get count of feature types for given field and type index. More...
 
int Vect_cidx_get_type_count (struct Map_info *, int, int)
 Get count of features of certain type by layer and type. More...
 
int Vect_cidx_get_cat_by_index (struct Map_info *, int, int, int *, int *, int *)
 Get category, feature type and id for given layer and category index. More...
 
int Vect_cidx_get_unique_cats_by_index (struct Map_info *, int, struct ilist *)
 Get list of unique categories for given layer index. More...
 
int Vect_cidx_find_next (struct Map_info *, int, int, int, int, int *, int *)
 Find next line/area id for given category, start_index and type_mask. More...
 
void Vect_cidx_find_all (struct Map_info *, int, int, int, struct ilist *)
 Find all line/area id's for given category. More...
 
int Vect_cidx_dump (struct Map_info *, FILE *)
 Write (dump) category index in text form to file. More...
 
int Vect_cidx_save (struct Map_info *)
 Save category index to binary file (cidx) More...
 
int Vect_cidx_open (struct Map_info *, int)
 Read category index from cidx file if exists. More...
 
struct Map_infoVect_new_map_struct (void)
 Creates and initializes Map_info structure. More...
 
void Vect_destroy_map_struct (struct Map_info *)
 Frees all memory associated with a Map_info structure, including the structure itself. More...
 
int Vect_read_header (struct Map_info *)
 Read vector map header from map head file. More...
 
int Vect_write_header (struct Map_info *)
 Write vector map header to map head file. More...
 
const char * Vect_get_name (struct Map_info *)
 Get name of vector map. More...
 
const char * Vect_get_mapset (struct Map_info *)
 Get name of mapset where vector map lives. More...
 
const char * Vect_get_full_name (struct Map_info *)
 Get fully qualified name of vector map. More...
 
const char * Vect_get_finfo_dsn_name (struct Map_info *)
 Get datasource name (relevant only for non-native formats) More...
 
char * Vect_get_finfo_layer_name (struct Map_info *)
 Get layer name (relevant only for non-native formats) More...
 
const char * Vect_get_finfo_format_info (struct Map_info *)
 Get format info as string (relevant only for non-native formats) More...
 
const char * Vect_get_finfo_geometry_type (struct Map_info *)
 Get geometry type as string (relevant only for non-native formats) More...
 
const struct Format_infoVect_get_finfo (struct Map_info *)
 Get header info for non-native formats. More...
 
int Vect_get_finfo_topology_info (struct Map_info *, char **, char **, int *)
 Get topology type (relevant only for non-native formats) More...
 
int Vect_is_3d (struct Map_info *)
 Check if vector map is 3D. More...
 
int Vect_set_organization (struct Map_info *, const char *)
 Set organization string in map header. More...
 
const char * Vect_get_organization (struct Map_info *)
 Get organization string from map header. More...
 
int Vect_set_date (struct Map_info *, const char *)
 Set date of digitization in map header. More...
 
const char * Vect_get_date (struct Map_info *)
 Get date of digitization from map header. More...
 
int Vect_set_person (struct Map_info *, const char *)
 Set name of user who digitized the map in map header. More...
 
const char * Vect_get_person (struct Map_info *)
 Get user name string who digitized the map from map header. More...
 
int Vect_set_map_name (struct Map_info *, const char *)
 Set map name in map header. More...
 
const char * Vect_get_map_name (struct Map_info *)
 Get map name from map header. More...
 
int Vect_set_map_date (struct Map_info *, const char *)
 Set date when the source map was originally produced in map header. More...
 
const char * Vect_get_map_date (struct Map_info *)
 Get date when the source map was originally produced from map header. More...
 
int Vect_set_comment (struct Map_info *, const char *)
 Set comment or other info string in map header. More...
 
const char * Vect_get_comment (struct Map_info *)
 Get comment or other info string from map header. More...
 
int Vect_set_scale (struct Map_info *, int)
 Set map scale in map header. More...
 
int Vect_get_scale (struct Map_info *)
 Get map scale from map header. More...
 
int Vect_set_zone (struct Map_info *, int)
 Set projection zone in map header. More...
 
int Vect_get_zone (struct Map_info *)
 
int Vect_get_proj (struct Map_info *)
 Get projection from map header. More...
 
int Vect_set_proj (struct Map_info *, int)
 Set projection in map header. More...
 
const char * Vect_get_proj_name (struct Map_info *)
 Query cartographic projection name of pointer to Map_info structure. More...
 
int Vect_set_thresh (struct Map_info *, double)
 Set threshold used for digitization in map header. More...
 
double Vect_get_thresh (struct Map_info *)
 Get threshold used for digitization from map header. More...
 
int Vect_get_constraint_box (struct Map_info *, struct bound_box *)
 Get constraint box. More...
 
int Vect_level (struct Map_info *)
 Returns level that Map is opened at. More...
 
int Vect_get_map_box1 (struct Map_info *, struct bound_box *)
 Get bounding box of map on level 1 (all features in the map) More...
 
int Vect_get_line_type (struct Map_info *, int)
 Get line type. More...
 
plus_t Vect_get_num_nodes (struct Map_info *)
 Get number of nodes in vector map. More...
 
plus_t Vect_get_num_primitives (struct Map_info *, int)
 Get number of primitives in vector map. More...
 
plus_t Vect_get_num_lines (struct Map_info *)
 Fetch number of features (points, lines, boundaries, centroids) in vector map. More...
 
plus_t Vect_get_num_areas (struct Map_info *)
 Get number of areas in vector map. More...
 
plus_t Vect_get_num_faces (struct Map_info *)
 Get number of faces in vector map. More...
 
plus_t Vect_get_num_kernels (struct Map_info *)
 Fetch number of kernels in vector map. More...
 
plus_t Vect_get_num_volumes (struct Map_info *)
 Fetch number of volumes in vector map. More...
 
plus_t Vect_get_num_islands (struct Map_info *)
 Get number of islands in vector map. More...
 
plus_t Vect_get_num_holes (struct Map_info *)
 Fetch number of holes in vector map. More...
 
int Vect_get_line_box (struct Map_info *, int, struct bound_box *)
 Get bounding box of given feature. More...
 
int Vect_get_area_box (struct Map_info *, int, struct bound_box *)
 Get bounding box of area. More...
 
int Vect_get_isle_box (struct Map_info *, int, struct bound_box *)
 Get bounding box of isle. More...
 
int Vect_get_map_box (struct Map_info *, struct bound_box *)
 Get bounding box of map (all features in the map) More...
 
int V__map_overlap (struct Map_info *, double, double, double, double)
 
void Vect_set_release_support (struct Map_info *)
 Set spatial index to be released when vector is closed. More...
 
void Vect_set_category_index_update (struct Map_info *)
 Set category index to be updated when vector is changed. More...
 
int Vect_check_input_output_name (const char *, const char *, int)
 Check for input and output vector map name. More...
 
int Vect_legal_filename (const char *)
 Check if output is legal vector name. More...
 
int Vect_set_open_level (int)
 Predetermine level at which a vector map will be opened for reading. More...
 
int Vect_open_old (struct Map_info *, const char *, const char *)
 Open existing vector map for reading. More...
 
int Vect_open_tmp_old (struct Map_info *, const char *, const char *)
 Open existing temporary vector map for reading. More...
 
int Vect_open_old2 (struct Map_info *, const char *, const char *, const char *)
 Open existing vector map for reading. More...
 
int Vect_open_old_head (struct Map_info *, const char *, const char *)
 Reads only info about vector map (headers) More...
 
int Vect_open_old_head2 (struct Map_info *, const char *, const char *, const char *)
 Reads only info about vector map (headers) More...
 
int Vect_open_new (struct Map_info *, const char *, int)
 Create new vector map for reading/writing. More...
 
int Vect_open_tmp_new (struct Map_info *, const char *, int)
 Create new temporary vector map. More...
 
int Vect_open_update (struct Map_info *, const char *, const char *)
 Open existing vector map for reading/writing. More...
 
int Vect_open_tmp_update (struct Map_info *, const char *, const char *)
 Open existing temporary vector map for reading/writing. More...
 
int Vect_open_update2 (struct Map_info *, const char *, const char *, const char *)
 Open existing vector map for reading/writing. More...
 
int Vect_open_update_head (struct Map_info *, const char *, const char *)
 Open header file of existing vector map for updating (mostly for database link updates) More...
 
int Vect_copy_head_data (struct Map_info *, struct Map_info *)
 Copy header data from one to another map. More...
 
int Vect_build (struct Map_info *)
 Build topology for vector map. More...
 
int Vect_topo_check (struct Map_info *, struct Map_info *)
 Extensive tests for correct topology. More...
 
int Vect_get_built (struct Map_info *)
 Return current highest built level (part) More...
 
int Vect_build_partial (struct Map_info *, int)
 Build partial topology for vector map. More...
 
int Vect_set_constraint_region (struct Map_info *, double, double, double, double, double, double)
 Set constraint region. More...
 
int Vect_set_constraint_type (struct Map_info *, int)
 Set constraint type. More...
 
int Vect_set_constraint_field (struct Map_info *, int)
 Set constraint field. More...
 
void Vect_remove_constraints (struct Map_info *)
 Remove all constraints. More...
 
int Vect_rewind (struct Map_info *)
 Rewind vector map to cause reads to start at beginning. More...
 
int Vect_close (struct Map_info *)
 Close vector map. More...
 
void Vect_set_error_handler_io (struct Map_info *, struct Map_info *)
 Define standard error handler for input and output vector maps. More...
 
int Vect_get_next_line_id (struct Map_info *)
 Get line id for sequential reading. More...
 
int Vect_read_next_line (struct Map_info *, struct line_pnts *, struct line_cats *)
 Read next vector feature. More...
 
off_t Vect_write_line (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 Writes a new feature. More...
 
off_t Vect_rewrite_line (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 Rewrites existing feature (topological level required) More...
 
int Vect_delete_line (struct Map_info *, off_t)
 Delete existing feature (topological level required) More...
 
int Vect_restore_line (struct Map_info *, off_t, off_t)
 Restore previously deleted feature (topological level required) More...
 
int Vect_get_num_dblinks (struct Map_info *)
 Get number of defined dblinks. More...
 
int Vect_read_line (struct Map_info *, struct line_pnts *, struct line_cats *, int)
 Read vector feature (topological level required) More...
 
int Vect_line_alive (struct Map_info *, int)
 Check if feature is alive or dead (topological level required) More...
 
int Vect_node_alive (struct Map_info *, int)
 Check if node is alive or dead (topological level required) More...
 
int Vect_area_alive (struct Map_info *, int)
 Check if area is alive or dead (topological level required) More...
 
int Vect_isle_alive (struct Map_info *, int)
 Check if isle is alive or dead (topological level required) More...
 
int Vect_get_line_nodes (struct Map_info *, int, int *, int *)
 Get line nodes. More...
 
int Vect_get_line_areas (struct Map_info *, int, int *, int *)
 Get area id on the left and right side of the boundary. More...
 
off_t Vect_get_line_offset (struct Map_info *, int)
 Get feature offset (topological level required) More...
 
int Vect_get_node_coor (struct Map_info *, int, double *, double *, double *)
 Get node coordinates. More...
 
int Vect_get_node_n_lines (struct Map_info *, int)
 Get number of lines for node. More...
 
int Vect_get_node_line (struct Map_info *, int, int)
 Get line id for node line index. More...
 
float Vect_get_node_line_angle (struct Map_info *, int, int)
 Angle of segment of the line connected to the node. More...
 
int Vect_get_area_points (struct Map_info *, int, struct line_pnts *)
 Returns polygon array of points (outer ring) of given area. More...
 
int Vect_get_area_centroid (struct Map_info *, int)
 Returns centroid id for given area. More...
 
int Vect_get_area_num_isles (struct Map_info *, int)
 Returns number of isles for given area. More...
 
int Vect_get_area_isle (struct Map_info *, int, int)
 Returns isle id for area. More...
 
double Vect_get_area_perimeter (struct Map_info *, int)
 Returns perimeter of area with perimeter of isles. More...
 
double Vect_get_area_area (struct Map_info *, int)
 Returns area of area without areas of isles. More...
 
int Vect_get_area_boundaries (struct Map_info *, int, struct ilist *)
 Creates list of boundaries for given area. More...
 
int Vect_get_isle_points (struct Map_info *, int, struct line_pnts *)
 Returns polygon array of points for given isle. More...
 
int Vect_get_isle_area (struct Map_info *, int)
 Returns area id for isle. More...
 
int Vect_get_isle_boundaries (struct Map_info *, int, struct ilist *)
 Creates list of boundaries for given isle. More...
 
int Vect_get_centroid_area (struct Map_info *, int)
 Get area id the centroid is within. More...
 
int Vect_get_num_updated_lines (struct Map_info *)
 Get number of updated features. More...
 
int Vect_get_updated_line (struct Map_info *, int)
 Get updated line by index. More...
 
off_t Vect_get_updated_line_offset (struct Map_info *, int)
 Get updated line offset by index. More...
 
int Vect_get_num_updated_nodes (struct Map_info *)
 Get number of updated nodes. More...
 
int Vect_get_updated_node (struct Map_info *, int)
 Get updated (modified) node by index. More...
 
void Vect_set_updated (struct Map_info *, int)
 Enable/disable maintenance of list of updated lines/nodes. More...
 
void Vect_reset_updated (struct Map_info *)
 Reset list of updated lines/nodes. More...
 
int Vect_hist_command (struct Map_info *)
 Write command info to history file. More...
 
int Vect_hist_write (struct Map_info *, const char *)
 Write string to history file. More...
 
int Vect_hist_copy (struct Map_info *, struct Map_info *)
 Copy history from one map to another. More...
 
void Vect_hist_rewind (struct Map_info *)
 Rewind history file. More...
 
char * Vect_hist_read (char *, int, struct Map_info *)
 Reads one line from history file without newline character. More...
 
int Vect_select_lines_by_box (struct Map_info *, const struct bound_box *, int, struct boxlist *)
 Select lines with bounding boxes by box. More...
 
int Vect_select_areas_by_box (struct Map_info *, const struct bound_box *, struct boxlist *)
 Select areas with bounding boxes by box. More...
 
int Vect_select_isles_by_box (struct Map_info *, const struct bound_box *, struct boxlist *)
 Select isles with bounding boxes by box. More...
 
int Vect_select_nodes_by_box (struct Map_info *, const struct bound_box *, struct ilist *)
 Select nodes by box. More...
 
int Vect_find_node (struct Map_info *, double, double, double, double, int)
 Find the nearest node. More...
 
int Vect_find_line (struct Map_info *, double, double, double, int, double, int, int)
 Find the nearest line. More...
 
int Vect_find_line_list (struct Map_info *, double, double, double, int, double, int, const struct ilist *, struct ilist *)
 Find the nearest line(s). More...
 
int Vect_find_area (struct Map_info *, double, double)
 Find the nearest area. More...
 
int Vect_find_island (struct Map_info *, double, double)
 Find the nearest island. More...
 
int Vect_select_lines_by_polygon (struct Map_info *, struct line_pnts *, int, struct line_pnts **, int, struct ilist *)
 Select lines by Polygon with optional isles. More...
 
int Vect_select_areas_by_polygon (struct Map_info *, struct line_pnts *, int, struct line_pnts **, struct ilist *)
 Select areas by Polygon with optional isles. More...
 
int Vect_tin_get_z (struct Map_info *, double, double, double *, double *, double *)
 
int Vect_find_poly_centroid (const struct line_pnts *, double *, double *)
 Get centroid of polygon. More...
 
int Vect__intersect_line_with_poly (const struct line_pnts *, double, struct line_pnts *)
 
int Vect_get_point_in_area (struct Map_info *, int, double *, double *)
 Get point inside area and outside all islands. More...
 
int Vect_get_point_in_poly (const struct line_pnts *, double *, double *)
 Get point inside polygon. More...
 
int Vect_get_point_in_poly_isl (const struct line_pnts *, const struct line_pnts **, int, double *, double *)
 Get point inside polygon but outside the islands specifiled in IPoints. More...
 
int Vect_point_in_area (double, double, struct Map_info *, int, struct bound_box *)
 Check if point is in area. More...
 
int Vect_point_in_area_outer_ring (double, double, struct Map_info *, int, struct bound_box *)
 Determines if a point (X,Y) is inside an area outer ring. Islands are not considered. More...
 
int Vect_point_in_island (double, double, struct Map_info *, int, struct bound_box *)
 Determines if a point (X,Y) is inside an island. More...
 
int Vect_point_in_poly (double, double, const struct line_pnts *)
 Determines if a point (X,Y) is inside a polygon. More...
 
void Vect_break_lines (struct Map_info *, int, struct Map_info *)
 Break lines in vector map at each intersection. More...
 
int Vect_break_lines_list (struct Map_info *, struct ilist *, struct ilist *, int, struct Map_info *)
 Break selected lines in vector map at each intersection. More...
 
int Vect_check_line_breaks (struct Map_info *, int, struct Map_info *)
 Check for and count intersecting lines, do not break. More...
 
int Vect_check_line_breaks_list (struct Map_info *, struct ilist *, struct ilist *, int, struct Map_info *)
 Check for and count intersecting lines, do not break. More...
 
int Vect_merge_lines (struct Map_info *, int, int *, struct Map_info *)
 Merge lines or boundaries in vector map. More...
 
void Vect_break_polygons (struct Map_info *, int, struct Map_info *)
 Break polygons in vector map. More...
 
void Vect_remove_duplicates (struct Map_info *, int, struct Map_info *)
 Remove duplicate features from vector map. More...
 
int Vect_line_check_duplicate (const struct line_pnts *, const struct line_pnts *, int)
 Check for duplicate lines. More...
 
void Vect_snap_lines (struct Map_info *, int, double, struct Map_info *)
 Snap lines in vector map to existing vertex in threshold. More...
 
void Vect_snap_lines_list (struct Map_info *, const struct ilist *, double, struct Map_info *)
 Snap selected lines to existing vertex in threshold. More...
 
int Vect_snap_line (struct Map_info *, struct ilist *, struct line_pnts *, double, int, int *, int *)
 Snap a line to reference lines in Map with threshold. More...
 
void Vect_remove_dangles (struct Map_info *, int, double, struct Map_info *)
 Remove dangles from vector map. More...
 
void Vect_chtype_dangles (struct Map_info *, double, struct Map_info *)
 Change boundary dangles to lines. More...
 
void Vect_select_dangles (struct Map_info *, int, double, struct ilist *)
 Select dangles from vector map. More...
 
void Vect_remove_bridges (struct Map_info *, struct Map_info *, int *, int *)
 Remove bridges from vector map. More...
 
void Vect_chtype_bridges (struct Map_info *, struct Map_info *, int *, int *)
 Change type of bridges in vector map. More...
 
int Vect_remove_small_areas (struct Map_info *, double, struct Map_info *, double *)
 Remove small areas from the map map. More...
 
int Vect_clean_small_angles_at_nodes (struct Map_info *, int, struct Map_info *)
 Clean small angles at nodes. More...
 
int Vect_overlay_str_to_operator (const char *)
 Get operator code from string. More...
 
int Vect_overlay (struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, int, struct Map_info *)
 Overlay 2 vector maps and create new one. More...
 
int Vect_overlay_and (struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *)
 
void Vect_graph_init (dglGraph_s *, int)
 Initialize graph structure. More...
 
void Vect_graph_build (dglGraph_s *)
 Build network graph. More...
 
void Vect_graph_add_edge (dglGraph_s *, int, int, double, int)
 Add edge to graph. More...
 
void Vect_graph_set_node_costs (dglGraph_s *, int, double)
 Set node costs. More...
 
int Vect_graph_shortest_path (dglGraph_s *, int, int, struct ilist *, double *)
 Find shortest path. More...
 
int Vect_net_build_graph (struct Map_info *, int, int, int, const char *, const char *, const char *, int, int)
 Build network graph. More...
 
int Vect_net_ttb_build_graph (struct Map_info *, int, int, int, int, int, const char *, const char *, const char *, int, int)
 
int Vect_net_shortest_path (struct Map_info *, int, int, struct ilist *, double *)
 Find shortest path. More...
 
int Vect_net_ttb_shortest_path (struct Map_info *, int, int, int, int, int, struct ilist *, double *)
 Find shortest path on network. More...
 
dglGraph_sVect_net_get_graph (struct Map_info *)
 Get graph structure. More...
 
int Vect_net_get_line_cost (struct Map_info *, int, int, double *)
 Returns in cost for given direction in *cost. More...
 
int Vect_net_get_node_cost (struct Map_info *, int, double *)
 Get cost of node. More...
 
int Vect_net_nearest_nodes (struct Map_info *, double, double, double, int, double, int *, int *, int *, double *, double *, struct line_pnts *, struct line_pnts *, double *)
 Find nearest node(s) on network. More...
 
int Vect_net_shortest_path_coor (struct Map_info *, double, double, double, double, double, double, double, double, double *, struct line_pnts *, struct ilist *, struct ilist *, struct line_pnts *, struct line_pnts *, double *, double *)
 Find shortest path on network between 2 points given by coordinates. More...
 
int Vect_net_ttb_shortest_path_coor (struct Map_info *, double, double, double, double, double, double, double, double, int, double *, struct line_pnts *, struct ilist *, struct ilist *, struct line_pnts *, struct line_pnts *, double *, double *)
 Find shortest path on network with turntable between 2 points given by coordinates. More...
 
int Vect_topo_dump (struct Map_info *, FILE *)
 Dump topology to file. More...
 
double Vect_points_distance (double, double, double, double, double, double, int)
 Calculate distance of 2 points. More...
 
int Vect_option_to_types (const struct Option *)
 Get types from options. More...
 
int Vect_copy_map_lines (struct Map_info *, struct Map_info *)
 Copy all alive vector features from input vector map to output vector map. More...
 
int Vect_copy_map_lines_field (struct Map_info *, int, struct Map_info *)
 Copy all alive vector features from given layer from input vector map to output vector map. More...
 
int Vect_copy (const char *, const char *, const char *)
 Copy vector map including attribute tables. More...
 
int Vect_rename (const char *, const char *)
 Rename existing vector map (in the current mapset). More...
 
int Vect_copy_table (struct Map_info *, struct Map_info *, int, int, const char *, int)
 Copy attribute table linked to vector map based on type. More...
 
int Vect_copy_table_by_cat_list (struct Map_info *, struct Map_info *, int, int, const char *, int, const struct cat_list *)
 Copy attribute table linked to vector map based on category list. More...
 
int Vect_copy_table_by_cats (struct Map_info *, struct Map_info *, int, int, const char *, int, int *, int)
 Copy attribute table linked to vector map based on category numbers. More...
 
int Vect_copy_tables (struct Map_info *, struct Map_info *, int)
 Copy attribute tables linked to vector map. More...
 
int Vect_delete (const char *)
 Delete vector map including attribute tables. More...
 
int Vect_segment_intersection (double, double, double, double, double, double, double, double, double, double, double, double, double *, double *, double *, double *, double *, double *, int)
 Check for intersect of 2 line segments. More...
 
int Vect_line_intersection (struct line_pnts *, struct line_pnts *, struct bound_box *, struct bound_box *, struct line_pnts ***, struct line_pnts ***, int *, int *, int)
 
int Vect_line_intersection2 (struct line_pnts *, struct line_pnts *, struct bound_box *, struct bound_box *, struct line_pnts ***, struct line_pnts ***, int *, int *, int)
 Intersect 2 lines. More...
 
int Vect_line_check_intersection (struct line_pnts *, struct line_pnts *, int)
 Check if 2 lines intersect. More...
 
int Vect_line_check_intersection2 (struct line_pnts *, struct line_pnts *, int)
 Check if 2 lines intersect. More...
 
int Vect_line_get_intersections (struct line_pnts *, struct line_pnts *, struct line_pnts *, int)
 Get 2 lines intersection points. More...
 
int Vect_line_get_intersections2 (struct line_pnts *, struct line_pnts *, struct line_pnts *, int)
 Get 2 lines intersection points. More...
 
char * Vect_subst_var (const char *, struct Map_info *)
 Substitute variable in string. More...
 
void Vect_spatial_index_init (struct spatial_index *, int)
 Initialize spatial index structure. More...
 
void Vect_spatial_index_destroy (struct spatial_index *)
 Destroy existing spatial index. More...
 
void Vect_spatial_index_add_item (struct spatial_index *, int, const struct bound_box *)
 Add a new item to spatial index structure. More...
 
void Vect_spatial_index_del_item (struct spatial_index *, int, const struct bound_box *)
 Delete item from spatial index structure. More...
 
int Vect_spatial_index_select (const struct spatial_index *, const struct bound_box *, struct ilist *)
 Select items by bounding box to list. More...
 
int Vect_read_ascii (FILE *, struct Map_info *)
 Read data in GRASS ASCII vector format. More...
 
int Vect_read_ascii_head (FILE *, struct Map_info *)
 Read header of GRASS ASCII vector format. More...
 
int Vect_write_ascii (FILE *, FILE *, struct Map_info *, int, int, int, char *, int, int, int, const struct cat_list *, const char *, const char **, int)
 Write data to GRASS ASCII vector format. More...
 
void Vect_write_ascii_head (FILE *, struct Map_info *)
 Write data to GRASS ASCII vector format. More...
 
SF_FeatureType Vect_sfa_get_line_type (const struct line_pnts *, int, int)
 Get SF type of given vector feature. More...
 
int Vect_sfa_get_type (SF_FeatureType)
 Get relevant GV type. More...
 
int Vect_sfa_check_line_type (const struct line_pnts *, int, SF_FeatureType, int)
 Check SF type. More...
 
int Vect_sfa_line_dimension (int)
 Get geometry dimension. More...
 
char * Vect_sfa_line_geometry_type (const struct line_pnts *, int)
 Get geometry type (string) More...
 
int Vect_sfa_line_astext (const struct line_pnts *, int, int, int, FILE *)
 Export geometry to Well-Known Text. More...
 
int Vect_sfa_is_line_simple (const struct line_pnts *, int, int)
 
int Vect_sfa_is_line_closed (const struct line_pnts *, int, int)
 Check if feature is closed. More...
 
int Vect_sfa_get_num_features (struct Map_info *)
 Get number of simple features. More...
 
int Vect_print_header (struct Map_info *)
 Print vector map header to stdout. More...
 
void Vect__init_head (struct Map_info *)
 Initialize Map_info head structure (dig_head) More...
 
int Vect_coor_info (struct Map_info *, struct Coor_info *)
 Update Coor_info structure. More...
 
const char * Vect_maptype_info (struct Map_info *)
 Gets vector map format (as string) More...
 
int Vect_maptype (struct Map_info *)
 Gets vector map format. More...
 
int Vect_open_topo (struct Map_info *, int)
 Open topology file ('topo') More...
 
int Vect_save_topo (struct Map_info *)
 Save topology file for vector map. More...
 
int Vect_open_sidx (struct Map_info *, int)
 Open spatial index file ('sidx') More...
 
int Vect_save_sidx (struct Map_info *)
 Save spatial index file for vector map. More...
 
int Vect_sidx_dump (struct Map_info *, FILE *)
 Dump spatial index to file. More...
 
int Vect_build_sidx_from_topo (struct Map_info *)
 Create spatial index from topology if necessary (not longer supported) More...
 
int Vect_build_sidx (struct Map_info *)
 Create spatial index if necessary. More...
 
int Vect_open_fidx (struct Map_info *, struct Format_info_offset *)
 Open feature index file. More...
 
int Vect_save_fidx (struct Map_info *, struct Format_info_offset *)
 Save feature index file for vector map. More...
 
int Vect_fidx_dump (struct Map_info *, FILE *)
 Dump feature index to file. More...
 
int Vect_save_frmt (struct Map_info *)
 Save format definition file for vector map. More...
 
int Vect__write_head (struct Map_info *)
 Writes head information to text file (GV_HEAD_ELEMENT) More...
 
int Vect__read_head (struct Map_info *)
 Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only. More...
 
int V1_open_old_nat (struct Map_info *, int)
 Open existing vector map (level 1) More...
 
int V1_open_old_ogr (struct Map_info *, int)
 Open existing OGR layer on non-topological level. More...
 
int V1_open_old_pg (struct Map_info *, int)
 
int V2_open_old_ogr (struct Map_info *)
 Open existing OGR layer on topological level. More...
 
int V2_open_old_pg (struct Map_info *)
 
int V1_open_new_nat (struct Map_info *, const char *, int)
 Create new vector map (level 1) More...
 
int V1_open_new_ogr (struct Map_info *, const char *, int)
 Prepare OGR datasource for creating new OGR layer (level 1) More...
 
int V1_open_new_pg (struct Map_info *, const char *, int)
 
int V1_rewind_nat (struct Map_info *)
 Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native format - internal use only. More...
 
int V1_rewind_ogr (struct Map_info *)
 Rewind vector map (OGR layer) to cause reads to start at beginning (level 1) More...
 
int V1_rewind_pg (struct Map_info *)
 Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1) More...
 
int V2_rewind_nat (struct Map_info *)
 Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format - internal use only. More...
 
int V2_rewind_ogr (struct Map_info *)
 Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2) More...
 
int V2_rewind_pg (struct Map_info *)
 Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2) More...
 
int V1_close_nat (struct Map_info *)
 Close vector map. More...
 
int V1_close_ogr (struct Map_info *)
 Close vector map (OGR dsn & layer) on level 1. More...
 
int V1_close_pg (struct Map_info *)
 
int V2_close_ogr (struct Map_info *)
 Close vector map on topological level (write out fidx file) More...
 
int V2_close_pg (struct Map_info *)
 
int V1_read_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *, off_t)
 Read vector feature on non-topological level (level 1) - native format - internal use only. More...
 
int V1_read_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *, off_t)
 Read feature from OGR layer at given offset (level 1 without topology) More...
 
int V1_read_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *, off_t)
 
int V2_read_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *, int)
 Read vector feature on topological level (level 2) - native format - internal use only. More...
 
int V2_read_line_sfa (struct Map_info *, struct line_pnts *, struct line_cats *, int)
 Reads feature from OGR/PostGIS layer on topological level. More...
 
int V2_read_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *, int)
 
int V1_read_next_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *)
 Read next vector feature on non-topological level (level 1) - native format - internal use only. More...
 
int V1_read_next_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *)
 Read next feature from OGR layer. Skip empty features (level 1 without topology). More...
 
int V1_read_next_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *)
 
int V2_read_next_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *)
 Read next vector feature on topological level (level 2) - native format - internal use only. More...
 
int V2_read_next_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *)
 Read next feature from OGR layer on topological level. More...
 
int V2_read_next_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *)
 
int V1_delete_line_nat (struct Map_info *, off_t)
 Deletes feature at level 1 (internal use only) More...
 
int V1_delete_line_ogr (struct Map_info *, off_t)
 Deletes feature at the given offset on level 1 (OGR interface) More...
 
int V1_delete_line_pg (struct Map_info *, off_t)
 
int V2_delete_line_nat (struct Map_info *, off_t)
 Deletes feature at topological level (internal use only) More...
 
int V2_delete_line_sfa (struct Map_info *, off_t)
 Deletes feature on level 2 (OGR/PostGIS interface) More...
 
int V2_delete_line_pg (struct Map_info *, off_t)
 
int V1_restore_line_nat (struct Map_info *, off_t, off_t)
 Restores feature at level 1 (internal use only) More...
 
int V2_restore_line_nat (struct Map_info *, off_t, off_t)
 Restores feature at topological level (internal use only) More...
 
off_t V1_write_line_nat (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 Writes feature to 'coor' file at level 1 (internal use only) More...
 
off_t V1_write_line_ogr (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 Writes feature on level 1 (OGR interface) More...
 
off_t V1_write_line_pg (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 
off_t V2_write_line_nat (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 Writes feature to 'coor' file at topological level (internal use only) More...
 
off_t V2_write_line_sfa (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 Writes feature on level 2 (OGR/PostGIS interface, pseudo-topological level) More...
 
off_t V2_write_line_pg (struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
 
off_t V1_rewrite_line_nat (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 Rewrites feature to 'coor' file at level 1 (internal use only) More...
 
off_t V1_rewrite_line_ogr (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 Rewrites feature at the given offset on level 1 (OGR interface) More...
 
off_t V1_rewrite_line_pg (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 
off_t V2_rewrite_line_nat (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 Rewrites feature to 'coor' file at topological level (internal use only) More...
 
off_t V2_rewrite_line_sfa (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 Rewrites feature at the given offset on level 2 (OGR/PostGIS interface, pseudo-topological level) More...
 
off_t V2_rewrite_line_pg (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
 
int Vect_build_nat (struct Map_info *, int)
 Build topology. More...
 
void Vect__build_downgrade (struct Map_info *, int)
 Downgrade build level (for internal use only) More...
 
int Vect__build_sfa (struct Map_info *, int)
 Build pseudo-topology (for simple features) - internal use only. More...
 
int Vect_build_ogr (struct Map_info *, int)
 Build pseudo-topology (simple features) for OGR layer. More...
 
int Vect_build_pg (struct Map_info *, int)
 
int Vect_build_line_area (struct Map_info *, int, int)
 Build area on given side of line (GV_LEFT or GV_RIGHT) More...
 
int Vect_isle_find_area (struct Map_info *, int, const struct bound_box *)
 Find area outside island. More...
 
int Vect_attach_isle (struct Map_info *, int, const struct bound_box *)
 (Re)Attach isle to area More...
 
int Vect_attach_isles (struct Map_info *, const struct bound_box *)
 (Re)Attach isles in given bounding box to areas More...
 
int Vect_attach_centroids (struct Map_info *, const struct bound_box *)
 (Re)Attach centroids in given bounding box to areas More...
 
GEOSGeometryVect_read_line_geos (struct Map_info *, int, int *)
 Read vector feature and stores it as GEOSGeometry instance. More...
 
GEOSGeometryVect_line_to_geos (const struct line_pnts *, int, int)
 Create GEOSGeometry of given type from feature points. More...
 
GEOSGeometryVect_read_area_geos (struct Map_info *, int)
 Read vector area and stores it as GEOSGeometry instance (polygon) More...
 
GEOSCoordSequenceVect_get_area_points_geos (struct Map_info *, int)
 Returns the polygon array of points, i.e. outer ring (shell) More...
 
GEOSCoordSequenceVect_get_isle_points_geos (struct Map_info *, int)
 Returns the polygon (isle) array of points (inner ring) More...
 
char * Vect_line_to_wkt (const struct line_pnts *, int, bool)
 Create a Well Known Text (WKT) representation of given feature type from points. More...
 
char * Vect_line_to_wkt2 (const struct line_pnts *, int, bool, bool)
 Create a Well Known Text (WKT) representation of given feature type from points. More...
 
unsigned char * Vect_line_to_wkb (const struct line_pnts *, int, int, size_t *)
 Create a Well Known Binary (WKB) representation of given feature type from points. More...
 
char * Vect_read_area_to_wkt (struct Map_info *, int)
 Read vector area and return it as Well Known Text (WKT) unsigned char array. More...
 
char * Vect_read_area_to_wkt2 (struct Map_info *, int, bool)
 Read vector area and return it as Well Known Text (WKT) unsigned char array. More...
 
unsigned char * Vect_read_area_to_wkb (struct Map_info *, int, size_t *)
 Read vector area and return it as Well Known Binary (WKB) unsigned char array. More...
 
unsigned char * Vect_read_line_to_wkb (struct Map_info *, struct line_pnts *, struct line_cats *, int, size_t *, int *)
 Read a Well Known Binary (WKB) representation of a given feature id. More...
 
int Vect_read_colors (const char *, const char *, struct Colors *)
 Read color table of vector map. More...
 
int Vect_remove_colors (const char *, const char *)
 Remove color table of raster map. More...
 
void Vect_write_colors (const char *, const char *, struct Colors *)
 Write color table for vector map. More...
 
int RTreeSearch2 (struct RTree *, struct RTree_Rect *, struct ilist *)
 

Function Documentation

◆ RTreeSearch2()

int RTreeSearch2 ( struct RTree t,
struct RTree_Rect r,
struct ilist list 
)

Search in an index tree for all data rectangles that overlap the argument rectangle.

Parameters
tThe RTree
rThe argument rectangle
listThe list to store the ids of overlapping rectangles
Returns
the number of qualifying data rects.

Definition at line 40 of file rtree_search.c.

References assert, G_init_ilist(), r, and t.

◆ V1_close_nat()

◆ V1_close_ogr()

◆ V1_close_pg()

int V1_close_pg ( struct Map_info )

◆ V1_delete_line_nat()

int V1_delete_line_nat ( struct Map_info Map,
off_t  offset 
)

Deletes feature at level 1 (internal use only)

Parameters
Mappointer Map_info structure
offsetfeature offset
Returns
0 on success
-1 on error

Definition at line 248 of file write_nat.c.

References dig__fread_port_C(), dig__fwrite_port_C(), dig_fflush(), Map_info::dig_fp, dig_fseek(), dig_set_cur_port(), G_debug(), Map_info::head, and dig_head::port.

◆ V1_delete_line_ogr()

int V1_delete_line_ogr ( struct Map_info Map,
off_t  offset 
)

Deletes feature at the given offset on level 1 (OGR interface)

Parameters
Mappointer Map_info structure
offsetoffset of feature to be deleted
Returns
0 on success
-1 on error

Definition at line 119 of file write_ogr.c.

References _, Format_info_offset::array, Format_info_offset::array_num, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Format_info_ogr::layer, Format_info_ogr::offset, and Format_info::ogr.

◆ V1_delete_line_pg()

int V1_delete_line_pg ( struct Map_info ,
off_t   
)

◆ V1_open_new_nat()

int V1_open_new_nat ( struct Map_info Map,
const char *  name,
int  with_z 
)

◆ V1_open_new_ogr()

int V1_open_new_ogr ( struct Map_info Map,
const char *  name,
int  with_z 
)

Prepare OGR datasource for creating new OGR layer (level 1)

New OGR layer is created when writing features by Vect_wrile_line().

Parameters
[out]Mappointer to Map_info structure
namename of OGR layer to create
with_zWITH_Z for 3D vector data otherwise WITHOUT_Z
Returns
0 success
-1 error

Definition at line 180 of file open_ogr.c.

References _, Format_info_ogr::driver, Format_info_ogr::driver_name, Format_info_ogr::ds, Format_info_ogr::dsn, Map_info::fInfo, G_debug(), G_fatal_error(), G_get_overwrite(), G_warning(), Format_info_ogr::layer, Format_info_ogr::layer_name, name, NULL, and Format_info::ogr.

◆ V1_open_new_pg()

int V1_open_new_pg ( struct Map_info ,
const char *  ,
int   
)

◆ V1_open_old_nat()

int V1_open_old_nat ( struct Map_info Map,
int  update 
)

Open existing vector map (level 1)

Map->name and Map->mapset must be set before.

Parameters
Mappointer to Map_info structure
updatenon-zero for write mode, otherwise read-only
Returns
0 success
-1 error

Definition at line 40 of file open_nat.c.

References _, dig__read_head(), dig_file_init(), Map_info::dig_fp, gvfile::file, G_debug(), G_fopen_modify(), G_fopen_old(), G_warning(), GPATH_MAX, GV_COOR_ELEMENT, Map_info::head, Map_info::mapset, Map_info::name, NULL, dig_head::size, Coor_info::size, Vect__get_path(), Vect_coor_info(), and Vect_get_full_name().

◆ V1_open_old_ogr()

int V1_open_old_ogr ( struct Map_info Map,
int  update 
)

Open existing OGR layer on non-topological level.

Note: Map->name, Map->mapset, Map->fInfo.ogr.dsn and Map->fInfo.ogr.layer_name must be set before.

Parameters
[in,out]Mappointer to Map_info structure
updateTRUE for write mode, otherwise read-only
Returns
0 success
-1 error

Definition at line 43 of file open_ogr.c.

References _, Format_info_ogr::cache, Format_info_ogr::ds, Format_info_ogr::dsn, FALSE, Format_info_cache::fid, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Map_info::head, Format_info_ogr::layer, Format_info_ogr::layer_name, NULL, Format_info::ogr, WITH_Z, dig_head::with_z, and WITHOUT_Z.

◆ V1_open_old_pg()

int V1_open_old_pg ( struct Map_info ,
int   
)

◆ V1_read_line_nat()

int V1_read_line_nat ( struct Map_info Map,
struct line_pnts Points,
struct line_cats Cats,
off_t  offset 
)

Read vector feature on non-topological level (level 1) - native format - internal use only.

This function implements random access for native format, constraints are ignored!

Parameters
Mappointer to Map_info struct
[out]Pointscontainer used to store line points within (pointer to line_pnts struct)
[out]Catscontainer used to store line categories within (pointer to line_cats struct)
offsetgiven offset
Returns
feature type (GV_POINT, GV_LINE, ...)
0 dead line
-2 nothing to read
-1 on failure

Definition at line 43 of file read_nat.c.

◆ V1_read_line_ogr()

int V1_read_line_ogr ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
off_t  offset 
)

Read feature from OGR layer at given offset (level 1 without topology)

This function implements random access on level 1.

Parameters
Mappointer to Map_info structure
[out]line_pcontainer used to store line points within (pointer line_pnts struct)
[out]line_ccontainer used to store line categories within (pointer line_cats struct)
offsetgiven offset
Returns
line type
0 dead line
-2 no more features
-1 on failure

Definition at line 179 of file read_ogr.c.

◆ V1_read_line_pg()

int V1_read_line_pg ( struct Map_info ,
struct line_pnts ,
struct line_cats ,
off_t   
)

◆ V1_read_next_line_nat()

int V1_read_next_line_nat ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c 
)

Read next vector feature on non-topological level (level 1) - native format - internal use only.

This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field().

Dead features are skipped.

Vect_rewind() can be used to reset reading.

Parameters
Mappointer to Map_info struct
[out]line_pcontainer used to store line points within (pointer to line_pnts struct)
[out]line_ccontainer used to store line categories within (pointer to line_cats struct)
Returns
feature type (GV_POINT, GV_LINE, ...)
0 dead line
-2 nothing to read
-1 on failure

Definition at line 71 of file read_nat.c.

References Map_info::constraint, Map_info::dig_fp, dig_ftell(), G_debug(), Map_info::region_flag, TRUE, and Vect_get_constraint_box().

◆ V1_read_next_line_ogr()

int V1_read_next_line_ogr ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c 
)

Read next feature from OGR layer. Skip empty features (level 1 without topology).

This function implements sequential access.

The action of this routine can be modified by:

Parameters
Mappointer to Map_info structure
[out]line_pcontainer used to store line points within
[out]line_ccontainer used to store line categories within
Returns
feature type
-2 no more features (EOF)
-1 out of memory

Definition at line 49 of file read_ogr.c.

◆ V1_read_next_line_pg()

int V1_read_next_line_pg ( struct Map_info ,
struct line_pnts ,
struct line_cats  
)

◆ V1_restore_line_nat()

int V1_restore_line_nat ( struct Map_info Map,
off_t  offset,
off_t  line 
)

Restores feature at level 1 (internal use only)

Parameters
Mappointer to Map_info structure
offsetfeature offset
linefeature id (not used)
Returns
0 on success
-1 on error

Definition at line 350 of file write_nat.c.

◆ V1_rewind_nat()

int V1_rewind_nat ( struct Map_info Map)

Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native format - internal use only.

Parameters
Mappointer to Map_info struct
Returns
0 on success
-1 on error

Definition at line 27 of file rewind_nat.c.

References Map_info::dig_fp, dig_fseek(), Map_info::head, and dig_head::head_size.

Referenced by V2_rewind_nat().

◆ V1_rewind_ogr()

int V1_rewind_ogr ( struct Map_info Map)

Rewind vector map (OGR layer) to cause reads to start at beginning (level 1)

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 32 of file rewind_ogr.c.

References _, Format_info_ogr::cache, Map_info::fInfo, G_debug(), G_fatal_error(), Format_info_ogr::layer, Format_info_cache::lines_next, Format_info_cache::lines_num, Map_info::name, and Format_info::ogr.

Referenced by V2_rewind_ogr().

◆ V1_rewind_pg()

int V1_rewind_pg ( struct Map_info Map)

Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1)

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 34 of file rewind_pg.c.

References _, Format_info_pg::cache, Format_info_cache::ctype, Format_info_cache::fid, Map_info::fInfo, G_debug(), G_fatal_error(), Format_info_cache::lines_next, Format_info_cache::lines_num, Map_info::name, Format_info_pg::next_line, Format_info::pg, and Vect__close_cursor_pg().

Referenced by V2_rewind_pg().

◆ V1_rewrite_line_nat()

off_t V1_rewrite_line_nat ( struct Map_info Map,
off_t  offset,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites feature to 'coor' file at level 1 (internal use only)

If the number of points or cats differs from the original one or the type is changed: GV_POINTS -> GV_LINES or GV_LINES -> GV_POINTS, the old one is deleted and the new is appended to the end of the file.

Old feature is deleted (marked as dead), and a new feature written.

Parameters
Mappointer to Map_info structure
offsetfeature offset
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
feature offset (rewritten feature)
-1 on error

Definition at line 105 of file write_nat.c.

◆ V1_rewrite_line_ogr()

off_t V1_rewrite_line_ogr ( struct Map_info Map,
off_t  offset,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites feature at the given offset on level 1 (OGR interface)

This function simply calls V1_delete_line_ogr() and V1_write_line_ogr().

Parameters
Mappointer to Map_info structure
offsetfeature offset
typefeature type (see V1_write_line_ogr() for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
feature offset (rewritten feature)
-1 on error

Definition at line 89 of file write_ogr.c.

◆ V1_rewrite_line_pg()

off_t V1_rewrite_line_pg ( struct Map_info ,
off_t  ,
int  ,
const struct line_pnts ,
const struct line_cats  
)

◆ V1_write_line_nat()

off_t V1_write_line_nat ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes feature to 'coor' file at level 1 (internal use only)

Parameters
Mappointer to Map_info structure
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
feature offset into file
-1 on error

Definition at line 45 of file write_nat.c.

◆ V1_write_line_ogr()

off_t V1_write_line_ogr ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes feature on level 1 (OGR interface)

Note:

  • centroids are not supported in OGR, pseudotopo holds virtual centroids (it's coordinates determined from spatial index)
  • unclosed boundaries are not supported in OGR, pseudotopo treats polygons as boundaries

Supported feature types:

  • GV_POINT (written as wkbPoint)
  • GV_LINE (wkbLineString)
  • GV_BOUNDARY (wkbPolygon)
  • GV_FACE (wkbPolygon25D)
  • GV_KERNEL (wkbPoint25D)
Parameters
Mappointer to Map_info structure
typefeature type
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
feature index in offset array (related to pseudo-topology)
-1 on error

Definition at line 63 of file write_ogr.c.

◆ V1_write_line_pg()

off_t V1_write_line_pg ( struct Map_info ,
int  ,
const struct line_pnts ,
const struct line_cats  
)

◆ V2_close_ogr()

int V2_close_ogr ( struct Map_info Map)

Close vector map on topological level (write out fidx file)

Parameters
Mappointer to Map_info structure
Returns
0 on success
non-zero on error

Definition at line 90 of file close_ogr.c.

References _, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Map_info::mapset, Map_info::name, Format_info_ogr::offset, Format_info::ogr, Vect__free_offset(), VECT_OPEN, and Vect_save_fidx().

◆ V2_close_pg()

int V2_close_pg ( struct Map_info )

◆ V2_delete_line_nat()

int V2_delete_line_nat ( struct Map_info Map,
off_t  line 
)

Deletes feature at topological level (internal use only)

Note: requires topology level >= GV_BUILD_BASE.

Parameters
pointerto Map_info structure
linefeature id
Returns
0 on success
-1 on error

Definition at line 290 of file write_nat.c.

◆ V2_delete_line_pg()

int V2_delete_line_pg ( struct Map_info ,
off_t   
)

◆ V2_delete_line_sfa()

int V2_delete_line_sfa ( struct Map_info Map,
off_t  line 
)

Deletes feature on level 2 (OGR/PostGIS interface)

Note: Topology must be built at level >= GV_BUILD_BASE

Todo:
Update fidx
Parameters
pointerto Map_info structure
linefeature id to be deleted
Returns
0 on success
-1 on error

Definition at line 193 of file write_sfa.c.

◆ V2_open_old_ogr()

int V2_open_old_ogr ( struct Map_info Map)

Open existing OGR layer on topological level.

This functions reads feature index (fidx) file required for pseudo-topology.

Parameters
[in,out]Mappointer to Map_info structure
Returns
0 success
-1 error

Definition at line 145 of file open_ogr.c.

References _, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), G_zero(), Map_info::mapset, Map_info::name, Format_info_ogr::next_line, Format_info_ogr::offset, Format_info::ogr, Vect_get_full_name(), and Vect_open_fidx().

◆ V2_open_old_pg()

int V2_open_old_pg ( struct Map_info )

◆ V2_read_line_nat()

int V2_read_line_nat ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
int  line 
)

Read vector feature on topological level (level 2) - native format - internal use only.

This function implements random access for native format, constraints are ignored!

Note: Topology must be built at level >= GV_BUILD_BASE

Parameters
Mappointer to Map_info struct
[out]Pointscontainer used to store line points within (pointer to line_pnts struct)
[out]Catscontainer used to store line categories within (pointer to line_cats struct)
linefeature id to read (starts at 1)
Returns
feature type (GV_POINT, GV_LINE, ...)
-2 nothing to read
-1 on failure

Definition at line 136 of file read_nat.c.

◆ V2_read_line_pg()

int V2_read_line_pg ( struct Map_info ,
struct line_pnts ,
struct line_cats ,
int   
)

◆ V2_read_line_sfa()

int V2_read_line_sfa ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
int  line 
)

Reads feature from OGR/PostGIS layer on topological level.

This function implements random access on level 2.

Note: Topology must be built at level >= GV_BUILD_BASE

Parameters
Mappointer to Map_info structure
[out]line_pcontainer used to store line points within (pointer to line_pnts struct)
[out]line_ccontainer used to store line categories within (pointer to line_cats struct)
linefeature id (starts at 1)
Returns
feature type
-2 no more features
-1 on failure

Definition at line 40 of file read_sfa.c.

◆ V2_read_next_line_nat()

int V2_read_next_line_nat ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c 
)

Read next vector feature on topological level (level 2) - native format - internal use only.

This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field().

Use Vect_rewind() to reset reading.

Dead feature are skipped.

Parameters
Mappointer to Map_info struct
[out]line_pcontainer used to store line points within (pointer to line_pnts struct)
[out]line_ccontainer used to store line categories within (pointer to line_cats struct)
Returns
feature type (GV_POINT, GV_LINE, ...)
-2 nothing to read
-1 on error

Definition at line 178 of file read_nat.c.

◆ V2_read_next_line_ogr()

int V2_read_next_line_ogr ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c 
)

Read next feature from OGR layer on topological level.

This function implements sequential access.

Parameters
Mappointer to Map_info structure
[out]line_pcontainer used to store line points within (pointer to line_pnts struct)
[out]line_ccontainer used to store line categories within (pointer to line_cats struct)
Returns
feature type
-2 no more features (EOF)
-1 on failure

Definition at line 75 of file read_ogr.c.

◆ V2_read_next_line_pg()

int V2_read_next_line_pg ( struct Map_info ,
struct line_pnts ,
struct line_cats  
)

◆ V2_restore_line_nat()

int V2_restore_line_nat ( struct Map_info Map,
off_t  offset,
off_t  line 
)

Restores feature at topological level (internal use only)

Note: requires topology level >= GV_BUILD_BASE.

Parameters
Mappointer to Map_info structure
offsetfeature offset to be restored
linefeature id to be restored
Returns
0 on success
-1 on error

Definition at line 398 of file write_nat.c.

◆ V2_rewind_nat()

int V2_rewind_nat ( struct Map_info Map)

Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format - internal use only.

Parameters
Mappointer to Map_info struct
Returns
0 on success
-1 on error

Definition at line 40 of file rewind_nat.c.

References Map_info::next_line, and V1_rewind_nat().

◆ V2_rewind_ogr()

int V2_rewind_ogr ( struct Map_info Map)

Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2)

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 61 of file rewind_ogr.c.

References _, G_debug(), G_fatal_error(), Map_info::name, Map_info::next_line, and V1_rewind_ogr().

◆ V2_rewind_pg()

int V2_rewind_pg ( struct Map_info Map)

Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2)

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 70 of file rewind_pg.c.

References _, G_debug(), G_fatal_error(), Map_info::name, Map_info::next_line, and V1_rewind_pg().

◆ V2_rewrite_line_nat()

off_t V2_rewrite_line_nat ( struct Map_info Map,
off_t  line,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites feature to 'coor' file at topological level (internal use only)

Note: requires topology level >= GV_BUILD_BASE.

Note: Function returns feature id, but is defined as off_t for compatibility with level 1 functions.

Parameters
Mappointer to Map_info structure
linefeature id to be rewritten
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
new feature id or 0 (build level < GV_BUILD_BASE)
-1 on error

Definition at line 161 of file write_nat.c.

◆ V2_rewrite_line_pg()

off_t V2_rewrite_line_pg ( struct Map_info ,
off_t  ,
int  ,
const struct line_pnts ,
const struct line_cats  
)

◆ V2_rewrite_line_sfa()

off_t V2_rewrite_line_sfa ( struct Map_info Map,
off_t  line,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites feature at the given offset on level 2 (OGR/PostGIS interface, pseudo-topological level)

Note: Topology must be built at level >= GV_BUILD_BASE

Parameters
Mappointer to Map_info structure
linefeature id to be rewritten
typefeature type (see V1_write_line_ogr() for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure feature categories
Returns
feature index in offset array (related to pseudo-topology)
-1 on error

Definition at line 152 of file write_sfa.c.

◆ V2_write_line_nat()

off_t V2_write_line_nat ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes feature to 'coor' file at topological level (internal use only)

Note: Function returns feature id, but is defined as off_t for compatibility with level 1 functions.

Parameters
Mappointer to Map_info structure
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
new feature id
0 topology is not requested to be built (build level < GV_BUILD_BASE)
-1 on error

Definition at line 67 of file write_nat.c.

◆ V2_write_line_pg()

off_t V2_write_line_pg ( struct Map_info ,
int  ,
const struct line_pnts ,
const struct line_cats  
)

◆ V2_write_line_sfa()

off_t V2_write_line_sfa ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes feature on level 2 (OGR/PostGIS interface, pseudo-topological level)

Parameters
Mappointer to Map_info structure
typefeature type (see V1_write_line_ogr() for list of supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
feature index in offset array (related to pseudo-topology)
-1 on error

Definition at line 52 of file write_sfa.c.

◆ V__map_overlap()

int V__map_overlap ( struct Map_info Map,
double  n,
double  s,
double  e,
double  w 
)

Check if region overlaps with map extent.

Parameters
Mapvector map
n,s,e,wregion bounding box
Returns
1 if regions overlap
0 if not

Definition at line 28 of file overlap.c.

◆ Vect__build_downgrade()

void Vect__build_downgrade ( struct Map_info Map,
int  build 
)

Downgrade build level (for internal use only)

See Vect_build_nat(), Vect__build_sfa(), and Vect_build_pg() for implementation issues.

Parameters
Mappointer to Map_info
build

Definition at line 771 of file build.c.

Referenced by Vect__build_sfa().

◆ Vect__build_sfa()

int Vect__build_sfa ( struct Map_info Map,
int  build 
)

Build pseudo-topology (for simple features) - internal use only.

See Vect_build_ogr() and Vect_build_pg() for implementation issues.

Build levels:

  • GV_BUILD_NONE
  • GV_BUILD_BASE
  • GV_BUILD_ATTACH_ISLES
  • GV_BUILD_CENTROIDS
  • GV_BUILD_ALL
Parameters
Mappointer to Map_info structure
buildbuild level
Returns
1 on success
0 on error

Definition at line 700 of file build_sfa.c.

References Plus_head::built, Map_info::format, GV_BUILD_BASE, GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, Map_info::plus, and Vect__build_downgrade().

Referenced by Vect_build_ogr(), and Vect_build_pg().

◆ Vect__init_head()

◆ Vect__intersect_line_with_poly()

int Vect__intersect_line_with_poly ( const struct line_pnts ,
double  ,
struct line_pnts  
)

◆ Vect__read_head()

int Vect__read_head ( struct Map_info Map)

Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only.

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 118 of file vector/Vlib/header.c.

References _, G_debug(), G_fopen_old(), G_getl2(), G_warning(), GPATH_MAX, GV_HEAD_ELEMENT, Map_info::mapset, Map_info::name, NULL, Vect__get_path(), Vect__init_head(), Vect_get_full_name(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_proj(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().

Referenced by Vect_read_header().

◆ Vect__write_head()

int Vect__write_head ( struct Map_info Map)

◆ Vect_add_dblink()

int Vect_add_dblink ( struct dblinks p,
int  number,
const char *  name,
const char *  table,
const char *  key,
const char *  db,
const char *  driver 
)

Add new DB connection to dblinks structure.

Parameters
[in,out]ppointer to existing dblinks structure
numberlayer number (1 for OGR)
namelayer name (layer for OGR) - if not given use table name
tabletable name (layer for OGR)
keykey name
dbdatabase name (datasource for OGR)
driverdriver name (dbf, postgresql, ogr, ...)
Returns
0 on success
-1 error

Definition at line 285 of file field.c.

◆ Vect_append_point()

int Vect_append_point ( struct line_pnts Points,
double  x,
double  y,
double  z 
)

Appends one point to the end of a line.

If you are re-using a line struct, be sure to clear out old data first by calling Vect_reset_line().

Calls G_fatal_error() when out of memory.

Parameters
Pointspointer to line_pnts structure
x,y,zpoint coordinates to be added
Returns
number of points
-1 on error (out of memory)

Definition at line 148 of file line.c.

Referenced by IL_write_point_2d().

◆ Vect_append_points()

int Vect_append_points ( struct line_pnts Points,
const struct line_pnts APoints,
int  direction 
)

Appends points to the end of a line.

Note, this will append to whatever is in line_pnts structure. If you are re-using a line struct, be sure to clear out old data first by calling Vect_reset_line().

Parameters
Pointspointer to line_pnts structure
APointspoints to be included
directiondirection (GV_FORWARD, GV_BACKWARD)
Returns
new number of points
-1 on out of memory

Definition at line 335 of file line.c.

◆ Vect_area_alive()

int Vect_area_alive ( struct Map_info Map,
int  area 
)

Check if area is alive or dead (topological level required)

Note: Topology must be built at level >= GV_BUILD_AREAS

Parameters
Mappointer to Map_info structure
areaarea id
Returns
1 area alive
0 area is dead or index is out of range

Definition at line 253 of file vector/Vlib/read.c.

References _, Plus_head::Area, G_warning(), Plus_head::n_areas, NULL, and Map_info::plus.

Referenced by vector2perimeters(), and Vedit_delete_areas_cat().

◆ Vect_area_buffer2()

void Vect_area_buffer2 ( struct Map_info Map,
int  area,
double  da,
double  db,
double  dalpha,
int  round,
int  caps,
double  tol,
struct line_pnts **  oPoints,
struct line_pnts ***  iPoints,
int *  inner_count 
)

Creates buffer around area.

Parameters
Mapvector map
areaarea id
dadistance along major axis
dbdistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round
capsadd caps at line ends
tolmaximum distance between theoretical arc and output segments
[out]oPointsoutput polygon outer border (ccw order)
[out]inner_countnumber of holes
[out]iPointsarray of output polygon's holes (cw order)

Definition at line 1074 of file buffer2.c.

◆ Vect_array_to_cat_list()

int Vect_array_to_cat_list ( const int *  vals,
int  nvals,
struct cat_list list 
)

Convert ordered array of integers to cat_list structure.

Parameters
valsarray of integers
nvalsnumber of values
[in,out]listpointer to cat_list structure
Returns
number of ranges

Definition at line 446 of file vector/Vlib/cats.c.

References G_debug(), and G_realloc.

◆ Vect_attach_centroids()

int Vect_attach_centroids ( struct Map_info Map,
const struct bound_box box 
)

(Re)Attach centroids in given bounding box to areas

Warning: If map is updated on level2, it may happen that previously correct island becomes incorrect. In that case, centroid of area forming the island is reattached to outer area, because island polygon is not excluded.

+-----------+     +-----------+
|   1       |     |   1       |
| +---+---+ |     | +---+---+ |
| | 2 | 3 | |     | | 2 |     |
| | x |   | |  -> | | x |     |
| |   |   | |     | |   |     |
| +---+---+ |     | +---+---+ |
|           |     |           |
+-----------+     +-----------+
centroid is       centroid is
attached to 2     reattached to 1

Because of this, when the centroid is reattached to another area, it is always necessary to check if original area exist, unregister centroid from previous area. To simplify code, this is implemented so that centroid is always first unregistered and if new area is found, it is registered again.

Parameters
Mapvector map
boxbounding box
Returns
0

Definition at line 505 of file build.c.

◆ Vect_attach_isle()

int Vect_attach_isle ( struct Map_info Map,
int  isle,
const struct bound_box box 
)

(Re)Attach isle to area

Parameters
Mapvector map
isleisle id
boxisle bbox
Returns
0

Definition at line 385 of file build.c.

References P_isle::area, Plus_head::box, dig_area_add_isle(), G_debug(), Plus_head::Isle, Map_info::plus, and Vect_isle_find_area().

Referenced by Vect_attach_isles().

◆ Vect_attach_isles()

int Vect_attach_isles ( struct Map_info Map,
const struct bound_box box 
)

(Re)Attach isles in given bounding box to areas

The warning for Vect_attach_centroids() applies here as well

Parameters
Mapvector map
boxbounding box
Returns
0

Definition at line 427 of file build.c.

References P_isle::area, Plus_head::box, boxlist::box, dig_area_del_isle(), bound_box::E, G_debug(), boxlist::id, Plus_head::Isle, bound_box::N, boxlist::n_values, NULL, Map_info::plus, bound_box::S, TRUE, Vect_attach_isle(), Vect_get_area_box(), Vect_new_boxlist(), Vect_select_isles_by_box(), and bound_box::W.

◆ Vect_box_clip()

int Vect_box_clip ( double *  x,
double *  y,
double *  c_x,
double *  c_y,
const struct bound_box Box 
)

Clip coordinates to box, if necessary, lines extending outside of a box.

A line represented by the coordinates x, y and c_x, c_y is clipped to the window defined by s (south), n (north), w (west), and e (east). Note that the following constraints must be true: w <e s <n The x and c_x are values to be compared to w and e. The y and c_y are values to be compared to s and n. The x and c_x values returned lie between w and e. The y and c_y values returned lie between s and n.

Parameters
x,ycoordinates (w, e)
c_x,c_ycoordinates (s, n)
Boxboundary box
Returns
1 if any clipping occurred
0 otherwise

Definition at line 162 of file vector/Vlib/box.c.

References Box, W, and x.

◆ Vect_box_copy()

int Vect_box_copy ( struct bound_box A,
const struct bound_box B 
)

Copy box B to box A.

Parameters
Aboundary A
Bboundary B
Returns
1

Definition at line 101 of file vector/Vlib/box.c.

Referenced by Vect_get_map_box().

◆ Vect_box_extend()

int Vect_box_extend ( struct bound_box A,
const struct bound_box B 
)

Extend box A by box B.

Parameters
Aboundary A
Bboundary B
Returns
1

Definition at line 122 of file vector/Vlib/box.c.

◆ Vect_box_overlap()

int Vect_box_overlap ( const struct bound_box A,
const struct bound_box B 
)

Tests for overlap of two boxes.

Parameters
Aboundary box A
Bboundary box B
Returns
1 boxes overlap
0 boxes do not overlap

Definition at line 82 of file vector/Vlib/box.c.

◆ Vect_boxlist_append()

int Vect_boxlist_append ( struct boxlist list,
int  id,
const struct bound_box box 
)

Append new item to the end of list if not yet present.

Parameters
[in,out]listpointer to ilist structure
idnew item to append to the end of list
boxbounding box
Returns
0 on success
1 on error

Definition at line 287 of file vector/Vlib/list.c.

References G_realloc, and NULL.

Referenced by Vect_boxlist_append_boxlist().

◆ Vect_boxlist_append_boxlist()

int Vect_boxlist_append_boxlist ( struct boxlist alist,
const struct boxlist blist 
)

Append new items to the end of list if not yet present.

Parameters
[in,out]alistpointer to boxlist structure where items will be appended
blistpointer to boxlist structure with new items
Returns
0 on success
1 on error

Definition at line 330 of file vector/Vlib/list.c.

References bound_box::B, boxlist::box, bound_box::E, boxlist::have_boxes, boxlist::id, bound_box::N, boxlist::n_values, NULL, bound_box::S, bound_box::T, Vect_boxlist_append(), and bound_box::W.

◆ Vect_boxlist_delete()

int Vect_boxlist_delete ( struct boxlist list,
int  id 
)

Remove a given value (item) from list.

Parameters
[in,out]listpointer to boxlist structure
idto remove
Returns
0 on success
1 on error

Definition at line 362 of file vector/Vlib/list.c.

References NULL.

Referenced by Vect_boxlist_delete_boxlist().

◆ Vect_boxlist_delete_boxlist()

int Vect_boxlist_delete_boxlist ( struct boxlist alist,
const struct boxlist blist 
)

Delete list from existing list.

Parameters
[in,out]alistpointer to original boxlist structure,
blistpointer to boxlist structure with items to delete
Returns
0 on success
1 on error

Definition at line 394 of file vector/Vlib/list.c.

References boxlist::id, boxlist::n_values, NULL, and Vect_boxlist_delete().

◆ Vect_break_lines()

void Vect_break_lines ( struct Map_info Map,
int  type,
struct Map_info Err 
)

Break lines in vector map at each intersection.

For details see Vect_break_lines_list().

Parameters
Mapinput vector map
typefeature type
[out]Errvector map where points at intersections will be written or NULL

Definition at line 33 of file break_lines.c.

◆ Vect_break_lines_list()

int Vect_break_lines_list ( struct Map_info Map,
struct ilist List_break,
struct ilist List_ref,
int  type,
struct Map_info Err 
)

Break selected lines in vector map at each intersection.

Breaks selected lines specified by type in vector map. Points at intersections may be optionally written to error map. Input vector map must be opened on level 2 for update at least on GV_BUILD_BASE.

The function also breaks lines forming collapsed loop, for example 0,0;1,0;0,0 is broken at 1,0.

If reference lines are given (List_ref) break only lines which intersect reference lines.

Parameters
Mapinput vector map
List_breaklist of lines (NULL for all lines in vector map)
List_reflist of reference lines or NULL
typefeature type
[out]Errvector map where points at intersections will be written or NULL
Returns
number of intersections

Definition at line 63 of file break_lines.c.

◆ Vect_break_polygons()

void Vect_break_polygons ( struct Map_info Map,
int  type,
struct Map_info Err 
)

Break polygons in vector map.

Breaks lines specified by type in vector map. Points at intersections may be optionally written to error map. Input vector map must be opened on level 2 for update at least on GV_BUILD_BASE.

Function is optimized for closed polygons rings (e.g. imported from OGR) but with clean geometry - adjacent polygons mostly have identical boundary. Function creates database of ALL points in the vector map, and then is looking for those where polygons should be broken. Lines may be broken only at points existing in input vector map!

Parameters
Mapinput map where polygons will be broken
typetype of line to be broken (GV_LINE or GV_BOUNDARY)
Errvector map where points at intersections will be written or NULL

Definition at line 685 of file break_polygons.c.

◆ Vect_build()

int Vect_build ( struct Map_info Map)

Build topology for vector map.

Parameters
Mapvector map
Returns
1 on success
0 on error

Definition at line 586 of file build.c.

References GV_BUILD_ALL, and Vect_build_partial().

Referenced by Vect_close().

◆ Vect_build_line_area()

int Vect_build_line_area ( struct Map_info Map,
int  iline,
int  side 
)

Build area on given side of line (GV_LEFT or GV_RIGHT)

Parameters
Mappointer to Map_info structure
ilineline id
sideside (GV_LEFT or GV_RIGHT)
Returns
> 0 area id
< 0 isle id
0 not created (may also already exist)

Definition at line 79 of file build.c.

References _, dig_add_area(), dig_add_isle(), dig_build_area_with_line(), dig_find_area_poly(), dig_line_box(), dig_line_get_area(), G_debug(), G_fatal_error(), G_warning(), line_pnts::n_points, NULL, Map_info::plus, Vect__get_area_points(), Vect_line_prune(), and Vect_new_line_struct().

◆ Vect_build_nat()

int Vect_build_nat ( struct Map_info Map,
int  build 
)

Build topology.

Parameters
Mapvector map
buildbuild level
Returns
1 on success
0 on error

Definition at line 34 of file build_nat.c.

◆ Vect_build_ogr()

int Vect_build_ogr ( struct Map_info Map,
int  build 
)

Build pseudo-topology (simple features) for OGR layer.

Build levels:

  • GV_BUILD_NONE
  • GV_BUILD_BASE
  • GV_BUILD_ATTACH_ISLES
  • GV_BUILD_CENTROIDS
  • GV_BUILD_ALL
Parameters
Mappointer to Map_info structure
buildbuild level
Returns
1 on success
0 on error

Definition at line 49 of file build_ogr.c.

References _, Format_info_offset::array, Plus_head::built, Format_info_ogr::ds, Format_info_ogr::dsn, Map_info::fInfo, G_debug(), G_fatal_error(), G_free(), G_message(), G_warning(), G_zero(), GV_BUILD_BASE, GV_BUILD_NONE, Format_info_ogr::layer, Format_info_ogr::layer_name, Format_info_ogr::offset, Format_info::ogr, Map_info::plus, Vect__build_sfa(), Vect_get_finfo_format_info(), and Vect_get_finfo_geometry_type().

◆ Vect_build_partial()

int Vect_build_partial ( struct Map_info Map,
int  build 
)

Build partial topology for vector map.

Should only be used in special cases of vector processing.

This functions optionally builds only some parts of topology. Highest level is specified by build parameter which may be:

  • GV_BUILD_NONE - nothing is build
  • GV_BUILD_BASE - basic topology, nodes, lines, spatial index;
  • GV_BUILD_AREAS - build areas and islands, but islands are not attached to areas;
  • GV_BUILD_ATTACH_ISLES - attach islands to areas;
  • GV_BUILD_CENTROIDS - assign centroids to areas, build category index;
  • GV_BUILD_ALL - top level, the same as GV_BUILD_CENTROIDS.

If functions is called with build lower than current value of the Map, the level is downgraded to requested value.

All calls to Vect_write_line(), Vect_rewrite_line(), Vect_delete_line() respect the last value of build used in this function.

Note that the functions has effect only if requested level is higher than current level, to rebuild part of topology, call first downgrade and then upgrade, for example:

  • Vect_build()
  • Vect_build_partial(,GV_BUILD_BASE,)
  • Vect_build_partial(,GV_BUILD_AREAS,)
Parameters
Mapvector map
buildhighest level of build
Returns
1 on success
0 on error

Definition at line 861 of file build.c.

References _, Plus_head::built, dig_cidx_free(), dig_cidx_init(), Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_message(), GV_BUILD_ALL, GV_BUILD_NONE, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Map_info::head, Map_info::level, LEVEL_1, Format_info::pg, Map_info::plus, Plus_head::Spidx_built, Plus_head::spidx_with_z, Map_info::support_updated, Map_info::temporary, Format_info_pg::toposchema_name, TRUE, Vect_get_full_name(), Vect_open_sidx(), dig_head::with_z, and Plus_head::with_z.

Referenced by Vect_build().

◆ Vect_build_pg()

int Vect_build_pg ( struct Map_info ,
int   
)

◆ Vect_build_sidx()

int Vect_build_sidx ( struct Map_info Map)

Create spatial index if necessary.

To be used in modules. Map must be opened on level 2.

Parameters
[in,out]Mappointer to vector map
Returns
0 OK
1 error

Definition at line 1224 of file build.c.

References _, G_fatal_error(), Map_info::level, Map_info::plus, Plus_head::Spidx_built, and Vect_build_sidx_from_topo().

◆ Vect_build_sidx_from_topo()

int Vect_build_sidx_from_topo ( struct Map_info Map)

Create spatial index from topology if necessary (not longer supported)

Parameters
Mappointer to vector map
Returns
1

Definition at line 1244 of file build.c.

References _, G_debug(), G_warning(), and Vect_get_full_name().

Referenced by Vect_build_sidx(), and Vect_sidx_dump().

◆ Vect_cat_del()

int Vect_cat_del ( struct line_cats Cats,
int  field 
)

Delete all categories of given layer.

Parameters
[in,out]Catsline_cats structure
fieldlayer number
Returns
number of categories deleted
0 layer does not exist

Definition at line 222 of file vector/Vlib/cats.c.

References line_cats::cat, line_cats::field, and line_cats::n_cats.

Referenced by Vect_field_cat_del().

◆ Vect_cat_get()

int Vect_cat_get ( const struct line_cats Cats,
int  field,
int *  cat 
)

Get first found category of given field.

cat is set to first category found or -1 if field was not found

Parameters
Catspointer line_cats structure
fieldlayer number
[out]catpointer to variable where cat will be written (can be NULL)
Returns
number of found cats for given field (first reported)
0 layer does not exist

Definition at line 156 of file vector/Vlib/cats.c.

References line_cats::cat, line_cats::field, GV_FIELD_MAX, and line_cats::n_cats.

Referenced by NetA_initialise_varray().

◆ Vect_cat_in_array()

int Vect_cat_in_array ( int  cat,
const int *  array,
int  ncats 
)

Check if category is in ordered array of integers.

Parameters
catcategory number
arrayordered array of integers
ncatsnumber of categories in array
Returns
TRUE if cat is in list
FALSE if it is not

Definition at line 710 of file vector/Vlib/cats.c.

◆ Vect_cat_in_cat_list()

int Vect_cat_in_cat_list ( int  cat,
const struct cat_list list 
)

Check if category number is in list.

Parameters
catcategory number
listcat_list structure
Returns
TRUE if cat is in list
FALSE if not

Definition at line 544 of file vector/Vlib/cats.c.

References FALSE, max, and TRUE.

Referenced by Vect_cats_in_constraint().

◆ Vect_cat_list_to_array()

int Vect_cat_list_to_array ( const struct cat_list list,
int **  vals,
int *  nvals 
)

Convert cat_list struct to ordered array of unique integers.

Output array do not contain duplicate items.

Allocated array should be freed by G_free().

Parameters
cat_listpointer to cat_list struct
[out]valsarray of integers
[out]nvalsnumber of values
Returns
0 on success
-1 on failure

Definition at line 489 of file vector/Vlib/cats.c.

References G_debug(), G_realloc, and NULL.

◆ Vect_cat_set()

int Vect_cat_set ( struct line_cats Cats,
int  field,
int  cat 
)

Add new field/cat to category structure if doesn't exist yet.

Parameters
[in,out]Catsline_cats structure
[in]fieldlayer number
[in]catcategory number
Returns
number of categories
0 if no space for new category in structure, n_cats would be > GV_NCATS_MAX
-1 on out of memory
-2 if field out of range: 1
  • GV_FIELD_MAX or cat out of range: 1 - GV_CAT_MAX

Definition at line 103 of file vector/Vlib/cats.c.

References _, line_cats::alloc_cats, line_cats::cat, dig_alloc_cats(), line_cats::field, G_fatal_error(), GV_NCATS_MAX, and line_cats::n_cats.

Referenced by IL_write_point_2d().

◆ Vect_cats_in_constraint()

int Vect_cats_in_constraint ( struct line_cats Cats,
int  layer,
struct cat_list list 
)

Check if categories match with category constraints.

Parameters
Catsline_cats structure
layerlayer number
listcat_list structure
Returns
0 no match, categories are outside constraints
1 match, categories are inside constraints

Definition at line 671 of file vector/Vlib/cats.c.

References _, line_cats::cat, line_cats::field, G_warning(), line_cats::n_cats, and Vect_cat_in_cat_list().

◆ Vect_cats_set_constraint()

struct cat_list* Vect_cats_set_constraint ( struct Map_info Map,
int  layer,
char *  where,
char *  catstr 
)

Set category constraints using 'where' or 'cats' option and layer number.

Parameters
Mappointer to Map_info structure
layerlayer number
wherewhere statement
catstrcategory list as string
Returns
pointer to cat_list structure or NULL

Definition at line 566 of file vector/Vlib/cats.c.

References _, field_info::database, db_close_database_shutdown_driver(), db_select_int(), db_start_driver_open_database(), field_info::driver, G_fatal_error(), G_verbose_message(), G_warning(), field_info::key, list, n_, NULL, field_info::table, and Vect_get_field().

◆ Vect_check_dblink()

int Vect_check_dblink ( const struct dblinks p,
int  field,
const char *  name 
)

Check if DB connection exists in dblinks structure.

Parameters
ppointer to existing dblinks structure
fieldlayer number
namelayer name
Returns
1 dblink for field exists
0 dblink does not exist for field

Definition at line 252 of file field.c.

References dblinks::field, G_debug(), dblinks::n_fields, field_info::name, name, NULL, and field_info::number.

Referenced by Vect_map_check_dblink().

◆ Vect_check_input_output_name()

int Vect_check_input_output_name ( const char *  input,
const char *  output,
int  error 
)

Check for input and output vector map name.

Check

  • output is legal vector name
  • if can find input map
  • if input was found in current mapset, check if input != output
Parameters
inputinput name
outputoutput name
errorerror type G_FATAL_EXIT, G_FATAL_PRINT, G_FATAL_RETURN
Returns
0 OK
1 error

Definition at line 93 of file legal_vname.c.

◆ Vect_check_line_breaks()

int Vect_check_line_breaks ( struct Map_info Map,
int  type,
struct Map_info Err 
)

Check for and count intersecting lines, do not break.

For details see Vect_check_line_breaks_list().

Parameters
Mapinput vector map
typefeature type
[out]Errvector map where points at intersections will be written or NULL
Returns
number for intersections

Definition at line 82 of file break_lines.c.

◆ Vect_check_line_breaks_list()

int Vect_check_line_breaks_list ( struct Map_info Map,
struct ilist List_break,
struct ilist List_ref,
int  type,
struct Map_info Err 
)

Check for and count intersecting lines, do not break.

If List_break is given, only lines in the list are checked for intersections.

If reference lines are given (List_ref) break only lines which intersect reference lines.

Parameters
Mapinput vector map
List_breaklist of lines (NULL for all lines in vector map)
List_reflist of reference lines or NULL
typefeature type
[out]Errvector map where points at intersections will be written or NULL
Returns
number of intersections

Definition at line 105 of file break_lines.c.

◆ Vect_chtype_bridges()

void Vect_chtype_bridges ( struct Map_info Map,
struct Map_info Err,
int *  lines_changed,
int *  bridges_changed 
)

Change type of bridges in vector map.

Change the type of bridges (type boundary) connecting areas to islands or 2 islands. Islands and areas must be already clean, i.e. without dangles. Bridge may be formed by more lines. Optionally changed bridges are written to error map. Input map must be opened on level 2 for update at least on level GV_BUILD_BASE.

Parameters
Mapinput map where bridges are changed
Errvector map where changed bridges are written or NULL
lines_changednumber of lines changed
bridges_changedErr number of bridges changed

Definition at line 69 of file bridges.c.

◆ Vect_chtype_dangles()

void Vect_chtype_dangles ( struct Map_info Map,
double  maxlength,
struct Map_info Err 
)

Change boundary dangles to lines.

Change boundary dangles to lines.

Boundary is considered to be a dangle if on at least one end node is no other boundary. If a dangle is formed by more boundaries, such string of boundaries is taken as one dangle.

Optionally deleted dangles are written to error map.

Input map must be opened on level 2 for update at least on GV_BUILD_BASE.

Parameters
Mapinput map where have to be deleted
maxlengthmaxlength of dangles or -1 for all dangles
[out]Errvector map where deleted dangles are written or NULL
Returns

Definition at line 74 of file dangles.c.

◆ Vect_cidx_dump()

int Vect_cidx_dump ( struct Map_info Map,
FILE *  out 
)

Write (dump) category index in text form to file.

Parameters
Mappointer to Map_info structure
[out]outoutput file
Returns
1 on success
0 on error

Definition at line 420 of file Vlib/cindex.c.

References Cat_index::field, and G_debug().

◆ Vect_cidx_find_all()

void Vect_cidx_find_all ( struct Map_info Map,
int  layer,
int  type_mask,
int  cat,
struct ilist lines 
)

Find all line/area id's for given category.

Parameters
Mappointer to Map_info structure
layerlayer number
type_maskfeature type of objects to search for
catcategory number
[out]linesarray of ids of found lines/points

Definition at line 373 of file Vlib/cindex.c.

◆ Vect_cidx_find_next()

int Vect_cidx_find_next ( struct Map_info Map,
int  field_index,
int  cat,
int  type_mask,
int  start_index,
int *  type,
int *  id 
)

Find next line/area id for given category, start_index and type_mask.

Parameters
Mappointer to Map_info structure
field_indexlayer index
catcategory number
type_maskrequested feature type
start_indexstart search at this index (0 - whole category index)
[out]typereturned type
[out]idreturned line/area id
Returns
index to array
-1 not found

Definition at line 327 of file Vlib/cindex.c.

◆ Vect_cidx_get_cat_by_index()

int Vect_cidx_get_cat_by_index ( struct Map_info Map,
int  field_index,
int  cat_index,
int *  cat,
int *  type,
int *  id 
)

Get category, feature type and id for given layer and category index.

Parameters
Mappointer to Map_info structure
field_indexlayer index
cat_indexcategory index
[out]catcategory number
[out]typefeature type
[out]idfeature id
Returns
1 on success
0 on error

Definition at line 262 of file Vlib/cindex.c.

◆ Vect_cidx_get_field_index()

int Vect_cidx_get_field_index ( struct Map_info Map,
int  field 
)

Get layer index for given layer number.

Parameters
Mappointer to Map_info structure
fieldlayer number
Returns
layer index
-1 if not found

Definition at line 115 of file Vlib/cindex.c.

References G_debug().

◆ Vect_cidx_get_field_number()

int Vect_cidx_get_field_number ( struct Map_info Map,
int  index 
)

Get layer number for given index.

G_fatal_error() is called when index not found.

Parameters
Mappointer to Map_info structure
indexlayer index: from 0 to Vect_cidx_get_num_fields() - 1
Returns
layer number

Definition at line 98 of file Vlib/cindex.c.

◆ Vect_cidx_get_num_cats_by_index()

int Vect_cidx_get_num_cats_by_index ( struct Map_info Map,
int  index 
)

Get number of categories for given layer index.

Parameters
Mappointer to Map_info structure
indexlayer index
Returns
number of categories
-1 on error

Definition at line 161 of file Vlib/cindex.c.

◆ Vect_cidx_get_num_fields()

int Vect_cidx_get_num_fields ( struct Map_info Map)

Get number of layers in category index.

Parameters
Mappointer to Map_info structure
Returns
number of layers

Definition at line 81 of file Vlib/cindex.c.

◆ Vect_cidx_get_num_types_by_index()

int Vect_cidx_get_num_types_by_index ( struct Map_info Map,
int  field_index 
)

Get number of feature types for given layer index.

G_fatal_error() is called when index not found.

Parameters
Mappointer to Map_info structure
field_indexlayer index
Returns
number of feature types
-1 on error

Definition at line 180 of file Vlib/cindex.c.

◆ Vect_cidx_get_num_unique_cats_by_index()

int Vect_cidx_get_num_unique_cats_by_index ( struct Map_info Map,
int  index 
)

Get number of unique categories for given layer index.

G_fatal_error() is called when index not found.

Parameters
Mappointer to Map_info structure
indexlayer index (starts at 0)
Returns
number of unique categories
-1 on error

Definition at line 144 of file Vlib/cindex.c.

◆ Vect_cidx_get_type_count()

int Vect_cidx_get_type_count ( struct Map_info Map,
int  field,
int  type 
)

Get count of features of certain type by layer and type.

Parameters
Mappointer to Map_info structure
fieldlayer number
typefeature type
Returns
feature count
0 if no features, no such field or no such type in category index

Definition at line 223 of file Vlib/cindex.c.

◆ Vect_cidx_get_type_count_by_index()

int Vect_cidx_get_type_count_by_index ( struct Map_info Map,
int  field_index,
int  type_index,
int *  type,
int *  count 
)

Get count of feature types for given field and type index.

Parameters
Mappointer to Map_info structure
field_indexlayer index
type_indextype index
[out]typefeature type (GV_POINT, ...)
[out]countnumber of features or NULL
Returns
1 on success
0 on error

Definition at line 200 of file Vlib/cindex.c.

◆ Vect_cidx_get_unique_cats_by_index()

int Vect_cidx_get_unique_cats_by_index ( struct Map_info Map,
int  field_index,
struct ilist list 
)

Get list of unique categories for given layer index.

Parameters
Mappointer to Map_info structure
field_indexlayer index
[out]listoutput list of cats
Returns
1 on success
0 on error

Definition at line 288 of file Vlib/cindex.c.

◆ Vect_cidx_open()

int Vect_cidx_open ( struct Map_info Map,
int  head_only 
)

Read category index from cidx file if exists.

Parameters
Mappointer to Map_info structure
head_onlyread only header of the file
Returns
0 on success
1 if file does not exist
-1 error, file exists but cannot be read

Definition at line 522 of file Vlib/cindex.c.

References _, dig_file_init(), dig_read_cidx(), gvfile::file, G_debug(), G_fopen_old(), G_warning(), GPATH_MAX, GV_CIDX_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Vect__get_element_path(), Vect__get_path(), and Vect_get_full_name().

◆ Vect_cidx_save()

int Vect_cidx_save ( struct Map_info Map)

Save category index to binary file (cidx)

Parameters
Mappointer to Map_info structure
Returns
0 on success
1 on error

Definition at line 478 of file Vlib/cindex.c.

References G_debug(), and GPATH_MAX.

◆ Vect_clean_small_angles_at_nodes()

int Vect_clean_small_angles_at_nodes ( struct Map_info Map,
int  otype,
struct Map_info Err 
)

Clean small angles at nodes.

It may happen that even if the angle between 2 boundaries at node is very small, the calculated angle is 0 because of representation error. The map must be built at least on level GV_BUILD_BASE

Parameters
Mapinput map
otypefeature type
[out]Errvector map where error line segments are written
Returns
number of line modifications

Definition at line 33 of file clean_nodes.c.

◆ Vect_close()

◆ Vect_coor_info()

int Vect_coor_info ( struct Map_info Map,
struct Coor_info Info 
)

◆ Vect_copy()

int Vect_copy ( const char *  in,
const char *  mapset,
const char *  out 
)

Copy vector map including attribute tables.

Note: Output vector map is overwritten if exists!

Parameters
inname if vector map to be copied
mapsetmapset name where the input map is located
outname for output vector map (new map is created in current mapset)
Returns
-1 error
0 success

Definition at line 125 of file map.c.

References _, G_debug(), G_fatal_error(), G_file_name(), G_find_vector2(), G_make_mapset_dir_object(), G_mapset(), G_name_is_fully_qualified(), G_warning(), GMAPSET_MAX, GNAME_MAX, GPATH_MAX, GV_CIDX_ELEMENT, GV_COOR_ELEMENT, GV_DIRECTORY, GV_FRMT_ELEMENT, GV_HEAD_ELEMENT, GV_HIST_ELEMENT, GV_SIDX_ELEMENT, GV_TOPO_ELEMENT, Map_info::mapset, NULL, Vect_delete(), and Vect_legal_filename().

Referenced by M_do_copy().

◆ Vect_copy_head_data()

int Vect_copy_head_data ( struct Map_info from,
struct Map_info to 
)

◆ Vect_copy_map_dblinks()

void Vect_copy_map_dblinks ( struct Map_info In,
struct Map_info Out,
int  first_only 
)

Copy DB links from input vector map to output vector map.

Parameters
Inpointer to Map_info structure (input)
Outpointer to Map_info structure (output)
first_onlyTRUE to copy only first link otherwise all DB links are copied

Definition at line 205 of file field.c.

References _, field_info::database, field_info::driver, G_warning(), field_info::key, field_info::name, field_info::number, field_info::table, Vect_get_dblink(), Vect_get_num_dblinks(), and Vect_map_add_dblink().

Referenced by Vect_close().

◆ Vect_copy_map_lines()

int Vect_copy_map_lines ( struct Map_info In,
struct Map_info Out 
)

Copy all alive vector features from input vector map to output vector map.

Parameters
Ininput vector map
[out]Outoutput vector map
Returns
0 on success
1 on error

Definition at line 63 of file vector/Vlib/copy.c.

References Vect_copy_map_lines_field().

◆ Vect_copy_map_lines_field()

int Vect_copy_map_lines_field ( struct Map_info In,
int  field,
struct Map_info Out 
)

Copy all alive vector features from given layer from input vector map to output vector map.

Note: Try to copy on level 2 otherwise level 1 is used.

Parameters
Ininput vector map
fieldlayer number (-1 for all layers)
[out]Outoutput vector map
Returns
0 on success
1 on error

Definition at line 81 of file vector/Vlib/copy.c.

Referenced by Vect_close(), and Vect_copy_map_lines().

◆ Vect_copy_pnts_to_xyz()

int Vect_copy_pnts_to_xyz ( const struct line_pnts Points,
double *  x,
double *  y,
double *  z,
int *  n 
)

Copy points from line structure to array.

x/y/z arrays MUST be at least as large as Points->n_points

Also note that n is a pointer to int.

Parameters
Pointspointer to line_pnts structure
x,y,zcoordinates arrays
nnumber of points
Returns
number of points copied

Definition at line 380 of file line.c.

◆ Vect_copy_table()

int Vect_copy_table ( struct Map_info In,
struct Map_info Out,
int  field_in,
int  field_out,
const char *  field_name,
int  type 
)

Copy attribute table linked to vector map based on type.

Parameters
Ininput vector map
[out]Outoutput vector map
field_ininput layer number
field_outoutput layer number
field_namelayer name (can be NULL)
typehow many tables are linked to map: GV_1TABLE / GV_MTABLE
Returns
0 on success
-1 on error

Definition at line 686 of file vector/Vlib/copy.c.

◆ Vect_copy_table_by_cat_list()

int Vect_copy_table_by_cat_list ( struct Map_info In,
struct Map_info Out,
int  field_in,
int  field_out,
const char *  field_name,
int  type,
const struct cat_list cat_list 
)

Copy attribute table linked to vector map based on category list.

If cat_list is NULL, then Vect_copy_table() is called.

Parameters
Ininput vector map
[out]Outoutput vector map
field_ininput layer number
field_outoutput layer number
field_namelayer name (can be NULL)
typehow many tables are linked to map: GV_1TABLE / GV_MTABLE
cat_listpointer to cat_list struct (can be NULL)
Returns
0 on success
-1 on error

Definition at line 710 of file vector/Vlib/copy.c.

◆ Vect_copy_table_by_cats()

int Vect_copy_table_by_cats ( struct Map_info In,
struct Map_info Out,
int  field_in,
int  field_out,
const char *  field_name,
int  type,
int *  cats,
int  ncats 
)

Copy attribute table linked to vector map based on category numbers.

Parameters
Ininput vector map
[out]Outoutput vector map
field_ininput layer number
field_outoutput layer number
field_namelayer name (can be NULL)
typehow many tables are linked to map: GV_1TABLE / GV_MTABLE
catspointer to array of cats or NULL
ncatsnumber of cats in 'cats'
Returns
0 on success
-1 on error

Definition at line 750 of file vector/Vlib/copy.c.

◆ Vect_copy_tables()

int Vect_copy_tables ( struct Map_info In,
struct Map_info Out,
int  field 
)

Copy attribute tables linked to vector map.

Copy all attribute tables linked to the vector map if field is 0, or selected attribute table defined by given field if field > 0.

Notice, that if input vector map has no tables defined, it will copy nothing and return 0 (success).

Parameters
Ininput vector map
[out]Outoutput vector map
fieldlayer number (0 for all tables linked to the vector map)
Returns
0 on success
-1 on error

Definition at line 632 of file vector/Vlib/copy.c.

◆ Vect_copy_xyz_to_pnts()

int Vect_copy_xyz_to_pnts ( struct line_pnts Points,
const double *  x,
const double *  y,
const double *  z,
int  n 
)

Copy points from array to line_pnts structure.

Parameters
Pointspointer to line_ptns structure
x,y,zarray of coordinates
nnumber of points to be copied
Returns
0 on success
-1 on out of memory

Definition at line 99 of file line.c.

◆ Vect_default_field_info()

struct field_info* Vect_default_field_info ( struct Map_info Map,
int  field,
const char *  field_name,
int  type 
)

Get default information about link to database for new dblink.

Parameters
Mappointer to Map_info structure
fieldlayer number
field_namelayer name
typehow many tables are linked to map: GV_1TABLE / GV_MTABLE
Returns
pointer to allocated field_info structure

Definition at line 358 of file field.c.

◆ Vect_delete()

int Vect_delete ( const char *  map)

Delete vector map including attribute tables.

Vector map must be located in current mapset.

Parameters
mapname of vector map to be delete
Returns
-1 error
0 success

Definition at line 367 of file map.c.

References FALSE, and Vect__delete().

Referenced by M_do_remove(), and Vect_copy().

◆ Vect_delete_line()

int Vect_delete_line ( struct Map_info Map,
off_t  line 
)

Delete existing feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
Returns
0 on success
-1 on error

Definition at line 275 of file vector/Vlib/write.c.

◆ Vect_destroy_boxlist()

void Vect_destroy_boxlist ( struct boxlist list)

Frees all memory associated with a struct boxlist, including the struct itself.

Parameters
[in,out]listpointer to ilist structure

Definition at line 264 of file vector/Vlib/list.c.

References G_free(), and NULL.

◆ Vect_destroy_cat_list()

void Vect_destroy_cat_list ( struct cat_list p)

Frees allocated cat_list memory.

Parameters
ppointer to line_cats structure

Definition at line 327 of file vector/Vlib/cats.c.

References G_free(), cat_list::max, cat_list::min, and cat_list::n_ranges.

◆ Vect_destroy_cats_struct()

void Vect_destroy_cats_struct ( struct line_cats p)

Frees all memory associated with line_cats structure, including the struct itself.

Parameters
pline_cats structure

Definition at line 79 of file vector/Vlib/cats.c.

References line_cats::cat, line_cats::field, G_free(), and line_cats::n_cats.

Referenced by NetA_initialise_varray().

◆ Vect_destroy_field_info()

void Vect_destroy_field_info ( struct field_info fi)

Free a struct field_info and all memory associated with it.

Parameters
[in,out]fipointer to field_info structure

Definition at line 633 of file field.c.

References field_info::database, field_info::driver, G_free(), field_info::key, field_info::name, NULL, and field_info::table.

◆ Vect_destroy_line_struct()

void Vect_destroy_line_struct ( struct line_pnts p)

Frees all memory associated with a line_pnts structure, including the structure itself.

Parameters
ppointer to line_pnts structure

Definition at line 77 of file line.c.

References line_pnts::alloc_points, G_free(), line_pnts::x, line_pnts::y, and line_pnts::z.

Referenced by Vect__free_cache(), and vector2perimeters().

◆ Vect_destroy_list()

void Vect_destroy_list ( struct ilist list)

Frees all memory associated with a struct ilist, including the struct itself.

Parameters
[in,out]listpointer to ilist structure

Definition at line 69 of file vector/Vlib/list.c.

References G_free(), and NULL.

◆ Vect_destroy_map_struct()

void Vect_destroy_map_struct ( struct Map_info p)

Frees all memory associated with a Map_info structure, including the structure itself.

Parameters
ppointer to Map_info structure

Definition at line 61 of file map.c.

References G_free().

◆ Vect_fidx_dump()

int Vect_fidx_dump ( struct Map_info Map,
FILE *  out 
)

◆ Vect_field_cat_del()

int Vect_field_cat_del ( struct line_cats Cats,
int  field,
int  cat 
)

Delete field/cat from line_cats structure.

Parameters
[in,out]Catsline_cats structure
fieldlayer number
catcategory to be deleted or -1 to delete all cats of given field
Returns
number of categories deleted
0 field/category number does not exist

Definition at line 257 of file vector/Vlib/cats.c.

References line_cats::cat, line_cats::field, line_cats::n_cats, and Vect_cat_del().

◆ Vect_field_cat_get()

int Vect_field_cat_get ( const struct line_cats Cats,
int  field,
struct ilist cats 
)

Get list of categories of given field.

Parameters
Catsline_cats structure
fieldlayer number
[out]catspointer to list where cats will be written
Returns
number of found categories
-1 on invalid field

Definition at line 192 of file vector/Vlib/cats.c.

References line_cats::cat, line_cats::field, GV_FIELD_MAX, line_cats::n_cats, ilist::n_values, Vect_list_append(), and Vect_reset_list().

◆ Vect_find_area()

int Vect_find_area ( struct Map_info Map,
double  x,
double  y 
)

Find the nearest area.

Parameters
Mapvector map
x,ypoint coordinates
Returns
area number
0 if not found

Definition at line 258 of file vector/Vlib/find.c.

References bound_box::B, boxlist::box, bound_box::E, G_debug(), G_malloc, G_realloc, boxlist::id, bound_box::N, boxlist::n_values, NULL, Map_info::plus, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, Vect_new_boxlist(), Vect_select_areas_by_box(), bound_box::W, and x.

◆ Vect_find_island()

int Vect_find_island ( struct Map_info Map,
double  x,
double  y 
)

Find the nearest island.

Parameters
Mapvector map
x,ypoints coordinates
Returns
island number,
0 if not found

Definition at line 362 of file vector/Vlib/find.c.

◆ Vect_find_line()

int Vect_find_line ( struct Map_info map,
double  ux,
double  uy,
double  uz,
int  type,
double  maxdist,
int  with_z,
int  exclude 
)

Find the nearest line.

Parameters
mapvector map
ux,uy,uzpoints coordinates
typefeature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
excludeif > 0 number of line which should be excluded from selection. May be useful if we need line nearest to other one.
Returns
number of nearest line
0 if not found

Definition at line 126 of file vector/Vlib/find.c.

◆ Vect_find_line_list()

int Vect_find_line_list ( struct Map_info map,
double  ux,
double  uy,
double  uz,
int  type,
double  maxdist,
int  with_z,
const struct ilist exclude,
struct ilist found 
)

Find the nearest line(s).

Parameters
mapvector map
ux,uy,uzpoints coordinates
typefeature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
excludelist of lines which should be excluded from selection
foundlist of found lines (or NULL)
Returns
number of nearest line
0 if not found

Definition at line 159 of file vector/Vlib/find.c.

◆ Vect_find_node()

int Vect_find_node ( struct Map_info Map,
double  ux,
double  uy,
double  uz,
double  maxdist,
int  with_z 
)

Find the nearest node.

Parameters
Mapvector map
ux,uy,uzpoint coordinates
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
Returns
number of nearest node
0 if not found

Definition at line 56 of file vector/Vlib/find.c.

References bound_box::B, bound_box::E, G_debug(), HUGE_VAL, bound_box::N, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, ilist::value, Vect_get_node_coor(), Vect_new_list(), Vect_points_distance(), Vect_select_nodes_by_box(), bound_box::W, and x.

◆ Vect_find_poly_centroid()

int Vect_find_poly_centroid ( const struct line_pnts points,
double *  cent_x,
double *  cent_y 
)

Get centroid of polygon.

Parameters
pointspolygon
[out]cent_x,cent_ycentroid coordinates
Returns
0 on success
-1 on error

Definition at line 355 of file Vlib/poly.c.

References line_pnts::n_points, line_pnts::x, and line_pnts::y.

◆ Vect_get_area_area()

double Vect_get_area_area ( struct Map_info Map,
int  area 
)

Returns area of area without areas of isles.

Parameters
Mappointer to Map_info structure
areaarea id
Returns
area of area without areas of isles

Definition at line 375 of file vector/Vlib/area.c.

◆ Vect_get_area_boundaries()

int Vect_get_area_boundaries ( struct Map_info Map,
int  area,
struct ilist List 
)

Creates list of boundaries for given area.

Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for backward).

Parameters
Mappointer to Map_info structure
areaarea id
[out]Listpointer to list of boundaries
Returns
number of boundaries

Definition at line 139 of file vector/Vlib/area.c.

◆ Vect_get_area_box()

int Vect_get_area_box ( struct Map_info Map,
int  area,
struct bound_box Box 
)

Get bounding box of area.

Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.

Parameters
Mapvector map
areaarea id
[out]Boxbounding box
Returns
1 on success
0 area is dead
-1 on error

Definition at line 300 of file vector/Vlib/box.c.

References _, Plus_head::Area, Box, dig_find_area_box(), G_warning(), Plus_head::n_areas, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().

Referenced by Vect__insert_face_pg(), and Vect_attach_isles().

◆ Vect_get_area_cat()

int Vect_get_area_cat ( struct Map_info Map,
int  area,
int  field 
)

Find FIRST category of given field and area.

Parameters
Mappointer to Map_info structure
areaarea id
fieldlayer number
Returns
first found category of given field
-1 no centroid or no category found

Definition at line 450 of file vector/Vlib/area.c.

References line_cats::cat, line_cats::field, line_cats::n_cats, NULL, Vect_get_area_cats(), Vect_new_cats_struct(), and Vect_reset_cats().

Referenced by vector2perimeters(), and Vedit_delete_areas_cat().

◆ Vect_get_area_cats()

int Vect_get_area_cats ( struct Map_info Map,
int  area,
struct line_cats Cats 
)

Get area categories.

Parameters
Mappointer to Map_info structure
areaarea id
[out]Catslist of categories
Returns
0 centroid found (but may be without categories)
1 no centroid found

Definition at line 423 of file vector/Vlib/area.c.

References NULL, Vect_get_area_centroid(), Vect_read_line(), and Vect_reset_cats().

Referenced by Vect_get_area_cat().

◆ Vect_get_area_centroid()

int Vect_get_area_centroid ( struct Map_info Map,
int  area 
)

Returns centroid id for given area.

Parameters
Mappointer to Map_info structure
areaarea id
Returns
centroid id of area
0 if no centroid found

Definition at line 110 of file vector/Vlib/area.c.

References _, Plus_head::Area, P_area::centroid, G_debug(), G_fatal_error(), NULL, and Map_info::plus.

Referenced by Vect_get_area_cats().

◆ Vect_get_area_isle()

int Vect_get_area_isle ( struct Map_info Map,
int  area,
int  isle 
)

Returns isle id for area.

Parameters
Mappointer to Map_info structure
areaarea id
isleisle index (0 .. nisles - 1)
Returns
isle id
0 if no isle found

Definition at line 236 of file vector/Vlib/area.c.

References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::isles, NULL, and Map_info::plus.

◆ Vect_get_area_num_isles()

int Vect_get_area_num_isles ( struct Map_info Map,
int  area 
)

Returns number of isles for given area.

Parameters
Mappointer to Map_info structure
areaarea id
Returns
number of isles for area
0 if area not found

Definition at line 208 of file vector/Vlib/area.c.

References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::n_isles, NULL, and Map_info::plus.

◆ Vect_get_area_perimeter()

double Vect_get_area_perimeter ( struct Map_info Map,
int  area 
)

Returns perimeter of area with perimeter of isles.

Parameters
Mappointer to Map_info structure
areaarea id
Returns
perimeter of area with perimeters of isles in meters

Definition at line 290 of file vector/Vlib/area.c.

◆ Vect_get_area_points()

int Vect_get_area_points ( struct Map_info Map,
int  area,
struct line_pnts BPoints 
)

Returns polygon array of points (outer ring) of given area.

Parameters
Mappointer to Map_info structure
areaarea id
[out]BPointspoints array
Returns
number of points
-1 on error

Definition at line 37 of file vector/Vlib/area.c.

References _, Plus_head::Area, G_debug(), G_warning(), P_area::lines, P_area::n_lines, NULL, Map_info::plus, Vect__get_area_points(), and Vect_reset_line().

Referenced by vector2perimeters().

◆ Vect_get_area_points_geos()

GEOSCoordSequence* Vect_get_area_points_geos ( struct Map_info Map,
int  area 
)

Returns the polygon array of points, i.e. outer ring (shell)

You should free allocated memory by GEOSCoordSeq_destroy().

See also Vect_get_area_points().

Parameters
Mappointer to Map_info
areaarea id
Returns
pointer to GEOSCoordSequence
empty GEOSCoordSequence for dead area
NULL on error

Definition at line 411 of file geos.c.

References _, Plus_head::Area, G_debug(), G_warning(), NULL, and Map_info::plus.

◆ Vect_get_built()

int Vect_get_built ( struct Map_info Map)

Return current highest built level (part)

Parameters
Mapvector map
Returns
current highest built level

Definition at line 757 of file build.c.

References Plus_head::built, and Map_info::plus.

◆ Vect_get_centroid_area()

int Vect_get_centroid_area ( struct Map_info Map,
int  centroid 
)

Get area id the centroid is within.

Parameters
Mappointer to Map_info struct
centroidcentroid id
Returns
area id the centroid is within
0 for not in area
negative id if centroid is duplicated in the area

Definition at line 429 of file level_two.c.

Referenced by Vedit_delete_area_centroid().

◆ Vect_get_column_names()

const char* Vect_get_column_names ( struct Map_info Map,
int  field 
)

Fetches list of DB column names of vector map attribute table.

Parameters
Mapvector map
fieldlayer number
Returns
list of column(s) names on success
NULL on error

Definition at line 37 of file dbcolumns.c.

◆ Vect_get_column_names_types()

const char* Vect_get_column_names_types ( struct Map_info Map,
int  field 
)

Fetches list of DB column names and types of vector map attribute table.

Parameters
Mapvector map
fieldlayer number
Returns
list of column(s) types on success
NULL on error

Definition at line 149 of file dbcolumns.c.

◆ Vect_get_column_types()

const char* Vect_get_column_types ( struct Map_info Map,
int  field 
)

Fetches list of DB column types of vector map attribute table.

Parameters
Mapvector map
fieldlayer number
Returns
list of column(s) types on success
NULL on error

Definition at line 92 of file dbcolumns.c.

◆ Vect_get_comment()

const char* Vect_get_comment ( struct Map_info Map)

Get comment or other info string from map header.

Parameters
Mappointer to Map_info structure
Returns
comment or other info string

Definition at line 453 of file vector/Vlib/header.c.

References dig_head::comment, and Map_info::head.

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().

◆ Vect_get_constraint_box()

int Vect_get_constraint_box ( struct Map_info Map,
struct bound_box Box 
)

Get constraint box.

Constraint box can be defined by Vect_set_constraint_region().

Parameters
Mapvector map
[out]Boxbounding box
Returns
0 on success
-1 no region constraint defined

Definition at line 79 of file constraint.c.

References bound_box::B, Map_info::box, Box, Map_info::constraint, bound_box::E, bound_box::N, Map_info::region_flag, bound_box::S, bound_box::T, and bound_box::W.

Referenced by V1_read_next_line_nat().

◆ Vect_get_date()

const char* Vect_get_date ( struct Map_info Map)

Get date of digitization from map header.

Parameters
Mappointer to Map_info structure
Returns
date of digitization string

Definition at line 314 of file vector/Vlib/header.c.

References dig_head::date, and Map_info::head.

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().

◆ Vect_get_dblink()

struct field_info* Vect_get_dblink ( struct Map_info Map,
int  link 
)

Get information about link to database.

Variables are substituted by values, link is index to array of dblinks.

Parameters
Mappointer to Map_info structure
linklink id
Returns
pointer to new field_info structure

Definition at line 475 of file field.c.

References _, field_info::database, Map_info::dblnk, field_info::driver, dblinks::field, G_debug(), G_malloc, G_store(), G_warning(), field_info::key, dblinks::n_fields, field_info::name, NULL, field_info::number, field_info::table, and Vect_subst_var().

Referenced by Vect_copy_map_dblinks(), Vect_get_field(), Vect_get_field2(), and Vect_get_field_by_name().

◆ Vect_get_field()

struct field_info* Vect_get_field ( struct Map_info Map,
int  field 
)

Get information about link to database (by layer number)

Variables are substituted by values, field is number of requested field.

Parameters
Mappointer to Map_info structure
fieldlayer number
Returns
pointer to new field_info structure
NULL if not found

Definition at line 515 of file field.c.

References Map_info::dblnk, dblinks::field, G_debug(), dblinks::n_fields, NULL, field_info::number, and Vect_get_dblink().

Referenced by Vect_cats_set_constraint(), and Vect_get_field2().

◆ Vect_get_field2()

struct field_info* Vect_get_field2 ( struct Map_info Map,
const char *  field 
)

Get information about link to database (by layer number or layer name)

Note: if field is -1 then the function returns the first dblink or NULL

Parameters
Mappointer to Map_info structure
fieldlayer number or name
Returns
pointer to new field_info structure
NULL if not found

Definition at line 571 of file field.c.

References G_debug(), NULL, Vect_get_dblink(), Vect_get_field(), Vect_get_field_by_name(), and Vect_get_num_dblinks().

Referenced by Vect_get_field_number().

◆ Vect_get_field_by_name()

struct field_info* Vect_get_field_by_name ( struct Map_info Map,
const char *  field 
)

Get information about link to database (by layer name)

Parameters
Mappointer to Map_info structure
fieldlayer name
Returns
pointer to new field_info structure
NULL if not found

Definition at line 541 of file field.c.

References Map_info::dblnk, dblinks::field, G_debug(), dblinks::n_fields, field_info::name, NULL, and Vect_get_dblink().

Referenced by Vect_get_field2().

◆ Vect_get_field_number()

int Vect_get_field_number ( struct Map_info Map,
const char *  field 
)

Get field number of given field.

Parameters
Mappointer to Map_info structure
fieldlayer name
Returns
layer number
-1 for all layers
0 if layer not found

Definition at line 608 of file field.c.

References G_debug(), field_info::number, Vect_get_field2(), and Vect_get_num_dblinks().

Referenced by vector2perimeters().

◆ Vect_get_finfo()

const struct Format_info* Vect_get_finfo ( struct Map_info Map)

Get header info for non-native formats.

Parameters
Mappointer to Map_info structure
Returns
pointer to Format_info structure
NULL for native format

Definition at line 224 of file header_finfo.c.

References Format_info_pg::conninfo, Format_info_ogr::driver_name, Map_info::fInfo, NULL, Format_info::ogr, and Format_info::pg.

◆ Vect_get_finfo_dsn_name()

const char* Vect_get_finfo_dsn_name ( struct Map_info Map)

Get datasource name (relevant only for non-native formats)

Returns:

  • datasource name for OGR format (GV_FORMAT_OGR and GV_FORMAT_OGR_DIRECT)
  • database name for PostGIS format (GV_FORMAT_POSTGIS)
Parameters
Mappointer to Map_info structure
Returns
string containing OGR/PostGIS datasource name
NULL on error (map format is native)

Definition at line 37 of file header_finfo.c.

References _, Format_info_pg::db_name, Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_debug(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, Format_info::ogr, Format_info::pg, and Vect_get_full_name().

◆ Vect_get_finfo_format_info()

const char* Vect_get_finfo_format_info ( struct Map_info Map)

Get format info as string (relevant only for non-native formats)

Parameters
Mappointer to Map_info structure
Returns
string containing name of OGR format
"PostgreSQL" for PostGIS format (GV_FORMAT_POSTGIS)
NULL on error (or on missing OGR/PostgreSQL support)

Definition at line 108 of file header_finfo.c.

References _, Format_info_ogr::ds, Map_info::fInfo, Map_info::format, G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, and Format_info::ogr.

Referenced by Vect_build_ogr(), and Vect_build_pg().

◆ Vect_get_finfo_geometry_type()

const char* Vect_get_finfo_geometry_type ( struct Map_info Map)

Get geometry type as string (relevant only for non-native formats)

Note: All inner spaces are removed, function returns feature type in lowercase.

Parameters
Mappointer to Map_info structure
Returns
allocated string containing geometry type info (point, linestring, polygon, ...)
NULL on error (map format is native)

Definition at line 143 of file header_finfo.c.

References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, Map_info::format, G_debug(), G_free(), G_malloc, G_store(), G_str_replace(), G_str_to_lower(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::res, Format_info_pg::schema_name, and Format_info_pg::table_name.

Referenced by Vect_build_ogr(), Vect_build_pg(), and Vect_fidx_dump().

◆ Vect_get_finfo_layer_name()

char* Vect_get_finfo_layer_name ( struct Map_info Map)

Get layer name (relevant only for non-native formats)

Returns:

  • layer name for OGR format (GV_FORMAT_OGR and GV_FORMAT_OGR_DIRECT)
  • table name for PostGIS format (GV_FORMAT_POSTGIS) including schema (<schema>.<table>)

Note: allocated string should be freed by G_free()

Parameters
Mappointer to Map_info structure
Returns
string containing layer name
NULL on error (map format is native)

Definition at line 73 of file header_finfo.c.

References _, Map_info::fInfo, Map_info::format, G_asprintf(), G_debug(), G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer_name, name, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, Format_info_pg::table_name, and Vect_get_full_name().

◆ Vect_get_finfo_topology_info()

int Vect_get_finfo_topology_info ( struct Map_info Map,
char **  toposchema,
char **  topogeom,
int *  topo_geo_only 
)

Get topology type (relevant only for non-native formats)

Parameters
Mappointer to Map_info structure
[out]toposchemaTopology schema name or NULL
[out]topogeomTopoGeometry column name or NULL
[out]topo_geo_onlyTRUE for Topo-Geo data model or NULL
Returns
GV_TOPO_NATIVE for native format
GV_TOPO_PSEUDO for pseudo-topology
GV_TOPO_POSTGIS for PostGIS Topology

Definition at line 247 of file header_finfo.c.

References _, Map_info::fInfo, Map_info::format, G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, GV_TOPO_NATIVE, GV_TOPO_POSTGIS, GV_TOPO_PSEUDO, Format_info::pg, Format_info_pg::topo_geo_only, Format_info_pg::topogeom_column, and Format_info_pg::toposchema_name.

◆ Vect_get_full_name()

const char* Vect_get_full_name ( struct Map_info Map)

Get fully qualified name of vector map.

  • for GV_FORMAT_NATIVE and GV_FORMAT_OGR returns "map@mapset"
  • for GV_FORMAT_OGR_DIRECT returns "layer@datasourse"

Allocated string should be freed by G_free().

Parameters
Mappointer to Map_info structure
Returns
allocated string "name@mapset"

Definition at line 221 of file vector/Vlib/header.c.

References Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_malloc, GV_FORMAT_OGR_DIRECT, Format_info_ogr::layer_name, Map_info::mapset, Map_info::name, and Format_info::ogr.

Referenced by V1_open_old_nat(), V2_open_old_ogr(), V2_open_old_pg(), Vect__read_head(), Vect__write_head(), Vect_build_partial(), Vect_build_sidx_from_topo(), Vect_cidx_open(), Vect_get_finfo_dsn_name(), Vect_get_finfo_layer_name(), Vect_open_fidx(), and Vect_sfa_get_num_features().

◆ Vect_get_isle_area()

int Vect_get_isle_area ( struct Map_info Map,
int  isle 
)

Returns area id for isle.

Parameters
Mapvector
isleisle number (0 .. nisles - 1)
Returns
area id
0 area not found

Definition at line 263 of file vector/Vlib/area.c.

References _, P_isle::area, G_debug(), G_fatal_error(), Plus_head::Isle, NULL, and Map_info::plus.

◆ Vect_get_isle_boundaries()

int Vect_get_isle_boundaries ( struct Map_info Map,
int  isle,
struct ilist List 
)

Creates list of boundaries for given isle.

Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for forward).

Parameters
Mappointer to Map_info structure
isleisland number
[out]Listpointer to list where boundaries are stored
Returns
number of boundaries

Definition at line 175 of file vector/Vlib/area.c.

◆ Vect_get_isle_box()

int Vect_get_isle_box ( struct Map_info Map,
int  isle,
struct bound_box Box 
)

Get bounding box of isle.

Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.

Parameters
Mapvector map
isleisle id
[out]Boxbounding box
Returns
1 on success
0 isle is dead / bounding box not found
-1 on error

Definition at line 345 of file vector/Vlib/box.c.

References _, Box, dig_find_isle_box(), G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().

Referenced by Vect__insert_face_pg().

◆ Vect_get_isle_points()

int Vect_get_isle_points ( struct Map_info Map,
int  isle,
struct line_pnts BPoints 
)

Returns polygon array of points for given isle.

Parameters
Mappointer to Map_info structure
isleisland id
[out]BPointspoints array
Returns
number of points
-1 on error

Definition at line 68 of file vector/Vlib/area.c.

References _, Format_info_pg::cache, Format_info_cache::ctype, Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_warning(), GV_FORMAT_POSTGIS, Plus_head::Isle, P_isle::lines, P_isle::n_lines, NULL, Format_info::pg, Map_info::plus, Format_info_pg::toposchema_name, Vect__get_area_points_nat(), Vect__get_area_points_pg(), and Vect_reset_line().

◆ Vect_get_isle_points_geos()

GEOSCoordSequence* Vect_get_isle_points_geos ( struct Map_info Map,
int  isle 
)

Returns the polygon (isle) array of points (inner ring)

You should free allocated memory by GEOSCoordSeq_destroy().

See also Vect_get_isle_points().

Parameters
Mappointer to Map_info
isleisel id
Returns
pointer to GEOSGeometry
NULL on error or dead line

Definition at line 442 of file geos.c.

References G_debug(), Plus_head::Isle, and Map_info::plus.

◆ Vect_get_line_areas()

int Vect_get_line_areas ( struct Map_info Map,
int  line,
int *  left,
int *  right 
)

Get area id on the left and right side of the boundary.

Negative area id indicates an isle.

Parameters
Mappointer to Map_info struct
lineline id
[out]left,rightarea id on the left and right side
Returns
1 on success
-1 on failure (topology not available, line is not a boundary)

Definition at line 346 of file level_two.c.

◆ Vect_get_line_box()

int Vect_get_line_box ( struct Map_info Map,
int  line,
struct bound_box Box 
)

Get bounding box of given feature.

Vector map must be open at topological level and built with level >= GV_BUILD_BASE.

Parameters
Mapvector map
linefeature id
[out]Boxbounding box
Returns
1 on success
0 line is dead
-1 on error

Definition at line 235 of file vector/Vlib/box.c.

◆ Vect_get_line_cat()

int Vect_get_line_cat ( struct Map_info Map,
int  line,
int  field 
)

Fetches FIRST category number for given vector line and field.

Parameters
Mappointer to Map_info structure
lineline id
fieldlayer number
Returns
-1 no category
category number (>=0)

Definition at line 929 of file line.c.

◆ Vect_get_line_nodes()

int Vect_get_line_nodes ( struct Map_info Map,
int  line,
int *  n1,
int *  n2 
)

Get line nodes.

Parameters
Mappointer to Map_info struct
lineline id
n1(start node), n2 (end node) ids of line nodes (or NULL)
Returns
1

Definition at line 303 of file level_two.c.

◆ Vect_get_line_offset()

off_t Vect_get_line_offset ( struct Map_info Map,
int  line 
)

Get feature offset (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

Used for Vect_restore_line().

Parameters
Mappointer to Map_info structure
linefeature id
Returns
feature offset
-1 on error

Definition at line 303 of file vector/Vlib/read.c.

◆ Vect_get_line_type()

int Vect_get_line_type ( struct Map_info Map,
int  line 
)

Get line type.

Parameters
Mappointer to Map_info struct
lineline id
Returns
line type

Definition at line 254 of file level_two.c.

◆ Vect_get_map_box()

int Vect_get_map_box ( struct Map_info Map,
struct bound_box Box 
)

Get bounding box of map (all features in the map)

Requires level 2. On level 1 error code is returned.

Parameters
Mapvector map
[out]Boxbounding box
Returns
1 on success
0 on error

Definition at line 388 of file vector/Vlib/box.c.

References Plus_head::box, Box, Map_info::plus, Vect_box_copy(), and Vect_level().

◆ Vect_get_map_box1()

int Vect_get_map_box1 ( struct Map_info Map,
struct bound_box Box 
)

Get bounding box of map on level 1 (all features in the map)

This subroutine determines bounding box by reading all features sequentially.

Parameters
Mapvector map
[out]Boxbounding box
Returns
1 on success
0 on error

Definition at line 413 of file vector/Vlib/box.c.

◆ Vect_get_map_date()

const char* Vect_get_map_date ( struct Map_info Map)

Get date when the source map was originally produced from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing a date

Definition at line 398 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::source_date.

Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().

◆ Vect_get_map_name()

const char* Vect_get_map_name ( struct Map_info Map)

Get map name from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing map name

Definition at line 370 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::map_name.

Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().

◆ Vect_get_mapset()

const char* Vect_get_mapset ( struct Map_info Map)

Get name of mapset where vector map lives.

Parameters
Mappointer to Map_info structure
Returns
string containing mapset name

Definition at line 204 of file vector/Vlib/header.c.

References Map_info::mapset.

◆ Vect_get_name()

const char* Vect_get_name ( struct Map_info Map)

Get name of vector map.

Parameters
Mappointer to Map_info structure
Returns
string containing name

Definition at line 192 of file vector/Vlib/header.c.

References Map_info::name.

Referenced by Vect_close(), Vect_save_sidx(), and Vect_write_dblinks().

◆ Vect_get_next_line_id()

int Vect_get_next_line_id ( struct Map_info Map)

Get line id for sequential reading.

This function returns id of feature which has been read by calling Vect_read_next_line().

Parameters
Mappointer to Map_info struct
Returns
feature id
-1 on error

Definition at line 97 of file vector/Vlib/read.c.

References _, G_debug(), G_warning(), Map_info::next_line, and VECT_OPEN.

◆ Vect_get_node_coor()

int Vect_get_node_coor ( struct Map_info Map,
int  num,
double *  x,
double *  y,
double *  z 
)

Get node coordinates.

Parameters
Mappointer to Map_info struct
numnode id (starts at 1)
[out]x,y,zcoordinates values (for 2D coordinates z is NULL)
Returns
0 on success
-1 on error

Definition at line 274 of file level_two.c.

References _, G_warning(), Plus_head::n_nodes, Plus_head::Node, NULL, Map_info::plus, P_node::x, x, P_node::y, and P_node::z.

Referenced by Vect_find_node().

◆ Vect_get_node_line()

int Vect_get_node_line ( struct Map_info Map,
int  node,
int  line 
)

Get line id for node line index.

Parameters
Mappointer to Map_info struct
nodenode id
lineline index (range: 0 - Vect_get_node_n_lines())
Returns
line id

Definition at line 396 of file level_two.c.

◆ Vect_get_node_line_angle()

float Vect_get_node_line_angle ( struct Map_info Map,
int  node,
int  line 
)

Angle of segment of the line connected to the node.

Parameters
Mappointer to Map_info struct
nodenode number
lineline index (range: 0 - Vect_get_node_n_lines())
Returns
angle of segment of the line connected to the node

Definition at line 412 of file level_two.c.

◆ Vect_get_node_n_lines()

int Vect_get_node_n_lines ( struct Map_info Map,
int  node 
)

Get number of lines for node.

Parameters
Mappointer to Map_info struct
nodenode id
Returns
numbers of lines

Definition at line 380 of file level_two.c.

◆ Vect_get_num_areas()

plus_t Vect_get_num_areas ( struct Map_info Map)

Get number of areas in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of areas

Definition at line 87 of file level_two.c.

References Plus_head::n_areas, and Map_info::plus.

Referenced by vector2perimeters(), and Vedit_delete_areas_cat().

◆ Vect_get_num_dblinks()

int Vect_get_num_dblinks ( struct Map_info Map)

Get number of defined dblinks.

Parameters
Mappointer to Map_info struct
Returns
number of dblinks

Definition at line 159 of file level_two.c.

References Map_info::dblnk, and dblinks::n_fields.

Referenced by Vect_copy_map_dblinks(), Vect_get_field2(), and Vect_get_field_number().

◆ Vect_get_num_faces()

plus_t Vect_get_num_faces ( struct Map_info Map)

Get number of faces in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of faces

Definition at line 111 of file level_two.c.

References Plus_head::n_flines, and Map_info::plus.

◆ Vect_get_num_holes()

plus_t Vect_get_num_holes ( struct Map_info Map)

Fetch number of holes in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of holes

Definition at line 147 of file level_two.c.

References Plus_head::n_holes, and Map_info::plus.

◆ Vect_get_num_islands()

plus_t Vect_get_num_islands ( struct Map_info Map)

Get number of islands in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of islands

Definition at line 135 of file level_two.c.

References Plus_head::n_isles, and Map_info::plus.

◆ Vect_get_num_kernels()

plus_t Vect_get_num_kernels ( struct Map_info Map)

Fetch number of kernels in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of kernels

Definition at line 99 of file level_two.c.

References Plus_head::n_klines, and Map_info::plus.

◆ Vect_get_num_line_points()

int Vect_get_num_line_points ( const struct line_pnts Points)

Get number of line points.

Parameters
Pointspointer to line_pnts structure
Returns
number of points

Definition at line 267 of file line.c.

◆ Vect_get_num_lines()

plus_t Vect_get_num_lines ( struct Map_info Map)

Fetch number of features (points, lines, boundaries, centroids) in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of features

Definition at line 75 of file level_two.c.

References Plus_head::n_lines, and Map_info::plus.

Referenced by NetA_initialise_varray(), and Vect_fidx_dump().

◆ Vect_get_num_nodes()

plus_t Vect_get_num_nodes ( struct Map_info Map)

Get number of nodes in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of nodes

Definition at line 34 of file level_two.c.

References Plus_head::n_nodes, and Map_info::plus.

◆ Vect_get_num_primitives()

plus_t Vect_get_num_primitives ( struct Map_info Map,
int  type 
)

Get number of primitives in vector map.

Parameters
Mappointer to Map_info struct
typefeature type
Returns
number of primitives

Definition at line 47 of file level_two.c.

◆ Vect_get_num_updated_lines()

int Vect_get_num_updated_lines ( struct Map_info Map)

Get number of updated features.

Note: Vect_set_updated() must be called to maintain list of updated features

Parameters
Mappointer to Map_info struct
Returns
number of updated features

Definition at line 175 of file level_two.c.

References Plus_head::n_uplines, Map_info::plus, and Plus_head::uplist.

◆ Vect_get_num_updated_nodes()

int Vect_get_num_updated_nodes ( struct Map_info Map)

Get number of updated nodes.

Parameters
Mappointer to Map_info struct
Returns
number of updated nodes

Definition at line 219 of file level_two.c.

References Plus_head::n_upnodes, Map_info::plus, and Plus_head::uplist.

◆ Vect_get_num_volumes()

plus_t Vect_get_num_volumes ( struct Map_info Map)

Fetch number of volumes in vector map.

Parameters
Mappointer to Map_info struct
Returns
number of volumes

Definition at line 123 of file level_two.c.

References Plus_head::n_volumes, and Map_info::plus.

◆ Vect_get_organization()

const char* Vect_get_organization ( struct Map_info Map)

Get organization string from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing organization name

Definition at line 283 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::organization.

Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().

◆ Vect_get_person()

const char* Vect_get_person ( struct Map_info Map)

Get user name string who digitized the map from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing user name

Definition at line 342 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::user_name.

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().

◆ Vect_get_point_in_area()

int Vect_get_point_in_area ( struct Map_info Map,
int  area,
double *  X,
double *  Y 
)

Get point inside area and outside all islands.

Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.

Parameters
Mapvector map
areaarea id
[out]X,Ypoint coordinateds
Returns
0 on success
-1 on error

Definition at line 55 of file Vlib/poly.c.

◆ Vect_get_point_in_poly()

int Vect_get_point_in_poly ( const struct line_pnts Points,
double *  X,
double *  Y 
)

Get point inside polygon.

This does NOT consider ISLANDS!

Parameters
Pointspolygon
[out]X,Ypoint coordinates
Returns
0 on success
-1 on error

Definition at line 208 of file Vlib/poly.c.

◆ Vect_get_point_in_poly_isl()

int Vect_get_point_in_poly_isl ( const struct line_pnts Points,
const struct line_pnts **  IPoints,
int  n_isles,
double *  att_x,
double *  att_y 
)

Get point inside polygon but outside the islands specifiled in IPoints.

Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.

Parameters
Pointspolygon (boundary)
IPointsisles (list of isle boundaries)
n_islesnumber of isles
[out]att_x,att_ypoint coordinates
Returns
0 on success
-1 on error

Definition at line 449 of file Vlib/poly.c.

◆ Vect_get_proj()

int Vect_get_proj ( struct Map_info Map)

Get projection from map header.

Parameters
Mappointer to Map_info structure
Returns
PROJECTION_XY 0 - x,y (Raw imagery),
PROJECTION_UTM 1 - UTM Universal Transverse Mercator,
PROJECTION_LL 3 - Latitude-Longitude

Definition at line 519 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::proj.

Referenced by Vect__write_head(), and Vect_get_proj_name().

◆ Vect_get_proj_name()

const char* Vect_get_proj_name ( struct Map_info Map)

Query cartographic projection name of pointer to Map_info structure.

Returns a pointer to a string which is a printable name for projection code proj (as returned by Vect_get_proj()).

Parameters
Mappointer to Map_info structure
Returns
allocated string containing projection name
NULL if proj is not a valid projection

Definition at line 536 of file vector/Vlib/header.c.

References _, G_database_projection_name(), G_debug(), G_projection_name(), G_store(), name, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, PROJECTION_XY, strcpy, and Vect_get_proj().

◆ Vect_get_scale()

int Vect_get_scale ( struct Map_info Map)

Get map scale from map header.

Parameters
Mappointer to Map_info structure
Returns
map scale

Definition at line 425 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::orig_scale.

Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().

◆ Vect_get_thresh()

double Vect_get_thresh ( struct Map_info Map)

Get threshold used for digitization from map header.

Parameters
Mappointer to Map_info structure
Returns
threshold used for digitization

Definition at line 585 of file vector/Vlib/header.c.

References dig_head::digit_thresh, and Map_info::head.

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().

◆ Vect_get_updated_line()

int Vect_get_updated_line ( struct Map_info Map,
int  idx 
)

Get updated line by index.

Note: Vect_set_updated() must be called to maintain list of updated features

Parameters
Mappointer to Map_info struct
idxindex
Returns
updated line

Definition at line 191 of file level_two.c.

References Map_info::plus, Plus_head::uplines, and Plus_head::uplist.

◆ Vect_get_updated_line_offset()

off_t Vect_get_updated_line_offset ( struct Map_info Map,
int  idx 
)

Get updated line offset by index.

Note: Vect_set_updated() must be called to maintain list of updated features

Parameters
Mappointer to Map_info struct
idxindex
Returns
updated line

Definition at line 207 of file level_two.c.

References Map_info::plus, Plus_head::uplines_offset, and Plus_head::uplist.

◆ Vect_get_updated_node()

int Vect_get_updated_node ( struct Map_info Map,
int  idx 
)

Get updated (modified) node by index.

Note: Vect_set_updated() must be called to maintain list of updated features

Negative id:

  • if Node[id] is not NULL then the node was added
  • if Node[id] is NULL then the node was deleted Positive id:
  • node was updated
Parameters
Mappointer to Map_info struct
idxindex
Returns
id of modified node

Definition at line 241 of file level_two.c.

References Map_info::plus, Plus_head::uplist, and Plus_head::upnodes.

◆ Vect_get_zone()

int Vect_get_zone ( struct Map_info )

◆ Vect_graph_add_edge()

void Vect_graph_add_edge ( dglGraph_s graph,
int  from,
int  to,
double  costs,
int  id 
)

Add edge to graph.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.

Parameters
graphpointer to graph structure
fromfrom node
toto node
costscosts value
idedge id
Returns
void

Definition at line 124 of file vector/Vlib/graph.c.

References _, dglAddEdge(), G_debug(), and G_fatal_error().

◆ Vect_graph_build()

void Vect_graph_build ( dglGraph_s graph)

Build network graph.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.

Parameters
graphpointer to graph structure
Returns
void

Definition at line 98 of file vector/Vlib/graph.c.

References _, dglFlatten(), G_debug(), and G_fatal_error().

◆ Vect_graph_init()

void Vect_graph_init ( dglGraph_s graph,
int  nodes_costs 
)

Initialize graph structure.

Parameters
graphpointer to graph structure
nodes_costsuse node costs
Returns
void

Definition at line 72 of file vector/Vlib/graph.c.

References dglInitialize(), and G_debug().

◆ Vect_graph_set_node_costs()

void Vect_graph_set_node_costs ( dglGraph_s graph,
int  node,
double  costs 
)

Set node costs.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.

Parameters
graphpointer to graph structure
nodenode id
costscosts value
Returns
void

Definition at line 154 of file vector/Vlib/graph.c.

References dglGetNode(), dglNodeSet_Attr(), and G_debug().

◆ Vect_graph_shortest_path()

int Vect_graph_shortest_path ( dglGraph_s graph,
int  from,
int  to,
struct ilist List,
double *  cost 
)

Find shortest path.

Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.

Parameters
graphpointer to graph structure
fromfrom node
toto node
Listlist of line ids
costcosts value
Returns
number of segments
0 is correct for from = to, or List == NULL ), ? sum of costs is better return value,
-1 destination unreachable

Definition at line 183 of file vector/Vlib/graph.c.

◆ Vect_hist_command()

int Vect_hist_command ( struct Map_info Map)

Write command info to history file.

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 error

Definition at line 29 of file hist.c.

References G_date(), G_debug(), G_gisdbase(), G_location(), G_mapset(), G_recreate_command(), G_whoami(), GPATH_MAX, and Vect_hist_write().

◆ Vect_hist_copy()

int Vect_hist_copy ( struct Map_info In,
struct Map_info Out 
)

Copy history from one map to another.

Parameters
Ininput vector map
[out]Outoutput vector map
Returns
0 on success
-1 on error

Definition at line 131 of file hist.c.

References G_debug(), G_fseek(), G_ftell(), Map_info::hist_fp, NULL, and Vect_hist_write().

Referenced by Vect_close().

◆ Vect_hist_read()

char* Vect_hist_read ( char *  s,
int  size,
struct Map_info Map 
)

Reads one line from history file without newline character.

Parameters
[out]sbuffer, allocated space must be size+1
sizemaximum number of character
Mapvector map
Returns
return s on success
NULL on error
EOF end of file

Definition at line 90 of file hist.c.

◆ Vect_hist_rewind()

void Vect_hist_rewind ( struct Map_info Map)

Rewind history file.

Parameters
Mapvector map
Returns
void

Definition at line 114 of file hist.c.

References G_debug(), Map_info::hist_fp, and NULL.

◆ Vect_hist_write()

int Vect_hist_write ( struct Map_info Map,
const char *  str 
)

Write string to history file.

Parameters
Mappointer to Map_info structure
strstring to write
Returns
the number of characters printed
-1 on error

Definition at line 65 of file hist.c.

References G_debug(), and Map_info::hist_fp.

Referenced by Vect_hist_command(), and Vect_hist_copy().

◆ Vect_is_3d()

int Vect_is_3d ( struct Map_info Map)

Check if vector map is 3D.

Check vector map header.

Parameters
Mappointer to Map_info structure
Returns
TRUE vector map is 3D
FALSE vector map is not 3D

Definition at line 255 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::with_z.

Referenced by Vect_close(), Vect_get_area_box(), and Vect_get_isle_box().

◆ Vect_isle_alive()

int Vect_isle_alive ( struct Map_info Map,
int  isle 
)

Check if isle is alive or dead (topological level required)

Note: Topology must be built at level >= GV_BUILD_AREAS

Parameters
Mappointer to Map_info structure
isleisle id
Returns
1 isle alive
0 isle is dead or index is out of range

Definition at line 277 of file vector/Vlib/read.c.

References _, G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, and Map_info::plus.

◆ Vect_isle_find_area()

int Vect_isle_find_area ( struct Map_info Map,
int  isle,
const struct bound_box box 
)

Find area outside island.

Parameters
Mapvector map
isleisle id
boxisle bbox
Returns
area id
0 if not found

Definition at line 179 of file build.c.

Referenced by Vect_attach_isle().

◆ Vect_legal_filename()

int Vect_legal_filename ( const char *  s)

Check if output is legal vector name.

Rule: [A-Za-z][A-Za-z0-9_]*

Check also for SQL keywords.

Parameters
sfilename to be checked
Returns
1 OK
-1 if name does not start with letter A..Za..z or if name does not continue with A..Za..z0..9_

Definition at line 32 of file legal_vname.c.

Referenced by Vect_copy().

◆ Vect_level()

int Vect_level ( struct Map_info Map)

Returns level that Map is opened at.

  • 1: no topology
  • 2: topology support
Parameters
Mapvector map
Returns
open level
-1 on error

Definition at line 29 of file level.c.

References _, G_warning(), Map_info::level, Map_info::open, VECT_CLOSED_CODE, and VECT_OPEN_CODE.

Referenced by Vect_get_map_box().

◆ Vect_line_alive()

int Vect_line_alive ( struct Map_info Map,
int  line 
)

Check if feature is alive or dead (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

Parameters
Mappointer to Map_info structure
linefeature id
Returns
1 feature alive
0 feature is dead or index is out of range

Definition at line 205 of file vector/Vlib/read.c.

◆ Vect_line_box()

void Vect_line_box ( const struct line_pnts Points,
struct bound_box Box 
)

Get bounding box of line.

Parameters
Pointspointer to line_pnts structure
[out]Boxbounding box

Definition at line 888 of file line.c.

◆ Vect_line_buffer()

void Vect_line_buffer ( const struct line_pnts InPoints,
double  distance,
double  tolerance,
struct line_pnts OutPoints 
)

Create buffer around the line line.

This function is replaced by Vect_line_buffer().

Buffer is closed counter clockwise polygon. Warning: output line may contain loops!

Parameters
InPointsinput line
distancecreate buffer in distance
tolerancemaximum distance between theoretical arc and polygon segments
[out]OutPointsoutput line

Definition at line 381 of file buffer.c.

◆ Vect_line_buffer2()

void Vect_line_buffer2 ( const struct line_pnts Points,
double  da,
double  db,
double  dalpha,
int  round,
int  caps,
double  tol,
struct line_pnts **  oPoints,
struct line_pnts ***  iPoints,
int *  inner_count 
)

Creates buffer around line.

See also Vect_line_buffer().

Shape of buffer endings is managed by two parameters - round and cap. Setting round=1, cap=1 gives "classical" buffer, while round=0, cap=1 gives square end, but cap=0 – butt. See v.buffer manual or SVG stroke-linecap for examples.

To get "classical" buffer, set db equal to da, and dalpha to 0.

Parameters
Pointsinput line geometry
dadistance along major axis
dbdistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round (0 - square, not 0 - round)
capsadd caps at line ends (0 - butt, not 0 - caps)
tolmaximum distance between theoretical arc and output segments
[out]oPointsoutput polygon outer border (ccw order)
[out]iPointsarray of output polygon's holes (cw order)
[out]inner_countnumber of holes

Definition at line 1009 of file buffer2.c.

◆ Vect_line_check_duplicate()

int Vect_line_check_duplicate ( const struct line_pnts APoints,
const struct line_pnts BPoints,
int  with_z 
)

Check for duplicate lines.

Note that lines must be pruned with Vect_line_prune() before passed to Vect_line_check_duplicate(), as done by Vect_remove_duplicates()

Parameters
APointsfirst line geometry
BPointssecond line geometry
Returns
1 duplicate
0 not duplicate

Definition at line 219 of file remove_duplicates.c.

References line_pnts::n_points, line_pnts::x, line_pnts::y, and line_pnts::z.

◆ Vect_line_check_intersection()

int Vect_line_check_intersection ( struct line_pnts APoints,
struct line_pnts BPoints,
int  with_z 
)

Check if 2 lines intersect.

Points (Points->n_points == 1) are also supported.

Superseded by the faster Vect_line_check_intersection2() Kept as reference implementation

Parameters
APointsfirst input line
BPointssecond input line
with_z3D, not supported (only if one or both are points)!
Returns
0 no intersection
1 intersection found

Definition at line 1466 of file vector/Vlib/intersect.c.

◆ Vect_line_check_intersection2()

int Vect_line_check_intersection2 ( struct line_pnts APoints,
struct line_pnts BPoints,
int  with_z 
)

Check if 2 lines intersect.

Points (Points->n_points == 1) are also supported.

simplified Bentley–Ottmann Algorithm: similar to Vect_line_check_intersection(), but faster

Parameters
APointsfirst input line
BPointssecond input line
with_z3D, not supported (only if one or both are points)!
Returns
0 no intersection
1 intersection
2 end points only

Definition at line 1540 of file intersect2.c.

References line_check_intersection2().

◆ Vect_line_delete_point()

int Vect_line_delete_point ( struct line_pnts Points,
int  index 
)

Delete point at given index and move all points above down.

Parameters
Pointspointer to line_pnts structure
indexpoint (from 0 to Points->n_points-1)
Returns
number of points

Definition at line 210 of file line.c.

◆ Vect_line_distance()

int Vect_line_distance ( const struct line_pnts points,
double  ux,
double  uy,
double  uz,
int  with_z,
double *  px,
double *  py,
double *  pz,
double *  dist,
double *  spdist,
double *  lpdist 
)

Calculate distance of point to line.

Sets (if not null):

  • px, py - point on line,
  • dist - distance to line,
  • spdist - distance to point on line from segment beginning,
  • lpdist - distance to point on line from line beginning along line
Parameters
pointspointer to line_pnts structure
ux,uy,uzpoint coordinates
with_zflag if to use z coordinate (3D calculation)
[out]px,py,pzpoint on line
[out]distdistance to line
[out]spdistdistance to point on line from segment beginning
[out]lpdistdistance to point on line from line beginning along line
Returns
nearest segment (first is 1)

Definition at line 648 of file line.c.

References dig_distance2_point_to_line(), line_pnts::n_points, NULL, line_pnts::x, line_pnts::y, and line_pnts::z.

◆ Vect_line_geodesic_distance()

int Vect_line_geodesic_distance ( const struct line_pnts points,
double  ux,
double  uy,
double  uz,
int  with_z,
double *  px,
double *  py,
double *  pz,
double *  dist,
double *  spdist,
double *  lpdist 
)

Calculate geodesic distance of point to line in meters.

Sets (if not null):

  • px, py - point on line,
  • dist - distance to line,
  • spdist - distance to point on line from segment beginning,
  • lpdist - distance to point on line from line beginning along line
Parameters
pointspointer to line_pnts structure
ux,uy,uzpoint coordinates
with_zflag if to use z coordinate (3D calculation)
[out]px,py,pzpoint on line
[out]distdistance to line
[out]spdistdistance to point on line from segment beginning
[out]lpdistdistance to point on line from line beginning along line
Returns
nearest segment (first is 1)

Definition at line 751 of file line.c.

References dig_distance2_point_to_line(), G_begin_distance_calculations(), G_distance(), line_pnts::n_points, NULL, line_pnts::x, line_pnts::y, and line_pnts::z.

◆ Vect_line_geodesic_length()

double Vect_line_geodesic_length ( const struct line_pnts Points)

Calculate line length.

If projection is LL, the length is measured along the geodesic.

Parameters
Pointspointer to line_pnts structure geometry
Returns
line length

Definition at line 602 of file line.c.

◆ Vect_line_get_intersections()

int Vect_line_get_intersections ( struct line_pnts APoints,
struct line_pnts BPoints,
struct line_pnts IPoints,
int  with_z 
)

Get 2 lines intersection points.

A wrapper around Vect_line_check_intersection() function.

Superseded by the faster Vect_line_get_intersections2() Kept as reference implementation

Parameters
APointsfirst input line
BPointssecond input line
[out]IPointsoutput with intersection points
with_z3D, not supported (only if one or both are points)!
Returns
0 no intersection
1 intersection found

Definition at line 1489 of file vector/Vlib/intersect.c.

◆ Vect_line_get_intersections2()

int Vect_line_get_intersections2 ( struct line_pnts APoints,
struct line_pnts BPoints,
struct line_pnts IPoints,
int  with_z 
)

Get 2 lines intersection points.

A wrapper around Vect_line_check_intersection2() function.

simplified Bentley–Ottmann Algorithm: similar to Vect_line_get_intersections(), but faster

Parameters
APointsfirst input line
BPointssecond input line
[out]IPointsoutput with intersection points
with_z3D, not supported (only if one or both are points)!
Returns
0 no intersection
1 intersection found

Definition at line 1562 of file intersect2.c.

◆ Vect_line_get_point()

int Vect_line_get_point ( const struct line_pnts Points,
int  index,
double *  x,
double *  y,
double *  z 
)

Get line point of given index.

Calls G_fatal_error() when index is not range in.

Parameters
Pointspointer to line_pnts structure
indexpoint index (from 0 to Points->n_points-1)
xpointer to x coordinate or NULL
ypointer to y coordinate or NULL
zpointer to z coordinate or NULL
Returns
number of points

Definition at line 244 of file line.c.

◆ Vect_line_insert_point()

int Vect_line_insert_point ( struct line_pnts Points,
int  index,
double  x,
double  y,
double  z 
)

Insert new point at index position and move all old points at that position and above up.

Parameters
Pointspointer to line_pnts structure
index(from 0 to Points->n_points-1)
x,y,zpoint coordinates
Returns
number of points
-1 on error (allocation)

Definition at line 176 of file line.c.

◆ Vect_line_intersection()

int Vect_line_intersection ( struct line_pnts ,
struct line_pnts ,
struct bound_box ,
struct bound_box ,
struct line_pnts ***  ,
struct line_pnts ***  ,
int *  ,
int *  ,
int   
)

◆ Vect_line_intersection2()

int Vect_line_intersection2 ( struct line_pnts APoints,
struct line_pnts BPoints,
struct bound_box pABox,
struct bound_box pBBox,
struct line_pnts ***  ALines,
struct line_pnts ***  BLines,
int *  nalines,
int *  nblines,
int  with_z 
)

Intersect 2 lines.

Creates array of new lines created from original A line, by intersection with B line. Points (Points->n_points == 1) are not supported. If B line is NULL, A line is intersected with itself.

simplified Bentley–Ottmann Algorithm: similar to Vect_line_intersection(), but faster additionally, self-intersections of a line are handled more efficiently

Parameters
APointsfirst input line
BPointssecond input line or NULL
[out]ALinesarray of new lines created from original A line
[out]BLinesarray of new lines created from original B line
[out]nalinesnumber of new lines (ALines)
[out]nblinesnumber of new lines (BLines)
with_z3D, not supported!
Returns
0 no intersection
1 intersection found

Definition at line 675 of file intersect2.c.

References l.

◆ Vect_line_length()

double Vect_line_length ( const struct line_pnts Points)

Calculate line length, 3D-length in case of 3D vector line.

For Lat-Long use Vect_line_geodesic_length() instead.

Parameters
Pointspointer to line_pnts structure geometry
Returns
line length

Definition at line 575 of file line.c.

◆ Vect_line_parallel()

void Vect_line_parallel ( struct line_pnts InPoints,
double  distance,
double  tolerance,
int  rm_end,
struct line_pnts OutPoints 
)

Create parallel line.

This function is replaced by Vect_line_parallel2().

Parameters
InPointsinput line
distancecreate parallel line in distance
tolerancemaximum distance between theoretical arc and polygon segments
rm_endremove end points falling into distance
[out]OutPointsoutput line
Returns

Definition at line 353 of file buffer.c.

◆ Vect_line_parallel2()

void Vect_line_parallel2 ( struct line_pnts InPoints,
double  da,
double  db,
double  dalpha,
int  side,
int  round,
double  tol,
struct line_pnts OutPoints 
)

Definition at line 1191 of file buffer2.c.

References G_debug(), and line_pnts::n_points.

◆ Vect_line_prune()

int Vect_line_prune ( struct line_pnts Points)

Remove duplicate points, i.e. zero length segments.

Parameters
Pointspointer to line_pnts structure
Returns
number of points

Definition at line 279 of file line.c.

Referenced by Vect_build_line_area().

◆ Vect_line_prune_thresh()

int Vect_line_prune_thresh ( struct line_pnts Points,
double  threshold 
)

Remove points in threshold.

Parameters
Pointspointer to line_pnts structure
thresholdthreshold value
Returns
number of points in result

Definition at line 309 of file line.c.

◆ Vect_line_reverse()

void Vect_line_reverse ( struct line_pnts Points)

Reverse the order of vertices.

Parameters
Pointspointer to line_pnts structure to be changed

Definition at line 898 of file line.c.

◆ Vect_line_segment()

int Vect_line_segment ( const struct line_pnts InPoints,
double  start,
double  end,
struct line_pnts OutPoints 
)

Create line segment.

Creates segment of InPoints from start to end measured along the line and write it to OutPoints.

If the distance is greater than line length or negative, error is returned.

Parameters
InPointsinput line
startsegment number
endsegment number
OutPointsoutput line
Returns
1 success
0 error when start > length or end < 0 or start < 0 or end > length

Definition at line 517 of file line.c.

◆ Vect_line_to_geos()

GEOSGeometry* Vect_line_to_geos ( const struct line_pnts points,
int  type,
int  with_z 
)

Create GEOSGeometry of given type from feature points.

Supported types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING

You should free allocated memory by GEOSGeom_destroy().

Parameters
pointspointer to line_pnts structure
typefeature type (see supported types)
with_zSet to 1 if the feature is 3d, 0 otherwise
Returns
pointer to GEOSGeometry instance
NULL on error

Definition at line 137 of file geos.c.

◆ Vect_line_to_wkb()

unsigned char* Vect_line_to_wkb ( const struct line_pnts points,
int  type,
int  with_z,
size_t *  size 
)

Create a Well Known Binary (WKB) representation of given feature type from points.

This function is not thread safe, it uses static variables for speedup.

Supported feature types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
Parameters
pointspointer to line_pnts structure
typefeature type (see supported types)
with_zSet to 1 if the feature is 3d, 0 otherwise
sizeThe size of the returned byte array
Returns
pointer to string (allocated)
NULL on error

Definition at line 223 of file geos_to_wktb.c.

◆ Vect_line_to_wkt()

char* Vect_line_to_wkt ( const struct line_pnts points,
int  type,
bool  with_z 
)

Create a Well Known Text (WKT) representation of given feature type from points.

Calls Vect_line_to_wkt2() with trim set to false.

Definition at line 259 of file geos_to_wktb.c.

◆ Vect_line_to_wkt2()

char* Vect_line_to_wkt2 ( const struct line_pnts points,
int  type,
bool  with_z,
bool  trim 
)

Create a Well Known Text (WKT) representation of given feature type from points.

This function is not thread safe, it uses static variables for speedup.

Supported types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
Parameters
pointspointer to line_pnts structure
typefeature type (see supported types)
with_zSet to true if the feature is 3d, false otherwise
trimSet the number trimming option on, With trim set to true, the writer will strip trailing 0's from the output coordinates.
Returns
pointer to char array
NULL on error

Definition at line 285 of file geos_to_wktb.c.

◆ Vect_list_append()

int Vect_list_append ( struct ilist list,
int  val 
)

Append new item to the end of list if not yet present.

Parameters
[in,out]listpointer to ilist structure
valnew item to append to the end of list
Returns
0 on success
1 on error

Definition at line 89 of file vector/Vlib/list.c.

References G_realloc, and NULL.

Referenced by Vect_field_cat_get(), and Vect_list_append_list().

◆ Vect_list_append_list()

int Vect_list_append_list ( struct ilist alist,
const struct ilist blist 
)

Append new items to the end of list if not yet present.

Parameters
[in,out]alistpointer to ilist structure where items will be appended
blistpointer to ilist structure with new items
Returns
0 on success
1 on error

Definition at line 123 of file vector/Vlib/list.c.

References ilist::n_values, NULL, ilist::value, and Vect_list_append().

◆ Vect_list_delete()

int Vect_list_delete ( struct ilist list,
int  val 
)

Remove a given value (item) from list.

Parameters
[in,out]listpointer to ilist structure
valto remove
Returns
0 on success
1 on error

Definition at line 145 of file vector/Vlib/list.c.

References NULL.

Referenced by Vect_list_delete_list().

◆ Vect_list_delete_list()

int Vect_list_delete_list ( struct ilist alist,
const struct ilist blist 
)

Delete list from existing list.

Parameters
[in,out]alistpointer to original ilist structure,
blistpointer to ilist structure with items to delete
Returns
0 on success
1 on error

Definition at line 174 of file vector/Vlib/list.c.

References ilist::n_values, NULL, ilist::value, and Vect_list_delete().

◆ Vect_map_add_dblink()

int Vect_map_add_dblink ( struct Map_info Map,
int  number,
const char *  name,
const char *  table,
const char *  key,
const char *  db,
const char *  driver 
)

Add new db connection to Map_info structure.

Parameters
Mappointer to Map_info structure
numberlayer number
namelayer name (if not given use table name)
tabletable name
keykey name
dbdatabase name
driverdriver name
Returns
0 on success
-1 on failure

Definition at line 120 of file field.c.

Referenced by Vect_copy_map_dblinks().

◆ Vect_map_check_dblink()

int Vect_map_check_dblink ( struct Map_info Map,
int  field,
const char *  name 
)

Check if DB connection exists in dblinks structure.

Parameters
Mappointer to Map_info structure
fieldlayer number
namelayer name
Returns
1 dblink for field exists
0 dblink does not exist for field

Definition at line 237 of file field.c.

References Map_info::dblnk, name, and Vect_check_dblink().

◆ Vect_map_del_dblink()

int Vect_map_del_dblink ( struct Map_info Map,
int  field 
)

Delete db connection from Map_info structure.

Parameters
Mappointer to Map_info structure
fieldlayer number (-1 to delete all dblinks)
Returns
0 deleted
-1 error

Definition at line 160 of file field.c.

References _, field_info::database, Map_info::dblnk, field_info::driver, dblinks::field, G_debug(), G_warning(), field_info::key, dblinks::n_fields, field_info::name, field_info::number, field_info::table, and Vect_write_dblinks().

Referenced by Vect_close().

◆ Vect_maptype()

int Vect_maptype ( struct Map_info Map)

Gets vector map format.

Currently are implemented:

  • Native format (GV_FORMAT_NATIVE)
  • OGR format linked via v.external (GV_FORMAT_OGR)
  • OGR format (GV_FORMAT_OGR_DIRECT)
  • PostGIS format (GV_FORMAT_POSTGIS)
Parameters
Mappointer to Map_info structure
Returns
map format code

Definition at line 1104 of file vector/Vlib/open.c.

References Format_info_pg::conninfo, Format_info_ogr::driver_name, Map_info::fInfo, Map_info::format, GV_FORMAT_OGR, GV_FORMAT_POSTGIS, Format_info::ogr, Format_info::pg, and Map_info::temporary.

Referenced by Vect_fidx_dump().

◆ Vect_maptype_info()

const char* Vect_maptype_info ( struct Map_info Map)

Gets vector map format (as string)

Note: string is allocated by G_store(). Free allocated memory with G_free().

Currently are implemented:

  • Native format (native)
  • OGR format (ogr)
  • PostGIS format (postgis)
Parameters
Mappointer to Map_info structure
Returns
maptype string on success (allocated by G_store())
error message on error

Definition at line 1068 of file vector/Vlib/open.c.

References _, Map_info::format, G_store(), GV_FORMAT_NATIVE, GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, and GV_FORMAT_POSTGIS.

Referenced by Vect_fidx_dump().

◆ Vect_merge_lines()

int Vect_merge_lines ( struct Map_info Map,
int  type,
int *  new_lines,
struct Map_info Err 
)

Merge lines or boundaries in vector map.

Merges lines specified by type in vector map. Useful for generalization and smoothing. Adjacent boundaries are merged as long as topology is maintained. Adjacent lines are merged as long as there are exactly two different lines with identical categories connected at a given node. Zero-length lines need to be removed first. GV_BUILD_BASE as topo build level is sufficient, areas need not be built.

Parameters
Mapinput vector map
typefeature type
[out]Errvector map where merged lines/boundaries will be written or NULL
new_linespointer to where number of new lines/boundaries is stored or NULL
Returns
number of merged lines/boundaries

Definition at line 79 of file merge_lines.c.

◆ Vect_net_build_graph()

int Vect_net_build_graph ( struct Map_info Map,
int  ltype,
int  afield,
int  nfield,
const char *  afcol,
const char *  abcol,
const char *  ncol,
int  geo,
int  version 
)

Build network graph.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000 and for lengths LL without geo flag by

  1. The same multiplication factor is used for nodes. Costs in database column may be 'integer' or 'double precision' number >= 0 or -1 for infinity i.e. arc or node is closed and cannot be traversed If record in table is not found for arcs, arc is skip. If record in table is not found for node, costs for node are set to 0.
Parameters
Mapvector map
ltypeline type for arcs
afieldarc costs field (if 0, use length)
nfieldnode costs field (if 0, do not use node costs)
afcolcolumn with forward costs for arc
abcolcolumn with backward costs for arc (if NULL, back costs = forward costs),
ncolcolumn with costs for nodes (if NULL, do not use node costs),
geouse geodesic calculation for length (LL),
versiongraph version to create (1, 2, 3)
Returns
0 on success, 1 on error

Definition at line 695 of file net_build.c.

◆ Vect_net_get_graph()

dglGraph_s* Vect_net_get_graph ( struct Map_info Map)

Get graph structure.

Graph is built by Vect_net_build_graph().

Returns NULL when graph is not built.

Parameters
Mappointer to Map_info struct
Returns
pointer to dglGraph_s struct or NULL

Definition at line 397 of file net_analyze.c.

References Map_info::dgraph, and Graph_info::graph_s.

◆ Vect_net_get_line_cost()

int Vect_net_get_line_cost ( struct Map_info Map,
int  line,
int  direction,
double *  cost 
)

Returns in cost for given direction in *cost.

cost is set to -1 if closed.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
lineline id
directiondirection (GV_FORWARD, GV_BACKWARD)
[out]cost
Returns
1 OK
0 does not exist (was not inserted)

Definition at line 414 of file net_analyze.c.

◆ Vect_net_get_node_cost()

int Vect_net_get_node_cost ( struct Map_info Map,
int  node,
double *  cost 
)

Get cost of node.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
nodenode id
[out]costcosts value
Returns
1

Definition at line 468 of file net_analyze.c.

References Map_info::dgraph, G_debug(), and Graph_info::node_costs.

◆ Vect_net_nearest_nodes()

int Vect_net_nearest_nodes ( struct Map_info Map,
double  x,
double  y,
double  z,
int  direction,
double  maxdist,
int *  node1,
int *  node2,
int *  ln,
double *  costs1,
double *  costs2,
struct line_pnts Points1,
struct line_pnts Points2,
double *  distance 
)

Find nearest node(s) on network.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
x,y,zpoint coordinates (z coordinate NOT USED !)
direction(GV_FORWARD - from point to net, GV_BACKWARD - from net to point)
maxdistmaximum distance to the network
[out]node1pointer where to store the node number (or NULL)
[out]node2pointer where to store the node number (or NULL)
[out]lnpointer where to store the nearest line number (or NULL)
[out]costs1pointer where to store costs on nearest line to node1 (not costs from x,y,z to the line) (or NULL)
[out]costs2pointer where to store costs on nearest line to node2 (not costs from x,y,z to the line) (or NULL)
[out]Points1pointer to structure where to store vertices on nearest line to node1 (or NULL)
[out]Points2pointer to structure where to store vertices on nearest line to node2 (or NULL)
[out]pointerwhere to distance to the line (or NULL)
[out]distance
Returns
number of nodes found (0,1,2)

Definition at line 499 of file net_analyze.c.

◆ Vect_net_shortest_path()

int Vect_net_shortest_path ( struct Map_info Map,
int  from,
int  to,
struct ilist List,
double *  cost 
)

Find shortest path.

Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
fromfrom node
toto node
[out]Listlist of line ids (path)
[out]costcosts value
Returns
number of segments
0 is correct for from = to, or List == NULL ? sum of costs is better return value,
-1 : destination unreachable

Definition at line 380 of file net_analyze.c.

◆ Vect_net_shortest_path_coor()

int Vect_net_shortest_path_coor ( struct Map_info Map,
double  fx,
double  fy,
double  fz,
double  tx,
double  ty,
double  tz,
double  fmax,
double  tmax,
double *  costs,
struct line_pnts Points,
struct ilist List,
struct ilist NodesList,
struct line_pnts FPoints,
struct line_pnts TPoints,
double *  fdist,
double *  tdist 
)

Find shortest path on network between 2 points given by coordinates.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
fx,fy,fzfrom point x coordinate (z ignored)
tx,ty,tzto point x coordinate (z ignored)
fmaxmaximum distance to the network from 'from'
tmaxmaximum distance to the network from 'to'
costspointer where to store costs on the network (or NULL)
Pointspointer to the structure where to store vertices of shortest path (or NULL)
Listpointer to the structure where list of lines on the network is stored (or NULL)
NodesListpointer to the structure where list of nodes on the network is stored (or NULL)
FPointspointer to the structure where to store line from 'from' to first network node (or NULL)
TPointspointer to the structure where to store line from last network node to 'to' (or NULL)
fdistdistance from 'from' to the net (or NULL)
tdistdistance from 'to' to the net (or NULL)
Returns
1 OK, 0 not reachable

Definition at line 1016 of file net_analyze.c.

◆ Vect_net_ttb_build_graph()

int Vect_net_ttb_build_graph ( struct Map_info ,
int  ,
int  ,
int  ,
int  ,
int  ,
const char *  ,
const char *  ,
const char *  ,
int  ,
int   
)

◆ Vect_net_ttb_shortest_path()

int Vect_net_ttb_shortest_path ( struct Map_info Map,
int  from,
int  from_type,
int  to,
int  to_type,
int  tucfield,
struct ilist List,
double *  cost 
)

Find shortest path on network.

Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
fromstart of the path
from_typeif 0 - node id (intersection), if 1 - line unique cat
toend of the path
to_typeif 0 - node id (intersection), if 1 - line unique cat
tucfieldfield with unique categories used in the turntable
[out]Listlist of line ids (path)
[out]costcosts value
Returns
number of segments
0 is correct for from = to, or List == NULL ? sum of costs is better return value,
-1 : destination unreachable

Definition at line 260 of file net_analyze.c.

References t, and x.

◆ Vect_net_ttb_shortest_path_coor()

int Vect_net_ttb_shortest_path_coor ( struct Map_info Map,
double  fx,
double  fy,
double  fz,
double  tx,
double  ty,
double  tz,
double  fmax,
double  tmax,
int  tucfield,
double *  costs,
struct line_pnts Points,
struct ilist List,
struct ilist NodesList,
struct line_pnts FPoints,
struct line_pnts TPoints,
double *  fdist,
double *  tdist 
)

Find shortest path on network with turntable between 2 points given by coordinates.

Parameters
Mapvector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph)
fx,fy,fzfrom point x coordinate (z ignored)
tx,ty,tzto point x coordinate (z ignored)
fmaxmaximum distance to the network from 'from'
tmaxmaximum distance to the network from 'to'
tucfieldfield with unique categories used in the turntable
costspointer where to store costs on the network (or NULL)
Pointspointer to the structure where to store vertices of shortest path (or NULL)
Listpointer to the structure where list of lines on the network is stored (or NULL)
NodesListpointer to the structure where list of nodes on the network is stored (or NULL)
FPointspointer to the structure where to store line from 'from' to first network node (or NULL)
TPointspointer to the structure where to store line from last network node to 'to' (or NULL)
fdistdistance from 'from' to the net (or NULL)
tdistdistance from 'to' to the net (or NULL)
Returns
1 OK, 0 not reachable

Definition at line 1052 of file net_analyze.c.

◆ Vect_new_boxlist()

struct boxlist* Vect_new_boxlist ( int  have_boxes)

Creates and initializes a struct boxlist.

This structure is used as container for bounding boxes with id. The library routines handle all memory allocation.

Parameters
have_boxesif set to 0, the list will hold only ids and no boxes
Returns
pointer to struct boxlist
NULL on error

Definition at line 224 of file vector/Vlib/list.c.

References boxlist::alloc_values, boxlist::box, G_malloc, boxlist::have_boxes, boxlist::id, boxlist::n_values, and NULL.

Referenced by Vect_attach_isles(), and Vect_find_area().

◆ Vect_new_cat_list()

struct cat_list* Vect_new_cat_list ( void  )

Allocate memory for cat_list structure.

Returns
pointer to allocated structure
NULL if out of memory

Definition at line 309 of file vector/Vlib/cats.c.

References G_malloc, and G_zero().

◆ Vect_new_cats_struct()

struct line_cats* Vect_new_cats_struct ( void  )

Creates and initializes line_cats structure.

This structure is used for reading and writing vector cats. The library routines handle all memory allocation.

To free allocated memory call Vect_destroy_cats_struct().

Returns
struct line_cats *
NULL on error

Definition at line 39 of file vector/Vlib/cats.c.

References NULL.

Referenced by NetA_initialise_varray(), and Vect_get_area_cat().

◆ Vect_new_dblinks_struct()

struct dblinks* Vect_new_dblinks_struct ( void  )

Create and init new dblinks structure.

Returns
pointer to new dblinks structure
NULL on failure

Definition at line 52 of file field.c.

References G_malloc, and G_zero().

◆ Vect_new_line_struct()

struct line_pnts* Vect_new_line_struct ( void  )

Creates and initializes a line_pnts structure.

This structure is used for reading and writing vector lines and polygons. The library routines handle all memory allocation. If 3 lines in memory are needed at the same time, then simply 3 line_pnts structures have to be used.

To free allocated memory call Vect_destroy_line_struct().

Calls G_fatal_error() on error.

Returns
pointer to line_pnts

Definition at line 45 of file line.c.

References _, G_fatal_error(), NULL, and Vect__new_line_struct().

Referenced by Vect__reallocate_cache(), Vect_build_line_area(), Vect_point_buffer2(), and vector2perimeters().

◆ Vect_new_list()

struct ilist* Vect_new_list ( void  )

Creates and initializes a struct ilist.

This structure is used as container for integer values. The library routines handle all memory allocation.

Returns
pointer to struct ilist
NULL on error

Definition at line 31 of file vector/Vlib/list.c.

References ilist::alloc_values, G_malloc, ilist::n_values, NULL, and ilist::value.

Referenced by NetA_betweenness_closeness(), Vect_find_node(), Vect_select_areas_by_polygon(), and Vedit_extend_lines().

◆ Vect_new_map_struct()

struct Map_info* Vect_new_map_struct ( void  )

Creates and initializes Map_info structure.

To free allocated memory call Vect_destroy_map_struct().

Returns
pointer to Map_info

Definition at line 41 of file map.c.

References _, G_fatal_error(), G_zero(), malloc(), and NULL.

◆ Vect_new_varray()

struct varray* Vect_new_varray ( int  size)

Create new struct varray and allocate space for given number of items.

Space allocated is 'size + 1' so that lines are accessed by line id. Array values are set to 0.

Parameters
sizesize of array
Returns
pointer to new struct varray
NULL if failed

Definition at line 39 of file array.c.

References varray::c, G_calloc, G_free(), G_malloc, NULL, and varray::size.

Referenced by NetA_initialise_varray().

◆ Vect_node_alive()

int Vect_node_alive ( struct Map_info Map,
int  node 
)

Check if node is alive or dead (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

Parameters
Mappointer to Map_info structure
nodenode id
Returns
1 node alive
0 node is dead or index is out of range

Definition at line 229 of file vector/Vlib/read.c.

References _, G_warning(), Plus_head::n_nodes, Plus_head::Node, NULL, and Map_info::plus.

◆ Vect_open_fidx()

◆ Vect_open_new()

int Vect_open_new ( struct Map_info Map,
const char *  name,
int  with_z 
)

Create new vector map for reading/writing.

By default list of updated features is not maintained, see Vect_set_updated() for details.

By default map format is native (GV_FORMAT_NATIVE). If OGR file is found in the current mapset then the map (ie. OGR layer) is created in given OGR datasource (GV_FORMAT_OGR). Similarly if PG file exists then the map (ie. PostGIS table) is created using PostGIS interface (GV_FORMAT_POSTGIS). The format of map is stored in Map->format.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to be created
with_zWITH_Z for 3D vector data otherwise WITHOUT_Z
Returns
1 on success
-1 on error

Definition at line 955 of file vector/Vlib/open.c.

References G_debug().

Referenced by Vect_close().

◆ Vect_open_old()

int Vect_open_old ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Open existing vector map for reading.

This function is replaced by Vect_open_old2() to handle also direct OGR support.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to open
mapsetmapset name ("" for search path)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 597 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, and Vect__open_old().

◆ Vect_open_old2()

int Vect_open_old2 ( struct Map_info Map,
const char *  name,
const char *  mapset,
const char *  layer 
)

Open existing vector map for reading.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to open (datasource for direct OGR access)
mapsetmapset name ("" for search path, "OGR" for direct OGR access)
layerlayer name (OGR layer for direct OGR access)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 640 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, and Vect__open_old().

◆ Vect_open_old_head()

int Vect_open_old_head ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Reads only info about vector map (headers)

Reads from headers of 'head', 'dbln', 'topo' and 'cidx' file.

This function is replaced by Vect_open_old_head2() to handle also direct OGR support.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to read
mapsetmapset name ("" for search path)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 738 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().

◆ Vect_open_old_head2()

int Vect_open_old_head2 ( struct Map_info Map,
const char *  name,
const char *  mapset,
const char *  layer 
)

Reads only info about vector map (headers)

Reads from headers of 'head', 'dbln', 'topo' and 'cidx' file.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to read (dsn for OGR)
mapsetmapset name ("" for search path)
layerlayer name (OGR format)
[out]Mappointer to Map_info structure
namename of vector map to open (datasource for direct OGR access)
mapsetmapset name ("" for search path, "OGR" for direct OGR access)
layerlayer name (OGR layer for direct OGR access)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 765 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, TRUE, and Vect__open_old().

◆ Vect_open_sidx()

int Vect_open_sidx ( struct Map_info Map,
int  mode 
)

Open spatial index file ('sidx')

Parameters
[in,out]Mappointer to Map_info
mode0 old, 1 update, 2 new
Returns
1 if sidx file is not available
0 on success
-1 on error

Definition at line 1212 of file vector/Vlib/open.c.

Referenced by Vect_build_partial().

◆ Vect_open_tmp_new()

int Vect_open_tmp_new ( struct Map_info Map,
const char *  name,
int  with_z 
)

Create new temporary vector map.

Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector). If the map already exists, it is overwritten.

Temporary vector maps are automatically deleted when closing the map (see Vect_close() for details).

If name is not given (is NULL), then the name is determined by process id (tmp_<pid>).

Parameters
[out]Mappointer to output Map_info struct
namename for new vector map (or NULL)
with_zWITH_Z for 3D vector data otherwise WITHOUT_Z
Returns
1 on success
-1 on error

Definition at line 986 of file vector/Vlib/open.c.

References G_debug(), GNAME_MAX, and name.

◆ Vect_open_tmp_old()

int Vect_open_tmp_old ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Open existing temporary vector map for reading.

Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector).

Calls G_fatal_error() on failure.

Todo:
Create new vector map if doesn't exist.
Parameters
[out]Mappointer to Map_info structure
namename of vector map to open
mapsetmapset name ("" for search path)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 620 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().

◆ Vect_open_tmp_update()

int Vect_open_tmp_update ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Open existing temporary vector map for reading/writing.

Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector).

By default list of updated features is not maintained, see Vect_set_updated() for details.

Calls G_fatal_error() on failure.

Todo:
Create new vector map if doesn't exist.
Parameters
[out]Mappointer to Map_info structure
namename of vector map to update
mapsetmapset name
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 691 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().

◆ Vect_open_topo()

int Vect_open_topo ( struct Map_info Map,
int  head_only 
)

Open topology file ('topo')

Parameters
[in,out]Mappointer to Map_info structure
head_onlyTRUE to read only header
Returns
0 on success
1 file does not exist
-1 on error

Definition at line 1131 of file vector/Vlib/open.c.

References _, Plus_head::coor_mtime, Plus_head::coor_size, dig_file_init(), dig_load_plus(), dig_Rd_Plus_head(), err(), gvfile::file, G_debug(), G_fopen_old(), G_warning(), GPATH_MAX, GV_TOPO_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Coor_info::size, Vect__get_element_path(), Vect__get_path(), and Vect_coor_info().

◆ Vect_open_update()

int Vect_open_update ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Open existing vector map for reading/writing.

This function is replaced by Vect_open_update2() to handle also direct OGR support.

By default list of updated features is not maintained, see Vect_set_updated() for details.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to update
mapsetmapset name
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 665 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().

◆ Vect_open_update2()

int Vect_open_update2 ( struct Map_info Map,
const char *  name,
const char *  mapset,
const char *  layer 
)

Open existing vector map for reading/writing.

By default list of updated features is not maintained, see Vect_set_updated() for details.

Calls G_fatal_error() on failure.

Parameters
[out]Mappointer to Map_info structure
namename of vector map to open (datasource for direct OGR access)
mapsetmapset name ("" for search path, "OGR" for direct OGR access)
layerlayer name (OGR layer for direct OGR access)
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 714 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, TRUE, and Vect__open_old().

◆ Vect_open_update_head()

int Vect_open_update_head ( struct Map_info Map,
const char *  name,
const char *  mapset 
)

Open header file of existing vector map for updating (mostly for database link updates)

Parameters
[out]Mappointer to Map_info structure
namename of vector map to update
mapsetmapset name
Returns
1 open on level 1 (without topology)
2 open on level 2 (with topology)
-1 on error

Definition at line 782 of file vector/Vlib/open.c.

References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().

◆ Vect_option_to_types()

int Vect_option_to_types ( const struct Option type_opt)

Get types from options.

Parameters
type_optOption structure
Returns
types
-1 on error

Definition at line 26 of file vector/Vlib/type.c.

◆ Vect_overlay()

int Vect_overlay ( struct Map_info AMap,
int  atype,
struct ilist AList,
struct ilist AAList,
struct Map_info BMap,
int  btype,
struct ilist BList,
struct ilist BAList,
int  operator,
struct Map_info OMap 
)

Overlay 2 vector maps and create new one.

Parameters
AMapvector map A
atypefeature type for A
AListunused ?
AAListunused ?
BMapvector map B
btypefeature type for B
BListunused ?
BAListunused ?
operatoroperator code
[out]OMapoutput vector map
Returns
0 on success

Definition at line 62 of file overlay.c.

References _, G_fatal_error(), GV_O_AND, and Vect_overlay_and().

◆ Vect_overlay_and()

int Vect_overlay_and ( struct Map_info ,
int  ,
struct ilist ,
struct ilist ,
struct Map_info ,
int  ,
struct ilist ,
struct ilist ,
struct Map_info  
)

◆ Vect_overlay_str_to_operator()

int Vect_overlay_str_to_operator ( const char *  str)

Get operator code from string.

Parameters
stroperator code string
Returns
operator code
-1 on error

Definition at line 35 of file overlay.c.

References GV_O_AND, GV_O_OVERLAP, GV_ON_AND, and GV_ON_OVERLAP.

◆ Vect_point_buffer2()

void Vect_point_buffer2 ( double  px,
double  py,
double  da,
double  db,
double  dalpha,
int  round,
double  tol,
struct line_pnts **  oPoints 
)

Creates buffer around the point (px, py).

Parameters
pxinput point x-coordinate
pyinput point y-coordinate
dadistance along major axis
dbdistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round
tolmaximum distance between theoretical arc and output segments
[out]oPointsoutput polygon outer border (ccw order)
Note
Currently only handles buffers with rounded corners (round = 1)

Definition at line 1141 of file buffer2.c.

References G_debug(), PI, and Vect_new_line_struct().

◆ Vect_point_in_area()

int Vect_point_in_area ( double  x,
double  y,
struct Map_info Map,
int  area,
struct bound_box box 
)

Check if point is in area.

Parameters
x,ypoint coordinates
Mappointer to Map_info structure
areaarea id
boxarea bounding box
Returns
0 if point is outside area
1 if point is inside area
2 if point is on the area's outer ring

Definition at line 334 of file vector/Vlib/area.c.

◆ Vect_point_in_area_outer_ring()

int Vect_point_in_area_outer_ring ( double  X,
double  Y,
struct Map_info Map,
int  area,
struct bound_box box 
)

Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.

Parameters
X,Ypoint coordinates
Mapvector map
areaarea id
boxarea bounding box
Returns
0 - outside
1 - inside
2 - on the boundary

Definition at line 854 of file Vlib/poly.c.

◆ Vect_point_in_box()

int Vect_point_in_box ( double  x,
double  y,
double  z,
const struct bound_box Box 
)

Tests if point is in 3D box.

This function considers 3D point and 3D bounding box.

Example
struct bound_box bbox;
bbox.N = 135;
bbox.S = 125;
bbox.E = 220;
bbox.W = 215;
bbox.T = 340;
bbox.B = 330;
Vect_point_in_box(217, 130, 335, &bbox);
Parameters
xcoordinate (W-E direction)
ycoordinate (S-N direction)
zcoordinate (B-T direction)
Boxboundary box
Returns
1 if point is in box
0 if point is not in box

Definition at line 48 of file vector/Vlib/box.c.

References Box, N, and x.

Referenced by P_Mean_Calc().

◆ Vect_point_in_box_2d()

int Vect_point_in_box_2d ( double  x,
double  y,
const struct bound_box Box 
)

Tests if point is in 2D box.

Only x and y are tested. Top and bottom of the bounding box are ignored.

Parameters
xcoordinate (W-E direction)
ycoordinate (S-N direction)
Boxboundary box (only W, E, S, N are used)
Returns
1 if point is in box
0 if point is not in box

Definition at line 67 of file vector/Vlib/box.c.

References Box, N, and x.

◆ Vect_point_in_island()

int Vect_point_in_island ( double  X,
double  Y,
struct Map_info Map,
int  isle,
struct bound_box box 
)

Determines if a point (X,Y) is inside an island.

Parameters
X,Ypoint coordinates
Mapvector map
isleisle id
boxisle bounding box
Returns
0 - outside
1 - inside
2 - on the boundary

Definition at line 923 of file Vlib/poly.c.

◆ Vect_point_in_poly()

int Vect_point_in_poly ( double  X,
double  Y,
const struct line_pnts Points 
)

Determines if a point (X,Y) is inside a polygon.

Parameters
X,Ypoint coordinates
Pointspolygon
Returns
0 - outside
1 - inside
2 - on the boundary

Definition at line 824 of file Vlib/poly.c.

◆ Vect_point_on_line()

int Vect_point_on_line ( const struct line_pnts Points,
double  distance,
double *  x,
double *  y,
double *  z,
double *  angle,
double *  slope 
)

Find point on line in the specified distance.

From the beginning, measured along line.

If the distance is greater than line length or negative, error is returned.

Parameters
Pointspointer to line_pnts structure
distancedistance value
x,y,zpointers to point coordinates or NULL
anglepointer to angle of line in that point (radians, counter clockwise from x axis) or NULL
slopepointer to slope angle in radians (positive up)
Returns
number of segment the point is on (first is 1),
0 error when point is outside the line

Definition at line 413 of file line.c.

◆ Vect_points_distance()

double Vect_points_distance ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
int  with_z 
)

Calculate distance of 2 points.

Simply uses Pythagoras.

Parameters
x1,y1,z1first point
x2,y2,z2second point
with_zuse z coordinate
Returns
distance

Definition at line 866 of file line.c.

Referenced by Vect_find_node(), and Vedit_get_min_distance().

◆ Vect_print_header()

int Vect_print_header ( struct Map_info Map)

Print vector map header to stdout.

Parameters
Mappointer to Map_info structure
Returns
0 on success

Definition at line 33 of file vector/Vlib/header.c.

References Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), and Vect_get_scale().

◆ Vect_read_area_geos()

GEOSGeometry* Vect_read_area_geos ( struct Map_info Map,
int  area 
)

Read vector area and stores it as GEOSGeometry instance (polygon)

You should free allocated memory by GEOSGeom_destroy().

Parameters
Mappointer to Map_info structure
areaarea id
Returns
pointer to GEOSGeometry instance
NULL on error

Definition at line 84 of file geos.c.

Referenced by Vect_read_area_to_wkb(), and Vect_read_area_to_wkt2().

◆ Vect_read_area_to_wkb()

unsigned char* Vect_read_area_to_wkb ( struct Map_info Map,
int  area,
size_t *  size 
)

Read vector area and return it as Well Known Binary (WKB) unsigned char array.

Parameters
Mappointer to Map_info structure
areaarea id
sizeThe size of the returned unsigned char array
Returns
pointer to unsigned char array
NULL on error

Definition at line 34 of file geos_to_wktb.c.

References init(), NULL, and Vect_read_area_geos().

◆ Vect_read_area_to_wkt()

char* Vect_read_area_to_wkt ( struct Map_info Map,
int  area 
)

Read vector area and return it as Well Known Text (WKT) unsigned char array.

Calls Vect_read_area_to_wkt2() with trim set to false.

Definition at line 71 of file geos_to_wktb.c.

References Vect_read_area_to_wkt2().

◆ Vect_read_area_to_wkt2()

char* Vect_read_area_to_wkt2 ( struct Map_info Map,
int  area,
bool  trim 
)

Read vector area and return it as Well Known Text (WKT) unsigned char array.

Parameters
Mappointer to Map_info structure
areaarea id
sizeThe size of the returned unsigned char array
trimSet the number trimming option on, With trim set to true, the writer will strip trailing 0's from the output coordinates.
Returns
pointer to string (allocated)
NULL on error

Definition at line 89 of file geos_to_wktb.c.

References G_store(), init(), NULL, and Vect_read_area_geos().

Referenced by Vect_read_area_to_wkt().

◆ 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_read_colors()

int Vect_read_colors ( const char *  name,
const char *  mapset,
struct Colors colors 
)

Read color table of vector map.

The color table for the vector map name in the specified mapset is read into the colors structure.

Note: If a secondary color file for map name name exists in the current mapset, that color file is read. This allows the user to define their own color lookup tables for vector maps found in other mapsets.

Warning message is printed if the color file is missing or invalid.

Parameters
namevector map name
mapsetmapset name ("" for search path)
[out]colorspointer to Colors structure (can be NULL)
Returns
-1 on error
0 if color table missing
1 on success (color table found)

Definition at line 42 of file vector/Vlib/color_read.c.

◆ Vect_read_dblinks()

int Vect_read_dblinks ( struct Map_info Map)

Read dblinks to existing structure.

Variables are not substituted by values.

Parameters
Mappointer to Map_info structure
Returns
number of links read
-1 on error

Definition at line 846 of file field.c.

References Map_info::dblnk, Map_info::format, G_debug(), GV_FORMAT_NATIVE, Map_info::mapset, Map_info::name, and Vect_reset_dblinks().

◆ Vect_read_header()

int Vect_read_header ( struct Map_info Map)

Read vector map header from map head file.

Parameters
Mappointrt to Map_info structure
Returns
0

Definition at line 51 of file vector/Vlib/header.c.

References Vect__read_head().

◆ Vect_read_line()

int Vect_read_line ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
int  line 
)

Read vector feature (topological level required)

This function implements random access. Constraints are ignored.

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on failure.

Parameters
Mappointer to vector map
[out]line_pfeature geometry (pointer to line_pnts struct)
[out]line_cfeature categories (pointer to line_cats struct)
linefeature id (starts at 1)
Returns
feature type
-1 on failure
-2 nothing to read

Definition at line 168 of file vector/Vlib/read.c.

Referenced by NetA_initialise_varray(), and Vect_get_area_cats().

◆ Vect_read_line_geos()

GEOSGeometry* Vect_read_line_geos ( struct Map_info Map,
int  line,
int *  type 
)

Read vector feature and stores it as GEOSGeometry instance.

Supported feature types:

  • GV_POINT -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINESTRING / LINEARRING

You should free allocated memory by GEOSGeom_destroy().

Parameters
Mappointer to Map_info structure
linefeature id
[out]typefeature type or NULL
Returns
pointer to GEOSGeometry instance
empty GEOSGeometry for unsupported feature type
NULL on error

Definition at line 45 of file geos.c.

◆ Vect_read_line_to_wkb()

unsigned char* Vect_read_line_to_wkb ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
int  line,
size_t *  size,
int *  error 
)

Read a Well Known Binary (WKB) representation of a given feature id.

This function reads a specific feature and converts it into a WKB representation. line_pnts and line_cats structures can be provided to store the result of the read operation. That is meaningful in case the category values of the feature are needed. This function is not thread safe, it uses static variables for speedup.

Supported feature types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
Parameters
Mappointer to Map_info structure
line_ppointer to line_pnts structure to use, or NULL
line_cpointer to line_cats structure to use, or NULL
lineThe id of the feature to read
sizeThe size of the returned unsigned char array
Returns
pointer to unsigned char array
NULL on error

Definition at line 146 of file geos_to_wktb.c.

◆ Vect_read_next_line()

int Vect_read_next_line ( struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c 
)

Read next vector feature.

This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field() for details.

Use Vect_rewind() to reset reading. Topological level is not required.

A warning is printed on failure.

Parameters
Mappointer Map_info struct
[out]line_pfeature geometry (pointer to line_pnts struct)
[out]line_cfeature categories (pointer to line_cats struct)
Returns
feature type (GV_POINT, GV_LINE, ...)
-1 on error
-2 nothing to read

Definition at line 130 of file vector/Vlib/read.c.

References _, G_debug(), G_warning(), Map_info::next_line, and VECT_OPEN.

◆ Vect_region_box()

int Vect_region_box ( const struct Cell_head Window,
struct bound_box Box 
)

Copy region window to bounding box.

Parameters
Windowregion structure (raster-based)
[out]Boxboundary box (vector-based)
Returns
1 on success
0 on error

Definition at line 461 of file vector/Vlib/box.c.

References Box, Cell_head::east, Cell_head::north, PORT_DOUBLE_MAX, Cell_head::south, and Cell_head::west.

Referenced by P_Mean_Calc().

◆ Vect_remove_bridges()

void Vect_remove_bridges ( struct Map_info Map,
struct Map_info Err,
int *  lines_removed,
int *  bridges_removed 
)

Remove bridges from vector map.

Remove bridges (type boundary) connecting areas to islands or 2 islands. Islands and areas must be already clean, i.e. without dangles. Bridge may be formed by more lines. Optionally deleted bridges are written to error map. Input map must be opened on level 2 for update at least on level GV_BUILD_BASE

Parameters
Mapinput map where bridges are deleted
Errvector map where deleted bridges are written or NULL
lines_removednumber of lines removed
bridges_removedErr number of bridges removed

Definition at line 48 of file bridges.c.

◆ Vect_remove_colors()

int Vect_remove_colors ( const char *  name,
const char *  mapset 
)

Remove color table of raster map.

Parameters
namename of raster map
mapsetname of mapset
Returns
-1 on error
0 color table not found
1 on success

Definition at line 29 of file vector/Vlib/color_remove.c.

References G_mapset(), G_name_is_fully_qualified(), G_remove(), GMAPSET_MAX, GNAME_MAX, GPATH_MAX, GV_COLR2_DIRECTORY, GV_COLR_ELEMENT, GV_DIRECTORY, and name.

◆ Vect_remove_constraints()

void Vect_remove_constraints ( struct Map_info Map)

Remove all constraints.

Parameters
Mappointer to Map_info struct

Definition at line 122 of file constraint.c.

References Map_info::constraint, FALSE, Map_info::field_flag, Map_info::region_flag, and Map_info::type_flag.

◆ Vect_remove_dangles()

void Vect_remove_dangles ( struct Map_info Map,
int  type,
double  maxlength,
struct Map_info Err 
)

Remove dangles from vector map.

Remove dangles of given type shorter than maxlength from vector map.

Line is considered to be a dangle if on at least one end node is no other line of given type(s). If a dangle is formed by more lines, such string of lines is taken as one dangle and either deleted are all parts or nothing.

Optionally deleted dangles are written to error map.

Input map must be opened on level 2 for update.

Parameters
Mapinput map where have to be deleted
typetype of dangles (GV_LINES, GV_LINE or GV_BOUNDARY)
maxlengthmaxlength of dangles or -1 for all dangles
[out]Errvector map where deleted dangles are written or NULL
Returns

Definition at line 49 of file dangles.c.

◆ Vect_remove_duplicates()

void Vect_remove_duplicates ( struct Map_info Map,
int  type,
struct Map_info Err 
)

Remove duplicate features from vector map.

Remove duplicate lines of given types from vector map. Duplicate lines may be optionally written to error map. Input map must be opened on level 2 for update. Categories are merged. GV_BUILD_BASE is sufficient.

Parameters
[in,out]Mapvector map where duplicate lines will be deleted
typetype of line to be delete
[out]Errvector map where duplicate lines will be written or NULL
Returns
void

Definition at line 69 of file remove_duplicates.c.

◆ Vect_remove_small_areas()

int Vect_remove_small_areas ( struct Map_info Map,
double  thresh,
struct Map_info Err,
double *  removed_area 
)

Remove small areas from the map map.

Centroid of the area and the longest boundary with adjacent area is removed. Map topology must be built GV_BUILD_CENTROIDS.

Parameters
[in,out]Mapvector map
threshmaximum area size for removed areas
[out]Errvector map where removed lines and centroids are written
removed_areapointer to where total size of removed area is stored or NULL
Returns
number of removed areas

Definition at line 41 of file remove_areas.c.

References Map_info::format, GV_FORMAT_NATIVE, Vect_remove_small_areas_ext(), and Vect_remove_small_areas_nat().

◆ Vect_rename()

int Vect_rename ( const char *  in,
const char *  out 
)

Rename existing vector map (in the current mapset).

Attribute tables are created in the same database where input tables were stored.

The original format (native/OGR) is used.

Note: Output vector map is overwritten if exists!

Parameters
inname of vector map to be renamed
outname for output vector map
Returns
-1 error
0 success

Definition at line 233 of file map.c.

Referenced by M_do_rename().

◆ Vect_reset_boxlist()

int Vect_reset_boxlist ( struct boxlist list)

Reset boxlist structure.

To make sure boxlist structure is clean to be re-used. List must have previously been created with Vect_new_boxlist().

Parameters
[in,out]listpointer to struct boxlist
Returns
0

Definition at line 251 of file vector/Vlib/list.c.

◆ Vect_reset_cats()

int Vect_reset_cats ( struct line_cats Cats)

Reset category structure to make sure cats structure is clean to be re-used.

I.e. it has no cats associated with it. Cats must have previously been created with Vect_new_cats_struct()

Parameters
[out]Catsline_cats structure
Returns
0

Definition at line 296 of file vector/Vlib/cats.c.

References line_cats::n_cats.

Referenced by IL_write_point_2d(), Vect_get_area_cat(), and Vect_get_area_cats().

◆ Vect_reset_dblinks()

void Vect_reset_dblinks ( struct dblinks p)

Reset dblinks structure (number of fields)

Parameters
ppointer to existing dblinks structure

Definition at line 101 of file field.c.

References dblinks::n_fields.

Referenced by Vect_read_dblinks().

◆ Vect_reset_line()

void Vect_reset_line ( struct line_pnts Points)

Reset line.

Make sure line structure is clean to be re-used, i.e. it has no points associated with it Points must have previously been created with Vect_new_line_struct().

Parameters
Pointspointer to line_pnts structure to be reset

Definition at line 129 of file line.c.

Referenced by IL_write_point_2d(), Vect__get_area_points_pg(), Vect_get_area_points(), and Vect_get_isle_points().

◆ Vect_reset_list()

int Vect_reset_list ( struct ilist list)

Reset ilist structure.

To make sure ilist structure is clean to be re-used. List must have previously been created with Vect_new_list().

Parameters
[in,out]listpointer to struct ilist
Returns
0

Definition at line 56 of file vector/Vlib/list.c.

Referenced by Vect_field_cat_get(), Vect_select_areas_by_polygon(), Vect_select_nodes_by_box(), and Vect_spatial_index_select().

◆ Vect_reset_updated()

void Vect_reset_updated ( struct Map_info Map)

Reset list of updated lines/nodes.

Parameters
Mappointer to Map_info struct

Definition at line 469 of file level_two.c.

◆ Vect_restore_line()

int Vect_restore_line ( struct Map_info Map,
off_t  offset,
off_t  line 
)

Restore previously deleted feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

Parameters
Mappointer to Map_info structure
offsetfeature offset to be restored
linefeature id to be restored (used only on level 2)
Returns
0 on success
-1 on error

Definition at line 309 of file vector/Vlib/write.c.

◆ Vect_rewind()

int Vect_rewind ( struct Map_info Map)

Rewind vector map to cause reads to start at beginning.

Parameters
Mappointer to Map_info structure
Returns
0 on success
-1 on error

Definition at line 62 of file vector/Vlib/rewind.c.

References G_debug(), Map_info::level, Map_info::name, and VECT_OPEN.

◆ Vect_rewrite_line()

off_t Vect_rewrite_line ( struct Map_info Map,
off_t  line,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites existing feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

The number of points or cats or type may change. If necessary, the old feature is deleted and new is written.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 238 of file vector/Vlib/write.c.

◆ Vect_save_fidx()

int Vect_save_fidx ( struct Map_info Map,
struct Format_info_offset offset 
)

◆ Vect_save_frmt()

◆ Vect_save_sidx()

int Vect_save_sidx ( struct Map_info Map)

◆ Vect_save_topo()

int Vect_save_topo ( struct Map_info Map)

Save topology file for vector map.

Parameters
Mappointer to Map_info structure
Returns
1 on success
0 on error

Definition at line 1012 of file build.c.

References _, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_write_plus_file(), gvfile::file, G_debug(), G_fopen_new(), G_warning(), GPATH_MAX, GV_TOPO_ELEMENT, Map_info::name, NULL, Map_info::plus, Plus_head::port, and Vect__get_path().

◆ Vect_segment_intersection()

int Vect_segment_intersection ( double  ax1,
double  ay1,
double  az1,
double  ax2,
double  ay2,
double  az2,
double  bx1,
double  by1,
double  bz1,
double  bx2,
double  by2,
double  bz2,
double *  x1,
double *  y1,
double *  z1,
double *  x2,
double *  y2,
double *  z2,
int  with_z 
)

Check for intersect of 2 line segments.

Parameters
ax1,ay1,az1,ax2,ay2,az2input line a
bx1,by1,bz1,bx2,by2,bz2input line b
[out]x1,y1,z1intersection point1 (case 2-4)
[out]x2,y2,z2intersection point2 (case 2-4)
with_zuse z coordinate (3D) (TODO)
Returns
0 - do not intersect,
1 - intersect at one point,
2 - partial overlap,
3 - a contains b,
4 - b contains a,
5 - identical

Definition at line 111 of file vector/Vlib/intersect.c.

◆ Vect_select_areas_by_box()

int Vect_select_areas_by_box ( struct Map_info Map,
const struct bound_box Box,
struct boxlist list 
)

Select areas with bounding boxes by box.

Select areas whose boxes overlap specified box!!! It means that selected area may or may not overlap the box.

Parameters
Mapvector map
Boxbounding box
[out]outputlist, must be initialized
Returns
number of areas

Definition at line 121 of file sindex.c.

Referenced by Vect_find_area().

◆ Vect_select_areas_by_polygon()

int Vect_select_areas_by_polygon ( struct Map_info Map,
struct line_pnts Polygon,
int  nisles,
struct line_pnts **  Isles,
struct ilist List 
)

Select areas by Polygon with optional isles.

Polygons should be closed, i.e. first and last points must be identical.

Parameters
Mapvector map
Polygonouter ring
nislesnumber of islands or 0
Islesarray of islands or NULL
[out]listoutput list, must be initialised
Returns
number of areas

Definition at line 317 of file sindex.c.

References G_debug(), GV_BOUNDARY, ilist::n_values, NULL, Vect_new_list(), Vect_reset_list(), and Vect_select_lines_by_polygon().

◆ Vect_select_dangles()

void Vect_select_dangles ( struct Map_info Map,
int  type,
double  maxlength,
struct ilist List 
)

Select dangles from vector map.

Remove dangles of given type shorter than maxlength from vector map.

Line is considered to be a dangle if on at least one end node is no other line of given type(s). If a dangle is formed by more lines, such string of lines is taken as one dangle.

Input map must be opened on level 2 for update.

Parameters
Mapinput map where have to be deleted
typetype of dangles (GV_LINES, GV_LINE or GV_BOUNDARY)
maxlengthmaxlength of dangles or -1 for all dangles
[out]Listlist of selected features
Returns

Definition at line 98 of file dangles.c.

◆ Vect_select_isles_by_box()

int Vect_select_isles_by_box ( struct Map_info Map,
const struct bound_box Box,
struct boxlist list 
)

Select isles with bounding boxes by box.

Select isles whose boxes overlap specified box!!! It means that selected isle may or may not overlap the box.

Parameters
Mapvector map
Boxbounding box
[out]listoutput list, must be initialized
Returns
number of isles

Definition at line 165 of file sindex.c.

References Box, dig_select_isles(), G_debug(), and Map_info::plus.

Referenced by Vect_attach_isles().

◆ Vect_select_lines_by_box()

int Vect_select_lines_by_box ( struct Map_info Map,
const struct bound_box Box,
int  type,
struct boxlist list 
)

Select lines with bounding boxes by box.

Select lines whose boxes overlap specified box!!! It means that selected line may or may not overlap the box.

Parameters
Mapvector map
Boxbounding box
typeline type
[out]listoutput list, must be initialized
Returns
number of lines

Definition at line 32 of file sindex.c.

◆ Vect_select_lines_by_polygon()

int Vect_select_lines_by_polygon ( struct Map_info Map,
struct line_pnts Polygon,
int  nisles,
struct line_pnts **  Isles,
int  type,
struct ilist List 
)

Select lines by Polygon with optional isles.

Polygons should be closed, i.e. first and last points must be identical.

Parameters
Mapvector map
Polygonouter ring
nislesnumber of islands or 0
Islesarray of islands or NULL
typeline type
[out]listoutput list, must be initialised
Returns
number of lines

Definition at line 220 of file sindex.c.

Referenced by Vect_select_areas_by_polygon().

◆ Vect_select_nodes_by_box()

int Vect_select_nodes_by_box ( struct Map_info Map,
const struct bound_box Box,
struct ilist list 
)

Select nodes by box.

Parameters
Mapvector map
Boxbounding box
[out]listoutput list, must be initialized
Returns
number of nodes

Definition at line 187 of file sindex.c.

References Box, dig_select_nodes(), G_debug(), Map_info::plus, and Vect_reset_list().

Referenced by Vect_find_node().

◆ Vect_set_category_index_update()

void Vect_set_category_index_update ( struct Map_info Map)

Set category index to be updated when vector is changed.

By default, category index is not updated if vector is changed, this function sets category index update.

WARNING: currently only category for elements is updated not for areas

Parameters
Mapvector map

Definition at line 561 of file map.c.

References Map_info::plus, TRUE, and Plus_head::update_cidx.

◆ Vect_set_comment()

int Vect_set_comment ( struct Map_info Map,
const char *  str 
)

Set comment or other info string in map header.

Parameters
Mappointer to Map_info structure
strcomment or other info string
Returns
0

Definition at line 438 of file vector/Vlib/header.c.

References dig_head::comment, G_free(), G_store(), and Map_info::head.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_constraint_field()

int Vect_set_constraint_field ( struct Map_info Map,
int  field 
)

Set constraint field.

Vect_read_next_line() will read only features of given type. Note that categories must be read otherwise this constraint is ignored. Constraint is ignored for random access - Vect_read_line().

Ignored for non-native vector formats.

Note: Field is called layer on user level.

Parameters
Mappointer to Map_info struct
fieldfield number (-1 for all fields)
Returns
0 on success
-1 invalid field

Definition at line 147 of file constraint.c.

References _, Map_info::constraint, FALSE, Map_info::field, Map_info::field_flag, Map_info::format, G_warning(), GV_FORMAT_NATIVE, and TRUE.

◆ Vect_set_constraint_region()

int Vect_set_constraint_region ( struct Map_info Map,
double  n,
double  s,
double  e,
double  w,
double  t,
double  b 
)

Set constraint region.

Vect_read_next_line() will read only features inside of given region or features with overlapping bounding box.

Note
Constraint is ignored for random access - Vect_read_line().
Parameters
Mappointer to Map_info struct
n,s,e,w,t,bbbox definition (north, south, east, west, top, and bottom coordinates)
Returns
0 on success
-1 on error (invalid region)

Definition at line 48 of file constraint.c.

◆ Vect_set_constraint_type()

int Vect_set_constraint_type ( struct Map_info Map,
int  type 
)

Set constraint type.

Vect_read_next_line() will read only features of given type. Constraint is ignored for random access - Vect_read_line().

Parameters
Mappointer to Map_info struct
typeconstraint feature type (GV_POINT, GV_LINE, ...)
Returns
0 on success
-1 invalid feature type

Definition at line 106 of file constraint.c.

◆ Vect_set_date()

int Vect_set_date ( struct Map_info Map,
const char *  str 
)

Set date of digitization in map header.

Todo:
This should be coupled to DateTime functions to support time series
Parameters
Mappointer to Map_info structure
strdate given as string
Returns
0

Definition at line 299 of file vector/Vlib/header.c.

References dig_head::date, G_free(), G_store(), and Map_info::head.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_db_updated()

void Vect_set_db_updated ( struct Map_info Map)

Rewrite 'dbln' file.

Should be used by GRASS modules which update database tables, so that other applications know that tables were changed and can reload data.

Parameters
Mappointer to Map_info structure

Definition at line 990 of file field.c.

References _, G_fatal_error(), G_mapset(), G_strcasecmp(), Map_info::mapset, and Vect_write_dblinks().

◆ Vect_set_error_handler_io()

void Vect_set_error_handler_io ( struct Map_info In,
struct Map_info Out 
)

Define standard error handler for input and output vector maps.

This handler:

  • close input vector map on error
  • close and delete output vector map on error

Note: It's recommended to call this routine after Vect_open_old() or Vect_open_old2().

Parameters
Inpointer in Map_info struct (input vector map) or NULL
Outpointer to Map_info struct (output vector map) or NULL

Definition at line 58 of file vector/Vlib/handler.c.

◆ Vect_set_map_date()

int Vect_set_map_date ( struct Map_info Map,
const char *  str 
)

Set date when the source map was originally produced in map header.

Parameters
Mappointer to Map_info structure
strdate given as a string
Returns
0

Definition at line 383 of file vector/Vlib/header.c.

References G_free(), G_store(), Map_info::head, and dig_head::source_date.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_map_name()

int Vect_set_map_name ( struct Map_info Map,
const char *  str 
)

Set map name in map header.

Parameters
Mappointer to Map_info structure
strmap name to be set
Returns
0

Definition at line 355 of file vector/Vlib/header.c.

References G_free(), G_store(), Map_info::head, and dig_head::map_name.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_open_level()

int Vect_set_open_level ( int  level)

Predetermine level at which a vector map will be opened for reading.

If it can't open that level, the open will fail. The specified level must be set before any call to open. The default is to try to open the highest level possible, and keep stepping down until success.

NOTE: This should only be used to set when you wish to force a lower level open. If you require a higher level, then just check the return to verify the level instead of forcing it. This is because future releases will have higher levels which will be downward compatible and which your programs should support by default.

Parameters
levelvector access level
Returns
0 on success
1 on error (invalid access level)

Definition at line 138 of file vector/Vlib/open.c.

◆ Vect_set_organization()

int Vect_set_organization ( struct Map_info Map,
const char *  str 
)

Set organization string in map header.

Parameters
Mappointer to Map_info structure
strorganization name
Returns
0

Definition at line 268 of file vector/Vlib/header.c.

References G_free(), G_store(), Map_info::head, and dig_head::organization.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_person()

int Vect_set_person ( struct Map_info Map,
const char *  str 
)

Set name of user who digitized the map in map header.

Parameters
Mappointer to Map_info structure
struser name
Returns
0

Definition at line 327 of file vector/Vlib/header.c.

References G_free(), G_store(), Map_info::head, and dig_head::user_name.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_proj()

int Vect_set_proj ( struct Map_info Map,
int  proj 
)

Set projection in map header.

Supported projections:

  • PROJECTION_XY 0 - x,y (Raw imagery),
  • PROJECTION_UTM 1 - UTM Universal Transverse Mercator,
  • PROJECTION_LL 3 - Latitude-Longitude
Parameters
Mappointer to Map_info structure
projprojection code
Returns
0

Definition at line 503 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::proj.

Referenced by Vect__init_head(), and Vect__read_head().

◆ Vect_set_release_support()

void Vect_set_release_support ( struct Map_info Map)

Set spatial index to be released when vector is closed.

By default, the memory occupied by spatial index is not released.

Parameters
Mapvector map

Definition at line 545 of file map.c.

References Map_info::plus, Plus_head::release_support, and TRUE.

◆ Vect_set_scale()

int Vect_set_scale ( struct Map_info Map,
int  scale 
)

Set map scale in map header.

Parameters
Mappointer to Map_info structure
scalemap scale
Returns
0

Definition at line 411 of file vector/Vlib/header.c.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_thresh()

int Vect_set_thresh ( struct Map_info Map,
double  thresh 
)

Set threshold used for digitization in map header.

Parameters
Mappointer to Map_info structure
threshthreshold used for digitization
Returns
0

Definition at line 571 of file vector/Vlib/header.c.

References dig_head::digit_thresh, G_debug(), and Map_info::head.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_set_updated()

void Vect_set_updated ( struct Map_info Map,
int  enable 
)

Enable/disable maintenance of list of updated lines/nodes.

See Plus_head.uplist for details.

Parameters
Mappointer to Map_info struct
enableTRUE/FALSE to enable/disable

Definition at line 454 of file level_two.c.

References G_debug(), and Map_info::name.

◆ Vect_set_varray_from_cat_list()

int Vect_set_varray_from_cat_list ( struct Map_info Map,
int  field,
struct cat_list clist,
int  type,
int  value,
struct varray varray 
)

Set values in 'varray' to 'value' from category list.

If category of object of given type is in clist (category list). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID

Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.

Parameters
Mapvector map
fieldlayer number
clistlist of categories
typefeature type
valuevalue to set up
[out]varrayvarray structure to modify
Returns
number of items set
-1 on error

Definition at line 124 of file array.c.

◆ Vect_set_varray_from_cat_string()

int Vect_set_varray_from_cat_string ( struct Map_info Map,
int  field,
const char *  cstring,
int  type,
int  value,
struct varray varray 
)

Set values in 'varray' to 'value' from category string.

If category of object of given type is in cstring (string representing category list like: '1,3,5-7'). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID

Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.

Parameters
Mapvector map
fieldlayer number
cstringpointer to string with categories
typefeature type
valuevalue to set up
[out]varrayvarray structure to modify
Returns
number of items set
-1 on error

Definition at line 79 of file array.c.

Referenced by NetA_initialise_varray().

◆ Vect_set_varray_from_db()

int Vect_set_varray_from_db ( struct Map_info Map,
int  field,
const char *  where,
int  type,
int  value,
struct varray varray 
)

Set values in 'varray' to 'value' from DB (where statement)

I category of object of given type is in categories selected from DB based on where statement (given without where). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID

Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.

Parameters
Mapvector map
fieldlayer number
wherewhere statement
typefeature type
valuevalue to set up
[out]varrayvarray structure to modify
Returns
number of items set
-1 on error

Definition at line 242 of file array.c.

Referenced by NetA_initialise_varray().

◆ Vect_set_zone()

int Vect_set_zone ( struct Map_info Map,
int  zone 
)

Set projection zone in map header.

Parameters
Mappointer to Map_info structure
zoneprojection zone
Returns
0

Definition at line 466 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::plani_zone.

Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

◆ Vect_sfa_check_line_type()

int Vect_sfa_check_line_type ( const struct line_pnts Points,
int  type,
SF_FeatureType  sftype,
int  with_z 
)

Check SF type.

E.g. if type is GV_LINE with two or more segments and the start node is identical with the end node, and sftype is SF_LINEARRING, functions returns 1, otherwise 0.

Parameters
Pointspointer to line_pnts structure
typefeature type (GV_POINT, GV_LINE, ...)
sftypeSF type to be checked (SF_POINT, SF_LINE, ...)
with_znon-zero value for 3D data
Returns
1 if type is sftype
0 type differs from sftype

Definition at line 114 of file simple_features.c.

◆ Vect_sfa_get_line_type()

SF_FeatureType Vect_sfa_get_line_type ( const struct line_pnts Points,
int  type,
int  with_z 
)

Get SF type of given vector feature.

List of supported feature types:

  • GV_POINT -> SF_POINT
  • GV_LINE -> SF_LINESTRING
  • GV_LINE (closed) -> SF_LINEARRING
  • GV_BOUNDARY -> SF_POLYGON
Parameters
Pointspointer to line_pnts structure
typefeature type (see supported types above)
with_zWITH_Z for 3D data
Returns
SF type identificator (see list of supported types)
-1 on error

Definition at line 64 of file simple_features.c.

◆ Vect_sfa_get_num_features()

int Vect_sfa_get_num_features ( struct Map_info Map)

◆ Vect_sfa_get_type()

int Vect_sfa_get_type ( SF_FeatureType  sftype)

Get relevant GV type.

Parameters
Mappointer to Map_info structure
typeSF geometry type (SF_POINT, SF_LINESTRING, ...)
Returns
GV type
-1 on error

Definition at line 79 of file simple_features.c.

References GV_BOUNDARY, GV_LINE, GV_POINT, SF_LINEARRING, SF_LINESTRING, SF_LINESTRING25D, SF_POINT, SF_POINT25D, SF_POLYGON, and SF_POLYGON25D.

◆ Vect_sfa_is_line_closed()

int Vect_sfa_is_line_closed ( const struct line_pnts Points,
int  type,
int  with_z 
)

Check if feature is closed.

Parameters
Pointspointer to line_pnts structure
typefeature type (GV_LINE or GV_BOUNDARY)
Returns
1 feature closed
0 feature not closed
-1 feature type not supported (GV_POINT, GV_CENTROID, ...)

Definition at line 271 of file simple_features.c.

◆ Vect_sfa_is_line_simple()

int Vect_sfa_is_line_simple ( const struct line_pnts ,
int  ,
int   
)

◆ Vect_sfa_line_astext()

int Vect_sfa_line_astext ( const struct line_pnts Points,
int  type,
int  with_z,
int  precision,
FILE *  file 
)

Export geometry to Well-Known Text.

Parameters
Pointspointer to line_pnts structure
typefeature type
with_znon-zero value for 3D data
precisionfloating number precision
[out]filefile where to write the output
Returns
0 on success
-1 unsupported feature type

Definition at line 188 of file simple_features.c.

◆ Vect_sfa_line_dimension()

int Vect_sfa_line_dimension ( int  type)

Get geometry dimension.

Parameters
Pointspointer to line_pnts structure
typefeature type (GV_POINT, GV_LINE, ...)
Returns
0 for GV_POINT
1 for GV_LINE
2 for GV_BOUNDARY
-1 unsupported feature type

Definition at line 131 of file simple_features.c.

◆ Vect_sfa_line_geometry_type()

char* Vect_sfa_line_geometry_type ( const struct line_pnts Points,
int  type 
)

Get geometry type (string)

Supported types:

  • GV_POINT -> SF_POINT -> "POINT"
  • GV_LINE -> SF_LINESTRING -> "LINESTRING"
  • GV_LINE (closed) -> SF_LINEARRING -> "LINEARRING"
  • GV_BOUNDARY (closed) -> SF_POLYGON -> "POLYGON"

Note: Allocated string should be freed by G_free().

Parameters
Pointspointer to line_pnts structure (feature geometry)
typefeature type (see supported types above)
Returns
geometry type string
NULL unsupported feature type

Definition at line 160 of file simple_features.c.

◆ Vect_sidx_dump()

int Vect_sidx_dump ( struct Map_info Map,
FILE *  out 
)

Dump spatial index to file.

Parameters
Mapvector map
outfile for output (stdout/stderr for example)
Returns
1 on success
0 on error

Definition at line 1315 of file build.c.

References dig_dump_spidx(), Map_info::plus, Plus_head::Spidx_built, and Vect_build_sidx_from_topo().

◆ Vect_snap_line()

int Vect_snap_line ( struct Map_info Map,
struct ilist reflist,
struct line_pnts Points,
double  thresh,
int  with_z,
int *  nsnapped,
int *  ncreated 
)

Snap a line to reference lines in Map with threshold.

3D snapping is supported. The line to snap and the reference lines can but do not need to be in different vector maps.

Vect_snap_line() uses less memory, but is slower than Vect_snap_lines_list()

For details on snapping, see Vect_snap_lines_list()

Parameters
[in]Mapinput map with reference lines
[in]reflistlist of reference lines
[in,out]Pointsline points to snap
[in]threshthreshold in which to snap vertices
[in]with_z2D or 3D snapping
[in,out]nsnappednumber of snapped vertices
[in,out]ncreatednumber of new vertices (on segments)
Returns
1 if line was changed, otherwise 0

Definition at line 949 of file Vlib/snap.c.

◆ Vect_snap_lines()

void Vect_snap_lines ( struct Map_info Map,
int  type,
double  thresh,
struct Map_info Err 
)

Snap lines in vector map to existing vertex in threshold.

For details see Vect_snap_lines_list()

Parameters
[in]Mapinput map where vertices will be snapped
[in]typetype of lines to snap
[in]threshthreshold in which snap vertices
[out]Errvector map where lines representing snap are written or NULL
Returns
void

Definition at line 896 of file Vlib/snap.c.

◆ Vect_snap_lines_list()

void Vect_snap_lines_list ( struct Map_info Map,
const struct ilist List_lines,
double  thresh,
struct Map_info Err 
)

Snap selected lines to existing vertex in threshold.

Snap selected lines to existing vertices of other selected lines. 3D snapping is not supported.

Lines showing how vertices were snapped may be optionally written to error map. Input map must be opened on level 2 for update at least on GV_BUILD_BASE.

As mentioned above, lines are not necessarily snapped to nearest vertex! For example:

|
| 1         line 3 is snapped to line 1,
|           then line 2 is not snapped to common node at lines 1 and 3,
because it is already outside of threshold
----------- 3

|
| 2
|

The algorithm selects anchor vertices and snaps non-anchor vertices to these anchors. The distance between anchor vertices is always > threshold. If there is more than one anchor vertex within threshold around a non-anchor vertex, this vertex is snapped to the nearest anchor vertex within threshold.

Parameters
Mapinput map where vertices will be snapped
List_lineslist of lines to snap
threshthreshold in which snap vertices
[out]Errvector map where lines representing snap are written or NULL
Returns
void

Definition at line 169 of file Vlib/snap.c.

◆ Vect_spatial_index_add_item()

void Vect_spatial_index_add_item ( struct spatial_index si,
int  id,
const struct bound_box box 
)

Add a new item to spatial index structure.

Parameters
[in,out]sipointer to spatial index structure
iditem identifier
boxpointer to item bounding box
Returns
void

Definition at line 62 of file vector/Vlib/select.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, bound_box::N, RTree::nsides_alloc, RTreeInsertRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.

◆ Vect_spatial_index_del_item()

void Vect_spatial_index_del_item ( struct spatial_index si,
int  id,
const struct bound_box box 
)

Delete item from spatial index structure.

Parameters
[in,out]sipointer to spatial index structure
iditem identifier
Returns
void

Definition at line 92 of file vector/Vlib/select.c.

References _, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_fatal_error(), G_malloc, bound_box::N, RTree::nsides_alloc, RTreeDeleteRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.

◆ Vect_spatial_index_destroy()

void Vect_spatial_index_destroy ( struct spatial_index si)

Destroy existing spatial index.

Vect_spatial_index_init() must be call before new use.

Parameters
sipointer to spatial index structure
Returns
void

Definition at line 46 of file vector/Vlib/select.c.

References G_debug(), RTreeDestroyTree(), and spatial_index::si_tree.

◆ Vect_spatial_index_init()

void Vect_spatial_index_init ( struct spatial_index si,
int  with_z 
)

Initialize spatial index structure.

Parameters
sipointer to spatial index structure
Returns
void

Definition at line 30 of file vector/Vlib/select.c.

References G_debug(), RTreeCreateTree(), and spatial_index::si_tree.

◆ Vect_spatial_index_select()

int Vect_spatial_index_select ( const struct spatial_index si,
const struct bound_box box,
struct ilist list 
)

Select items by bounding box to list.

Parameters
sipointer to spatial index structure
boxbounding box
[out]listpointer to list where selected items are stored
Returns
number of selected items

Definition at line 137 of file vector/Vlib/select.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_malloc, bound_box::N, RTree::nsides_alloc, RTreeSearch(), bound_box::S, spatial_index::si_tree, bound_box::T, Vect_reset_list(), and bound_box::W.

◆ Vect_str_to_cat_list()

int Vect_str_to_cat_list ( const char *  str,
struct cat_list list 
)

Converts string of categories and cat ranges separated by commas to cat_list.

Examples of string:
5,6,7
3-9
2,3,5-9,20
Example:
...
str = "2,3,5-9,20"
struct cat_list * Vect_new_cat_list(void)
Allocate memory for cat_list structure.
int Vect_str_to_cat_list(const char *, struct cat_list *)
Converts string of categories and cat ranges separated by commas to cat_list.
Category list.
Definition: dig_structs.h:1697
cat_list->field = 0
cat_list->n_ranges = 4
cat_list->min = {2, 3, 5, 20}
cat_list->max = {2, 3, 9, 20}
Parameters
strcategory list as a string
[in,out]listpointer to cat_list structure
Returns
number of errors in ranges

Definition at line 368 of file vector/Vlib/cats.c.

References err(), and l.

◆ Vect_subst_var()

char* Vect_subst_var ( const char *  in,
struct Map_info Map 
)

Substitute variable in string.

Parameters
incurrent string
Mappointer to Map_info structure
Returns
pointer to new string

Definition at line 931 of file field.c.

Referenced by Vect_get_dblink().

◆ Vect_tin_get_z()

int Vect_tin_get_z ( struct Map_info ,
double  ,
double  ,
double *  ,
double *  ,
double *   
)

◆ Vect_topo_check()

int Vect_topo_check ( struct Map_info Map,
struct Map_info Err 
)

Extensive tests for correct topology.

  • lines or boundaries of zero length
  • intersecting boundaries, ie. overlapping areas
  • areas without centroids that are not isles
Parameters
Mapvector map
[out]Errvector map where errors will be written or NULL
Returns
1 on success
0 on error

Definition at line 604 of file build.c.

◆ Vect_topo_dump()

int Vect_topo_dump ( struct Map_info Map,
FILE *  out 
)

Dump topology to file.

Parameters
Mapvector map
outfile for output (stdout/stderr for example)
Returns
1 on success
0 on error

Definition at line 1054 of file build.c.

◆ Vect_val_in_boxlist()

int Vect_val_in_boxlist ( const struct boxlist list,
int  id 
)

Find a given item in the list.

Parameters
listpointer to boxlist structure
idvalue of item
Returns
1 if an item is found
0 no found item in the list

Definition at line 417 of file vector/Vlib/list.c.

References NULL.

◆ Vect_val_in_list()

int Vect_val_in_list ( const struct ilist list,
int  val 
)

Find a given item in the list.

Parameters
listpointer to ilist structure
valvalue of item
Returns
1 if an item is found
0 no found item in the list

Definition at line 196 of file vector/Vlib/list.c.

References NULL.

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

◆ Vect_write_colors()

void Vect_write_colors ( const char *  name,
const char *  mapset,
struct Colors colors 
)

Write color table for vector map.

The color table is written for the vector map name in the specified mapset from the colors structure.

The colors structure must be created properly, i.e., Rast_init_colors() to initialize the structure and Rast_add_c_color_rule() to set the category colors. These routines are called by higher level routines which read or create entire color tables, such as Rast_read_colors() or Rast_make_ramp_colors().

Note: The calling sequence for this function deserves special attention. The mapset parameter seems to imply that it is possible to overwrite the color table for a vector map which is in another mapset. However, this is not what actually happens. It is very useful for users to create their own color tables for vector maps in other mapsets, but without overwriting other users' color tables for the same raster map. If mapset is the current mapset, then the color file for name will be overwritten by the new color table. But if mapset is not the current mapset, then the color table is actually written in the current mapset under the colr2 element as: vector/name/colr2.

The rules are written out using floating-point format, removing trailing zeros (possibly producing integers). The flag marking the colors as floating-point is not written.

If the environment variable FORCE_GRASS3_COLORS is set (to anything at all) then the output format is 3.0, even if the structure contains 4.0 rules. This allows users to create 3.0 color files for export to sites which don't yet have 4.0

Parameters
namevector map name
mapsetmapset name
colorspointer to structure Colors which holds color info
Returns
void

Definition at line 61 of file vector/Vlib/color_write.c.

◆ Vect_write_dblinks()

◆ Vect_write_header()

int Vect_write_header ( struct Map_info Map)

Write vector map header to map head file.

Parameters
Mappointer to Map_info structure
Returns
0

Definition at line 64 of file vector/Vlib/header.c.

References Vect__write_head().

◆ Vect_write_line()

off_t Vect_write_line ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes a new feature.

New feature is written to the end of file (in the case of native format). Topological level is not required.

A warning is printed on error.

Parameters
Mappointer to Map_info structure
typefeature type (see dig_defines.h for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 196 of file vector/Vlib/write.c.

Referenced by IL_write_point_2d().