GRASS GIS 8 Programmer's Manual  8.5.0dev(2025)-a277d8547c
defs/vector.h
Go to the documentation of this file.
1 #ifndef GRASS_VECTORDEFS_H
2 #define GRASS_VECTORDEFS_H
3 
4 #include <stdbool.h>
5 
6 /*
7  * "Public" functions, for use in modules
8  */
9 /* Points (line) */
10 struct line_pnts *Vect_new_line_struct(void);
11 int Vect_append_point(struct line_pnts *, double, double, double);
12 int Vect_append_points(struct line_pnts *, const struct line_pnts *, int);
13 int Vect_line_insert_point(struct line_pnts *, int, double, double, double);
14 int Vect_line_delete_point(struct line_pnts *, int);
15 int Vect_line_get_point(const struct line_pnts *, int, double *, double *,
16  double *);
17 int Vect_get_num_line_points(const struct line_pnts *);
18 int Vect_line_prune(struct line_pnts *);
19 int Vect_line_prune_thresh(struct line_pnts *, double);
20 void Vect_line_reverse(struct line_pnts *);
21 int Vect_copy_xyz_to_pnts(struct line_pnts *, const double *, const double *,
22  const double *, int);
23 int Vect_copy_pnts_to_xyz(const struct line_pnts *, double *, double *,
24  double *, int *);
25 void Vect_reset_line(struct line_pnts *);
26 void Vect_destroy_line_struct(struct line_pnts *);
27 int Vect_point_on_line(const struct line_pnts *, double, double *, double *,
28  double *, double *, double *);
29 int Vect_line_segment(const struct line_pnts *, double, double,
30  struct line_pnts *);
31 double Vect_line_length(const struct line_pnts *);
32 double Vect_line_geodesic_length(const struct line_pnts *);
33 int Vect_line_distance(const struct line_pnts *, double, double, double, int,
34  double *, double *, double *, double *, double *,
35  double *);
36 int Vect_line_geodesic_distance(const struct line_pnts *, double, double,
37  double, int, double *, double *, double *,
38  double *, double *, double *);
39 void Vect_line_box(const struct line_pnts *, struct bound_box *);
40 void Vect_line_parallel(struct line_pnts *, double, double, int,
41  struct line_pnts *);
42 void Vect_line_parallel2(struct line_pnts *, double, double, double, int, int,
43  double, struct line_pnts *);
44 void Vect_line_buffer(const struct line_pnts *, double, double,
45  struct line_pnts *);
46 void Vect_line_buffer2(const struct line_pnts *, double, double, double, int,
47  int, double, struct line_pnts **, struct line_pnts ***,
48  int *);
49 void Vect_area_buffer2(struct Map_info *, int, double, double, double, int, int,
50  double, struct line_pnts **, struct line_pnts ***,
51  int *);
52 void Vect_point_buffer2(double, double, double, double, double, int, double,
53  struct line_pnts **);
54 
55 /* Categories */
56 struct line_cats *Vect_new_cats_struct(void);
57 int Vect_cat_set(struct line_cats *, int, int);
58 int Vect_cat_get(const struct line_cats *, int, int *);
59 int Vect_cat_del(struct line_cats *, int);
60 int Vect_field_cat_del(struct line_cats *, int, int);
61 int Vect_field_cat_get(const struct line_cats *, int, struct ilist *);
62 int Vect_cat_in_array(int, const int *, int);
63 int Vect_reset_cats(struct line_cats *);
64 void Vect_destroy_cats_struct(struct line_cats *);
65 int Vect_get_area_cats(struct Map_info *, int, struct line_cats *);
66 int Vect_get_area_cat(struct Map_info *, int, int);
67 int Vect_get_line_cat(struct Map_info *, int, int);
68 struct cat_list *Vect_cats_set_constraint(struct Map_info *, int, char *,
69  char *);
70 int Vect_cats_in_constraint(struct line_cats *, int, struct cat_list *);
71 
72 /* List of categories */
73 struct cat_list *Vect_new_cat_list(void);
74 int Vect_str_to_cat_list(const char *, struct cat_list *);
75 int Vect_array_to_cat_list(const int *, int, struct cat_list *);
76 int Vect_cat_list_to_array(const struct cat_list *, int **, int *);
77 int Vect_cat_in_cat_list(int, const struct cat_list *);
78 void Vect_destroy_cat_list(struct cat_list *);
79 
80 /* Vector array */
81 struct varray *Vect_new_varray(int);
82 int Vect_set_varray_from_cat_string(struct Map_info *, int, const char *, int,
83  int, struct varray *);
84 int Vect_set_varray_from_cat_list(struct Map_info *, int, struct cat_list *,
85  int, int, struct varray *);
86 int Vect_set_varray_from_db(struct Map_info *, int, const char *, int, int,
87  struct varray *);
88 
89 /* DB connection - field info */
90 struct dblinks *Vect_new_dblinks_struct(void);
91 void Vect_reset_dblinks(struct dblinks *);
92 int Vect_add_dblink(struct dblinks *, int, const char *, const char *,
93  const char *, const char *, const char *);
94 int Vect_check_dblink(const struct dblinks *, int, const char *);
95 int Vect_map_add_dblink(struct Map_info *, int, const char *, const char *,
96  const char *, const char *, const char *);
97 int Vect_map_del_dblink(struct Map_info *, int);
98 void Vect_copy_map_dblinks(struct Map_info *, struct Map_info *, int);
99 int Vect_map_check_dblink(struct Map_info *, int, const char *);
100 int Vect_read_dblinks(struct Map_info *);
101 int Vect_write_dblinks(struct Map_info *);
102 struct field_info *Vect_default_field_info(struct Map_info *, int, const char *,
103  int);
104 struct field_info *Vect_get_dblink(struct Map_info *, int);
105 struct field_info *Vect_get_field(struct Map_info *, int);
106 struct field_info *Vect_get_field_by_name(struct Map_info *, const char *);
107 struct field_info *Vect_get_field2(struct Map_info *, const char *);
108 int Vect_get_field_number(struct Map_info *, const char *);
109 void Vect_set_db_updated(struct Map_info *);
110 const char *Vect_get_column_names(struct Map_info *, int);
111 const char *Vect_get_column_types(struct Map_info *, int);
112 const char *Vect_get_column_names_types(struct Map_info *, int);
113 void Vect_destroy_field_info(struct field_info *);
114 
115 /* List of FID (feature ID) (integers) */
116 struct ilist *Vect_new_list(void);
117 int Vect_list_append(struct ilist *, int);
118 int Vect_list_append_list(struct ilist *, const struct ilist *);
119 int Vect_list_delete(struct ilist *, int);
120 int Vect_list_delete_list(struct ilist *, const struct ilist *);
121 int Vect_val_in_list(const struct ilist *, int);
122 int Vect_reset_list(struct ilist *);
123 void Vect_destroy_list(struct ilist *);
124 
125 /* List of bounding boxes with ids */
126 struct boxlist *Vect_new_boxlist(int);
127 int Vect_boxlist_append(struct boxlist *, int, const struct bound_box *);
128 int Vect_boxlist_append_boxlist(struct boxlist *, const struct boxlist *);
129 int Vect_boxlist_delete(struct boxlist *, int);
130 int Vect_boxlist_delete_boxlist(struct boxlist *, const struct boxlist *);
131 int Vect_val_in_boxlist(const struct boxlist *, int);
132 int Vect_reset_boxlist(struct boxlist *);
133 void Vect_destroy_boxlist(struct boxlist *);
134 
135 /* Bounding box (MBR) */
136 int Vect_point_in_box(double, double, double, const struct bound_box *);
137 int Vect_point_in_box_2d(double, double, const struct bound_box *);
138 int Vect_box_overlap(const struct bound_box *, const struct bound_box *);
139 int Vect_box_copy(struct bound_box *, const struct bound_box *);
140 int Vect_box_extend(struct bound_box *, const struct bound_box *);
141 int Vect_box_clip(double *, double *, double *, double *,
142  const struct bound_box *);
143 int Vect_region_box(const struct Cell_head *, struct bound_box *);
144 
145 /* Category index */
146 int Vect_cidx_get_num_fields(struct Map_info *);
147 int Vect_cidx_get_field_number(struct Map_info *, int);
148 int Vect_cidx_get_field_index(struct Map_info *, int);
150 int Vect_cidx_get_num_cats_by_index(struct Map_info *, int);
151 int Vect_cidx_get_num_types_by_index(struct Map_info *, int);
152 int Vect_cidx_get_type_count_by_index(struct Map_info *, int, int, int *,
153  int *);
154 int Vect_cidx_get_type_count(struct Map_info *, int, int);
155 int Vect_cidx_get_cat_by_index(struct Map_info *, int, int, int *, int *,
156  int *);
157 int Vect_cidx_get_unique_cats_by_index(struct Map_info *, int, struct ilist *);
158 int Vect_cidx_find_next(struct Map_info *, int, int, int, int, int *, int *);
159 void Vect_cidx_find_all(struct Map_info *, int, int, int, struct ilist *);
160 int Vect_cidx_dump(struct Map_info *, FILE *);
161 int Vect_cidx_save(struct Map_info *);
162 int Vect_cidx_open(struct Map_info *, int);
163 
164 /* Create/destroy Map_info */
165 struct Map_info *Vect_new_map_struct(void);
166 void Vect_destroy_map_struct(struct Map_info *);
167 
168 /* Set/get map header info */
169 int Vect_read_header(struct Map_info *);
170 int Vect_write_header(struct Map_info *);
171 const char *Vect_get_name(struct Map_info *);
172 const char *Vect_get_mapset(struct Map_info *);
173 const char *Vect_get_full_name(struct Map_info *);
174 const char *Vect_get_finfo_dsn_name(struct Map_info *);
175 char *Vect_get_finfo_layer_name(struct Map_info *);
176 const char *Vect_get_finfo_format_info(struct Map_info *);
177 const char *Vect_get_finfo_geometry_type(struct Map_info *);
178 const struct Format_info *Vect_get_finfo(struct Map_info *);
179 int Vect_get_finfo_topology_info(struct Map_info *, char **, char **, int *);
180 int Vect_is_3d(struct Map_info *);
181 int Vect_set_organization(struct Map_info *, const char *);
182 const char *Vect_get_organization(struct Map_info *);
183 int Vect_set_date(struct Map_info *, const char *);
184 const char *Vect_get_date(struct Map_info *);
185 int Vect_set_person(struct Map_info *, const char *);
186 const char *Vect_get_person(struct Map_info *);
187 int Vect_set_map_name(struct Map_info *, const char *);
188 const char *Vect_get_map_name(struct Map_info *);
189 int Vect_set_map_date(struct Map_info *, const char *);
190 const char *Vect_get_map_date(struct Map_info *);
191 int Vect_set_comment(struct Map_info *, const char *);
192 const char *Vect_get_comment(struct Map_info *);
193 int Vect_set_scale(struct Map_info *, int);
194 int Vect_get_scale(struct Map_info *);
195 int Vect_set_zone(struct Map_info *, int);
196 int Vect_get_zone(struct Map_info *);
197 int Vect_get_proj(struct Map_info *);
198 int Vect_set_proj(struct Map_info *, int);
199 const char *Vect_get_proj_name(struct Map_info *);
200 int Vect_set_thresh(struct Map_info *, double);
201 double Vect_get_thresh(struct Map_info *);
202 int Vect_get_constraint_box(struct Map_info *, struct bound_box *);
203 
204 /* Get map information */
205 int Vect_level(struct Map_info *);
206 
207 /* Get map level 1 information */
208 int Vect_get_map_box1(struct Map_info *, struct bound_box *);
209 
210 /* Get map level 2 information */
211 int Vect_get_line_type(struct Map_info *, int);
221 int Vect_get_line_box(struct Map_info *, int, struct bound_box *);
222 int Vect_get_area_box(struct Map_info *, int, struct bound_box *);
223 int Vect_get_isle_box(struct Map_info *, int, struct bound_box *);
224 int Vect_get_map_box(struct Map_info *, struct bound_box *);
225 int V__map_overlap(struct Map_info *, double, double, double, double);
226 void Vect_set_release_support(struct Map_info *);
228 
229 /* Open/close/rewind/set_constraints for map */
230 int Vect_check_input_output_name(const char *, const char *, int);
231 int Vect_legal_filename(const char *);
232 int Vect_set_open_level(int);
233 int Vect_open_old(struct Map_info *, const char *, const char *);
234 int Vect_open_tmp_old(struct Map_info *, const char *, const char *);
235 int Vect_open_old2(struct Map_info *, const char *, const char *, const char *);
236 int Vect_open_old_head(struct Map_info *, const char *, const char *);
237 int Vect_open_old_head2(struct Map_info *, const char *, const char *,
238  const char *);
239 int Vect_open_new(struct Map_info *, const char *, int);
240 int Vect_open_tmp_new(struct Map_info *, const char *, int);
241 int Vect_open_update(struct Map_info *, const char *, const char *);
242 int Vect_open_tmp_update(struct Map_info *, const char *, const char *);
243 int Vect_open_update2(struct Map_info *, const char *, const char *,
244  const char *);
245 int Vect_open_update_head(struct Map_info *, const char *, const char *);
246 int Vect_copy_head_data(struct Map_info *, struct Map_info *);
247 int Vect_build(struct Map_info *);
248 int Vect_topo_check(struct Map_info *, struct Map_info *);
249 int Vect_get_built(struct Map_info *);
250 int Vect_build_partial(struct Map_info *, int);
251 int Vect_set_constraint_region(struct Map_info *, double, double, double,
252  double, double, double);
253 int Vect_set_constraint_type(struct Map_info *, int);
254 int Vect_set_constraint_field(struct Map_info *, int);
255 void Vect_remove_constraints(struct Map_info *);
256 int Vect_rewind(struct Map_info *);
257 int Vect_close(struct Map_info *);
258 void Vect_set_error_handler_io(struct Map_info *, struct Map_info *);
259 
260 /* Read/write lines, nodes, areas */
261 /* Level 1 and 2 */
262 int Vect_get_next_line_id(struct Map_info *);
263 int Vect_read_next_line(struct Map_info *, struct line_pnts *,
264  struct line_cats *);
265 off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *,
266  const struct line_cats *);
267 off_t Vect_rewrite_line(struct Map_info *, off_t, int, const struct line_pnts *,
268  const struct line_cats *);
269 int Vect_delete_line(struct Map_info *, off_t);
270 int Vect_restore_line(struct Map_info *, off_t, off_t);
271 
272 int Vect_get_num_dblinks(struct Map_info *);
273 
274 /* Level 2 only */
275 int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *,
276  int);
277 
278 int Vect_line_alive(struct Map_info *, int);
279 int Vect_node_alive(struct Map_info *, int);
280 int Vect_area_alive(struct Map_info *, int);
281 int Vect_isle_alive(struct Map_info *, int);
282 int Vect_get_line_nodes(struct Map_info *, int, int *, int *);
283 int Vect_get_line_areas(struct Map_info *, int, int *, int *);
284 off_t Vect_get_line_offset(struct Map_info *, int);
285 
286 int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *);
287 int Vect_get_node_n_lines(struct Map_info *, int);
288 int Vect_get_node_line(struct Map_info *, int, int);
289 float Vect_get_node_line_angle(struct Map_info *, int, int);
290 
291 int Vect_get_area_points(struct Map_info *, int, struct line_pnts *);
292 int Vect_get_area_centroid(struct Map_info *, int);
293 int Vect_get_area_num_isles(struct Map_info *, int);
294 int Vect_get_area_isle(struct Map_info *, int, int);
295 double Vect_get_area_perimeter(struct Map_info *, int);
296 double Vect_get_area_area(struct Map_info *, int);
297 int Vect_get_area_boundaries(struct Map_info *, int, struct ilist *);
298 
299 int Vect_get_isle_points(struct Map_info *, int, struct line_pnts *);
300 int Vect_get_isle_area(struct Map_info *, int);
301 int Vect_get_isle_boundaries(struct Map_info *, int, struct ilist *);
302 
303 int Vect_get_centroid_area(struct Map_info *, int);
304 
305 /* Level 2 update only */
307 int Vect_get_updated_line(struct Map_info *, int);
308 off_t Vect_get_updated_line_offset(struct Map_info *, int);
310 int Vect_get_updated_node(struct Map_info *, int);
311 void Vect_set_updated(struct Map_info *, int);
312 void Vect_reset_updated(struct Map_info *);
313 
314 /* History */
315 int Vect_hist_command(struct Map_info *);
316 int Vect_hist_write(struct Map_info *, const char *);
317 int Vect_hist_copy(struct Map_info *, struct Map_info *);
318 void Vect_hist_rewind(struct Map_info *);
319 char *Vect_hist_read(char *, int, struct Map_info *);
320 
321 /* Selecting features */
322 int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int,
323  struct boxlist *);
324 int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *,
325  struct boxlist *);
326 int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *,
327  struct boxlist *);
328 int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *,
329  struct ilist *);
330 int Vect_find_node(struct Map_info *, double, double, double, double, int);
331 int Vect_find_line(struct Map_info *, double, double, double, int, double, int,
332  int);
333 int Vect_find_line_list(struct Map_info *, double, double, double, int, double,
334  int, const struct ilist *, struct ilist *);
335 int Vect_find_area(struct Map_info *, double, double);
336 int Vect_find_island(struct Map_info *, double, double);
337 int Vect_select_lines_by_polygon(struct Map_info *, struct line_pnts *, int,
338  struct line_pnts **, int, struct ilist *);
339 int Vect_select_areas_by_polygon(struct Map_info *, struct line_pnts *, int,
340  struct line_pnts **, struct ilist *);
341 
342 /* Analysis */
343 int Vect_tin_get_z(struct Map_info *, double, double, double *, double *,
344  double *);
345 
346 /* int Vect_point_in_islands (struct Map_info *, int, double, double); */
347 int Vect_find_poly_centroid(const struct line_pnts *, double *, double *);
348 int Vect__intersect_line_with_poly(const struct line_pnts *, double,
349  struct line_pnts *);
350 int Vect_get_point_in_area(struct Map_info *, int, double *, double *);
351 int Vect_get_point_in_poly(const struct line_pnts *, double *, double *);
352 int Vect_get_point_in_poly_isl(const struct line_pnts *,
353  const struct line_pnts **, int, double *,
354  double *);
355 int Vect_point_in_area(double, double, struct Map_info *, int,
356  struct bound_box *);
357 int Vect_point_in_area_outer_ring(double, double, struct Map_info *, int,
358  struct bound_box *);
359 int Vect_point_in_island(double, double, struct Map_info *, int,
360  struct bound_box *);
361 int Vect_point_in_poly(double, double, const struct line_pnts *);
362 
363 /* Cleaning */
364 void Vect_break_lines(struct Map_info *, int, struct Map_info *);
365 int Vect_break_lines_list(struct Map_info *, struct ilist *, struct ilist *,
366  int, struct Map_info *);
367 int Vect_check_line_breaks(struct Map_info *, int, struct Map_info *);
368 int Vect_check_line_breaks_list(struct Map_info *, struct ilist *,
369  struct ilist *, int, struct Map_info *);
370 int Vect_merge_lines(struct Map_info *, int, int *, struct Map_info *);
371 void Vect_break_polygons(struct Map_info *, int, struct Map_info *);
372 void Vect_remove_duplicates(struct Map_info *, int, struct Map_info *);
373 int Vect_line_check_duplicate(const struct line_pnts *,
374  const struct line_pnts *, int);
375 void Vect_snap_lines(struct Map_info *, int, double, struct Map_info *);
376 void Vect_snap_lines_list(struct Map_info *, const struct ilist *, double,
377  struct Map_info *);
378 int Vect_snap_line(struct Map_info *, struct ilist *, struct line_pnts *,
379  double, int, int *, int *);
380 void Vect_remove_dangles(struct Map_info *, int, double, struct Map_info *);
381 void Vect_chtype_dangles(struct Map_info *, double, struct Map_info *);
382 void Vect_select_dangles(struct Map_info *, int, double, struct ilist *);
383 void Vect_remove_bridges(struct Map_info *, struct Map_info *, int *, int *);
384 void Vect_chtype_bridges(struct Map_info *, struct Map_info *, int *, int *);
385 int Vect_remove_small_areas(struct Map_info *, double, struct Map_info *,
386  double *);
387 int Vect_clean_small_angles_at_nodes(struct Map_info *, int, struct Map_info *);
388 
389 /* Overlay */
390 int Vect_overlay_str_to_operator(const char *);
391 int Vect_overlay(struct Map_info *, int, struct ilist *, struct ilist *,
392  struct Map_info *, int, struct ilist *, struct ilist *, int,
393  struct Map_info *);
394 int Vect_overlay_and(struct Map_info *, int, struct ilist *, struct ilist *,
395  struct Map_info *, int, struct ilist *, struct ilist *,
396  struct Map_info *);
397 
398 /* Graph */
399 void Vect_graph_init(dglGraph_s *, int);
401 void Vect_graph_add_edge(dglGraph_s *, int, int, double, int);
402 void Vect_graph_set_node_costs(dglGraph_s *, int, double);
403 int Vect_graph_shortest_path(dglGraph_s *, int, int, struct ilist *, double *);
404 
405 /* Network (graph) */
406 int Vect_net_build_graph(struct Map_info *, int, int, int, const char *,
407  const char *, const char *, int, int);
408 int Vect_net_ttb_build_graph(struct Map_info *, int, int, int, int, int,
409  const char *, const char *, const char *, int,
410  int);
411 int Vect_net_shortest_path(struct Map_info *, int, int, struct ilist *,
412  double *);
413 int Vect_net_ttb_shortest_path(struct Map_info *, int, int, int, int, int,
414  struct ilist *, double *);
416 int Vect_net_get_line_cost(struct Map_info *, int, int, double *);
417 int Vect_net_get_node_cost(struct Map_info *, int, double *);
418 int Vect_net_nearest_nodes(struct Map_info *, double, double, double, int,
419  double, int *, int *, int *, double *, double *,
420  struct line_pnts *, struct line_pnts *, double *);
421 int Vect_net_shortest_path_coor(struct Map_info *, double, double, double,
422  double, double, double, double, double,
423  double *, struct line_pnts *, struct ilist *,
424  struct ilist *, struct line_pnts *,
425  struct line_pnts *, double *, double *);
426 int Vect_net_ttb_shortest_path_coor(struct Map_info *, double, double, double,
427  double, double, double, double, double, int,
428  double *, struct line_pnts *,
429  struct ilist *, struct ilist *,
430  struct line_pnts *, struct line_pnts *,
431  double *, double *);
432 
433 /* Miscellaneous */
434 int Vect_topo_dump(struct Map_info *, FILE *);
435 double Vect_points_distance(double, double, double, double, double, double,
436  int);
437 int Vect_option_to_types(const struct Option *);
438 int Vect_copy_map_lines(struct Map_info *, struct Map_info *);
439 int Vect_copy_map_lines_field(struct Map_info *, int, struct Map_info *);
440 int Vect_copy(const char *, const char *, const char *);
441 int Vect_rename(const char *, const char *);
442 int Vect_copy_table(struct Map_info *, struct Map_info *, int, int,
443  const char *, int);
444 int Vect_copy_table_by_cat_list(struct Map_info *, struct Map_info *, int, int,
445  const char *, int, const struct cat_list *);
446 int Vect_copy_table_by_cats(struct Map_info *, struct Map_info *, int, int,
447  const char *, int, int *, int);
448 int Vect_copy_tables(struct Map_info *, struct Map_info *, int);
449 int Vect_delete(const char *);
450 int Vect_segment_intersection(double, double, double, double, double, double,
451  double, double, double, double, double, double,
452  double *, double *, double *, double *, double *,
453  double *, int);
455  struct bound_box *, struct bound_box *,
456  struct line_pnts ***, struct line_pnts ***, int *,
457  int *, int);
458 int Vect_line_intersection2(struct line_pnts *, struct line_pnts *,
459  struct bound_box *, struct bound_box *,
460  struct line_pnts ***, struct line_pnts ***, int *,
461  int *, int);
462 int Vect_line_check_intersection(struct line_pnts *, struct line_pnts *, int);
463 int Vect_line_check_intersection2(struct line_pnts *, struct line_pnts *, int);
464 int Vect_line_get_intersections(struct line_pnts *, struct line_pnts *,
465  struct line_pnts *, int);
466 int Vect_line_get_intersections2(struct line_pnts *, struct line_pnts *,
467  struct line_pnts *, int);
468 char *Vect_subst_var(const char *, struct Map_info *);
469 
470 /* Custom spatial index */
471 void Vect_spatial_index_init(struct spatial_index *, int);
473 void Vect_spatial_index_add_item(struct spatial_index *, int,
474  const struct bound_box *);
475 void Vect_spatial_index_del_item(struct spatial_index *, int,
476  const struct bound_box *);
477 int Vect_spatial_index_select(const struct spatial_index *,
478  const struct bound_box *, struct ilist *);
479 
480 /* GRASS ASCII vector format */
481 int Vect_read_ascii(FILE *, struct Map_info *);
482 int Vect_read_ascii_head(FILE *, struct Map_info *);
483 int Vect_write_ascii(FILE *, FILE *, struct Map_info *, int, int, int, char *,
484  int, int, int, const struct cat_list *, const char *,
485  const char **, int);
486 void Vect_write_ascii_head(FILE *, struct Map_info *);
487 
488 /* Simple Features */
489 SF_FeatureType Vect_sfa_get_line_type(const struct line_pnts *, int, int);
491 int Vect_sfa_check_line_type(const struct line_pnts *, int, SF_FeatureType,
492  int);
493 int Vect_sfa_line_dimension(int);
494 char *Vect_sfa_line_geometry_type(const struct line_pnts *, int);
495 int Vect_sfa_line_astext(const struct line_pnts *, int, int, int, FILE *);
496 int Vect_sfa_is_line_simple(const struct line_pnts *, int, int);
497 int Vect_sfa_is_line_closed(const struct line_pnts *, int, int);
498 int Vect_sfa_get_num_features(struct Map_info *);
499 
500 /*
501  * Internal functions, MUST NOT be used in modules
502  */
503 int Vect_print_header(struct Map_info *);
504 void Vect__init_head(struct Map_info *);
505 
506 /* Open/close/rewind map */
507 int Vect_coor_info(struct Map_info *, struct Coor_info *);
508 const char *Vect_maptype_info(struct Map_info *);
509 int Vect_maptype(struct Map_info *);
510 int Vect_open_topo(struct Map_info *, int);
511 int Vect_save_topo(struct Map_info *);
512 int Vect_open_sidx(struct Map_info *, int);
513 int Vect_save_sidx(struct Map_info *);
514 int Vect_sidx_dump(struct Map_info *, FILE *);
515 int Vect_build_sidx_from_topo(struct Map_info *);
516 int Vect_build_sidx(struct Map_info *);
517 int Vect_open_fidx(struct Map_info *, struct Format_info_offset *);
518 int Vect_save_fidx(struct Map_info *, struct Format_info_offset *);
519 int Vect_fidx_dump(struct Map_info *, FILE *);
520 int Vect_save_frmt(struct Map_info *);
521 
522 int Vect__write_head(struct Map_info *);
523 int Vect__read_head(struct Map_info *);
524 int V1_open_old_nat(struct Map_info *, int);
525 int V1_open_old_ogr(struct Map_info *, int);
526 int V1_open_old_pg(struct Map_info *, int);
527 int V2_open_old_ogr(struct Map_info *);
528 int V2_open_old_pg(struct Map_info *);
529 int V1_open_new_nat(struct Map_info *, const char *, int);
530 int V1_open_new_ogr(struct Map_info *, const char *, int);
531 int V1_open_new_pg(struct Map_info *, const char *, int);
532 int V1_rewind_nat(struct Map_info *);
533 int V1_rewind_ogr(struct Map_info *);
534 int V1_rewind_pg(struct Map_info *);
535 int V2_rewind_nat(struct Map_info *);
536 int V2_rewind_ogr(struct Map_info *);
537 int V2_rewind_pg(struct Map_info *);
538 int V1_close_nat(struct Map_info *);
539 int V1_close_ogr(struct Map_info *);
540 int V1_close_pg(struct Map_info *);
541 int V2_close_ogr(struct Map_info *);
542 int V2_close_pg(struct Map_info *);
543 
544 /* Read/write lines (internal use only) */
545 int V1_read_line_nat(struct Map_info *, struct line_pnts *, struct line_cats *,
546  off_t);
547 int V1_read_line_ogr(struct Map_info *, struct line_pnts *, struct line_cats *,
548  off_t);
549 int V1_read_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *,
550  off_t);
551 int V2_read_line_nat(struct Map_info *, struct line_pnts *, struct line_cats *,
552  int);
553 int V2_read_line_sfa(struct Map_info *, struct line_pnts *, struct line_cats *,
554  int);
555 int V2_read_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *,
556  int);
557 int V1_read_next_line_nat(struct Map_info *, struct line_pnts *,
558  struct line_cats *);
559 int V1_read_next_line_ogr(struct Map_info *, struct line_pnts *,
560  struct line_cats *);
561 int V1_read_next_line_pg(struct Map_info *, struct line_pnts *,
562  struct line_cats *);
563 int V2_read_next_line_nat(struct Map_info *, struct line_pnts *,
564  struct line_cats *);
565 int V2_read_next_line_ogr(struct Map_info *, struct line_pnts *,
566  struct line_cats *);
567 int V2_read_next_line_pg(struct Map_info *, struct line_pnts *,
568  struct line_cats *);
569 int V1_delete_line_nat(struct Map_info *, off_t);
570 int V1_delete_line_ogr(struct Map_info *, off_t);
571 int V1_delete_line_pg(struct Map_info *, off_t);
572 int V2_delete_line_nat(struct Map_info *, off_t);
573 int V2_delete_line_sfa(struct Map_info *, off_t);
574 int V2_delete_line_pg(struct Map_info *, off_t);
575 int V1_restore_line_nat(struct Map_info *, off_t, off_t);
576 int V2_restore_line_nat(struct Map_info *, off_t, off_t);
577 off_t V1_write_line_nat(struct Map_info *, int, const struct line_pnts *,
578  const struct line_cats *);
579 off_t V1_write_line_ogr(struct Map_info *, int, const struct line_pnts *,
580  const struct line_cats *);
581 off_t V1_write_line_pg(struct Map_info *, int, const struct line_pnts *,
582  const struct line_cats *);
583 off_t V2_write_line_nat(struct Map_info *, int, const struct line_pnts *,
584  const struct line_cats *);
585 off_t V2_write_line_sfa(struct Map_info *, int, const struct line_pnts *,
586  const struct line_cats *);
587 off_t V2_write_line_pg(struct Map_info *, int, const struct line_pnts *,
588  const struct line_cats *);
589 off_t V1_rewrite_line_nat(struct Map_info *, off_t, int,
590  const struct line_pnts *, const struct line_cats *);
591 off_t V1_rewrite_line_ogr(struct Map_info *, off_t, int,
592  const struct line_pnts *, const struct line_cats *);
593 off_t V1_rewrite_line_pg(struct Map_info *, off_t, int,
594  const struct line_pnts *, const struct line_cats *);
595 off_t V2_rewrite_line_nat(struct Map_info *, off_t, int,
596  const struct line_pnts *, const struct line_cats *);
597 off_t V2_rewrite_line_sfa(struct Map_info *, off_t, int,
598  const struct line_pnts *, const struct line_cats *);
599 off_t V2_rewrite_line_pg(struct Map_info *, off_t, int,
600  const struct line_pnts *, const struct line_cats *);
601 
602 /* Build topology */
603 int Vect_build_nat(struct Map_info *, int);
604 void Vect__build_downgrade(struct Map_info *, int);
605 int Vect__build_sfa(struct Map_info *, int);
606 int Vect_build_ogr(struct Map_info *, int);
607 int Vect_build_pg(struct Map_info *, int);
608 int Vect_build_line_area(struct Map_info *, int, int);
609 int Vect_isle_find_area(struct Map_info *, int, const struct bound_box *);
610 int Vect_attach_isle(struct Map_info *, int, const struct bound_box *);
611 int Vect_attach_isles(struct Map_info *, const struct bound_box *);
612 int Vect_attach_centroids(struct Map_info *, const struct bound_box *);
613 
614 /* GEOS support */
615 #ifdef HAVE_GEOS
616 GEOSGeometry *Vect_read_line_geos(struct Map_info *, int, int *);
617 GEOSGeometry *Vect_line_to_geos(const struct line_pnts *, int, int);
621 char *Vect_line_to_wkt(const struct line_pnts *, int, bool);
622 char *Vect_line_to_wkt2(const struct line_pnts *, int, bool, bool);
623 unsigned char *Vect_line_to_wkb(const struct line_pnts *, int, int, size_t *);
624 char *Vect_read_area_to_wkt(struct Map_info *, int);
625 char *Vect_read_area_to_wkt2(struct Map_info *, int, bool);
626 unsigned char *Vect_read_area_to_wkb(struct Map_info *, int, size_t *);
627 unsigned char *Vect_read_line_to_wkb(struct Map_info *, struct line_pnts *,
628  struct line_cats *, int, size_t *, int *);
629 #endif
630 
631 /* Raster color tables */
632 int Vect_read_colors(const char *, const char *, struct Colors *);
633 int Vect_remove_colors(const char *, const char *);
634 void Vect_write_colors(const char *, const char *, struct Colors *);
635 
636 /* Simplified RTree search using an ilist to store rectangle ids */
637 int RTreeSearch2(struct RTree *, struct RTree_Rect *, struct ilist *);
638 
639 #endif /* GRASS_VECTORDEFS_H */
int V1_open_old_ogr(struct Map_info *, int)
Open existing OGR layer on non-topological level.
Definition: open_ogr.c:43
int V2_rewind_ogr(struct Map_info *)
Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2)
Definition: rewind_ogr.c:61
void Vect_remove_dangles(struct Map_info *, int, double, struct Map_info *)
Remove dangles from vector map.
Definition: dangles.c:49
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
Definition: line.c:77
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.
Definition: sindex.c:220
dglGraph_s * Vect_net_get_graph(struct Map_info *)
Get graph structure.
Definition: net_analyze.c:397
void Vect_reset_dblinks(struct dblinks *)
Reset dblinks structure (number of fields)
Definition: field.c:101
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.
plus_t Vect_get_num_holes(struct Map_info *)
Fetch number of holes in vector map.
Definition: level_two.c:147
int Vect_sfa_get_num_features(struct Map_info *)
Get number of simple features.
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)
Definition: write_ogr.c:89
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)
int Vect_reset_boxlist(struct boxlist *)
Reset boxlist structure.
int Vect_get_line_nodes(struct Map_info *, int, int *, int *)
Get line nodes.
Definition: level_two.c:303
int Vect_cidx_open(struct Map_info *, int)
Read category index from cidx file if exists.
Definition: Vlib/cindex.c:523
int Vect_check_input_output_name(const char *, const char *, int)
Check for input and output vector map name.
Definition: legal_vname.c:93
int Vect_set_map_name(struct Map_info *, const char *)
Set map name in map header.
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)
Definition: write_sfa.c:52
int Vect_add_dblink(struct dblinks *, int, const char *, const char *, const char *, const char *, const char *)
Add new DB connection to dblinks structure.
Definition: field.c:285
plus_t Vect_get_num_islands(struct Map_info *)
Get number of islands in vector map.
Definition: level_two.c:135
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
Definition: level_two.c:274
int Vect_open_fidx(struct Map_info *, struct Format_info_offset *)
Open feature index file.
Definition: open_ogr.c:256
int Vect_sidx_dump(struct Map_info *, FILE *)
Dump spatial index to file.
Definition: build.c:1324
int Vect_cidx_save(struct Map_info *)
Save category index to binary file (cidx)
Definition: Vlib/cindex.c:478
int Vect_list_delete(struct ilist *, int)
Remove a given value (item) from list.
plus_t Vect_get_num_lines(struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
Definition: level_two.c:75
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.
Definition: read_nat.c:136
int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *, struct boxlist *)
Select isles with bounding boxes by box.
Definition: sindex.c:165
int Vect_net_get_line_cost(struct Map_info *, int, int, double *)
Returns in cost for given direction in *cost.
Definition: net_analyze.c:414
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.
int Vect_set_proj(struct Map_info *, int)
Set projection in map header.
int Vect_topo_check(struct Map_info *, struct Map_info *)
Extensive tests for correct topology.
Definition: build.c:604
const struct Format_info * Vect_get_finfo(struct Map_info *)
Get header info for non-native formats.
Definition: header_finfo.c:227
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
Definition: line.c:575
int Vect_attach_centroids(struct Map_info *, const struct bound_box *)
(Re)Attach centroids in given bounding box to areas
Definition: build.c:505
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.
Definition: Vlib/poly.c:449
const char * Vect_get_map_date(struct Map_info *)
Get date when the source map was originally produced from map header.
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.
Definition: break_lines.c:105
int Vect_coor_info(struct Map_info *, struct Coor_info *)
Update Coor_info structure.
int V1_open_new_pg(struct Map_info *, const char *, int)
int Vect_open_update(struct Map_info *, const char *, const char *)
Open existing vector map for reading/writing.
int Vect_cat_del(struct line_cats *, int)
Delete all categories of given layer.
plus_t Vect_get_num_areas(struct Map_info *)
Get number of areas in vector map.
Definition: level_two.c:87
int Vect_restore_line(struct Map_info *, off_t, off_t)
Restore previously deleted feature (topological level required)
int Vect_graph_shortest_path(dglGraph_s *, int, int, struct ilist *, double *)
Find shortest path.
int V1_delete_line_pg(struct Map_info *, off_t)
void Vect_write_ascii_head(FILE *, struct Map_info *)
Write data to GRASS ASCII vector format.
Definition: ascii.c:945
int Vect_read_dblinks(struct Map_info *)
Read dblinks to existing structure.
Definition: field.c:846
struct dblinks * Vect_new_dblinks_struct(void)
Create and init new dblinks structure.
Definition: field.c:52
int Vect_write_header(struct Map_info *)
Write vector map header to map head file.
int Vect_cat_in_cat_list(int, const struct cat_list *)
Check if category number is in list.
struct cat_list * Vect_new_cat_list(void)
Allocate memory for cat_list structure.
int Vect_build_sidx(struct Map_info *)
Create spatial index if necessary.
Definition: build.c:1231
int Vect_remove_small_areas(struct Map_info *, double, struct Map_info *, double *)
Remove small areas from the map map.
Definition: remove_areas.c:41
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.
Definition: geos_to_wktb.c:34
int Vect_open_old2(struct Map_info *, const char *, const char *, const char *)
Open existing vector map for reading.
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.
Definition: read_nat.c:178
int Vect_sfa_check_line_type(const struct line_pnts *, int, SF_FeatureType, int)
Check SF type.
int Vect_set_zone(struct Map_info *, int)
Set projection zone in map header.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
void Vect_line_parallel2(struct line_pnts *, double, double, double, int, int, double, struct line_pnts *)
Definition: buffer2.c:1191
int Vect_area_alive(struct Map_info *, int)
Check if area is alive or dead (topological level required)
struct field_info * Vect_default_field_info(struct Map_info *, int, const char *, int)
Get default information about link to database for new dblink.
Definition: field.c:358
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)
Definition: write_nat.c:45
int Vect_str_to_cat_list(const char *, struct cat_list *)
Converts string of categories and cat ranges separated by commas to cat_list.
const char * Vect_get_organization(struct Map_info *)
Get organization string from map header.
int Vect_cidx_get_unique_cats_by_index(struct Map_info *, int, struct ilist *)
Get list of unique categories for given layer index.
Definition: Vlib/cindex.c:288
int Vect_region_box(const struct Cell_head *, struct bound_box *)
Copy region window to bounding box.
int Vect_open_new(struct Map_info *, const char *, int)
Create new vector map for reading/writing.
int V2_rewind_nat(struct Map_info *)
Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format...
Definition: rewind_nat.c:40
int Vect_get_field_number(struct Map_info *, const char *)
Get field number of given field.
Definition: field.c:608
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.
Definition: line.c:751
int Vect_copy_map_lines(struct Map_info *, struct Map_info *)
Copy all alive vector features from input vector map to output vector map.
int Vect_cat_in_array(int, const int *, int)
Check if category is in ordered array of integers.
int V1_open_new_nat(struct Map_info *, const char *, int)
Create new vector map (level 1)
Definition: open_nat.c:97
void Vect_graph_init(dglGraph_s *, int)
Initialize graph structure.
int Vect_build_line_area(struct Map_info *, int, int)
Build area on given side of line (GV_LEFT or GV_RIGHT)
Definition: build.c:79
int Vect_point_in_island(double, double, struct Map_info *, int, struct bound_box *)
Determines if a point (X,Y) is inside an island.
Definition: Vlib/poly.c:923
int Vect_cats_in_constraint(struct line_cats *, int, struct cat_list *)
Check if categories match with category constraints.
int Vect_cidx_get_field_index(struct Map_info *, int)
Get layer index for given layer number.
Definition: Vlib/cindex.c:115
int Vect_map_check_dblink(struct Map_info *, int, const char *)
Check if DB connection exists in dblinks structure.
Definition: field.c:237
int Vect_map_del_dblink(struct Map_info *, int)
Delete db connection from Map_info structure.
Definition: field.c:160
int Vect_net_shortest_path(struct Map_info *, int, int, struct ilist *, double *)
Find shortest path.
Definition: net_analyze.c:380
int Vect_remove_colors(const char *, const char *)
Remove color table of raster map.
int Vect_option_to_types(const struct Option *)
Get types from options.
int Vect_find_island(struct Map_info *, double, double)
Find the nearest island.
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)
Definition: array.c:244
int Vect_get_updated_node(struct Map_info *, int)
Get updated (modified) node by index.
Definition: level_two.c:241
int Vect_get_next_line_id(struct Map_info *)
Get line id for sequential reading.
plus_t Vect_get_num_volumes(struct Map_info *)
Fetch number of volumes in vector map.
Definition: level_two.c:123
void Vect_hist_rewind(struct Map_info *)
Rewind history file.
Definition: hist.c:114
int V1_rewind_nat(struct Map_info *)
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native fo...
Definition: rewind_nat.c:27
const char * Vect_get_comment(struct Map_info *)
Get comment or other info string from map header.
int V1_read_next_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *)
int V1_open_old_nat(struct Map_info *, int)
Open existing vector map (level 1)
Definition: open_nat.c:40
void Vect_line_box(const struct line_pnts *, struct bound_box *)
Get bounding box of line.
Definition: line.c:888
int Vect_net_ttb_shortest_path(struct Map_info *, int, int, int, int, int, struct ilist *, double *)
Find shortest path on network.
Definition: net_analyze.c:260
GEOSCoordSequence * Vect_get_area_points_geos(struct Map_info *, int)
Returns the polygon array of points, i.e. outer ring (shell)
Definition: geos.c:411
char * Vect_read_area_to_wkt(struct Map_info *, int)
Read vector area and return it as Well Known Text (WKT) unsigned char array.
Definition: geos_to_wktb.c:71
int Vect_get_scale(struct Map_info *)
Get map scale from map header.
int Vect_open_tmp_old(struct Map_info *, const char *, const char *)
Open existing temporary vector map for reading.
int Vect_spatial_index_select(const struct spatial_index *, const struct bound_box *, struct ilist *)
Select items by bounding box to list.
int V2_open_old_pg(struct Map_info *)
int Vect_point_on_line(const struct line_pnts *, double, double *, double *, double *, double *, double *)
Find point on line in the specified distance.
Definition: line.c:413
void Vect_remove_constraints(struct Map_info *)
Remove all constraints.
Definition: constraint.c:122
void Vect_select_dangles(struct Map_info *, int, double, struct ilist *)
Select dangles from vector map.
Definition: dangles.c:98
int Vect_boxlist_delete_boxlist(struct boxlist *, const struct boxlist *)
Delete list from existing list.
const char * Vect_get_date(struct Map_info *)
Get date of digitization from map header.
double Vect_line_geodesic_length(const struct line_pnts *)
Calculate line length.
Definition: line.c:602
int V__map_overlap(struct Map_info *, double, double, double, double)
Definition: overlap.c:28
void Vect__build_downgrade(struct Map_info *, int)
Downgrade build level (for internal use only)
Definition: build.c:774
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.
Definition: Vlib/cindex.c:327
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.
Definition: net_analyze.c:1016
float Vect_get_node_line_angle(struct Map_info *, int, int)
Angle of segment of the line connected to the node.
Definition: level_two.c:412
int Vect_cidx_get_num_types_by_index(struct Map_info *, int)
Get number of feature types for given layer index.
Definition: Vlib/cindex.c:180
void Vect_graph_add_edge(dglGraph_s *, int, int, double, int)
Add edge to graph.
int Vect_build_pg(struct Map_info *, int)
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.
int Vect_get_line_type(struct Map_info *, int)
Get line type.
Definition: level_two.c:254
struct boxlist * Vect_new_boxlist(int)
Creates and initializes a struct boxlist.
int Vect_read_header(struct Map_info *)
Read vector map header from map head file.
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.
Definition: net_analyze.c:1052
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)
Definition: write_ogr.c:63
void Vect_write_colors(const char *, const char *, struct Colors *)
Write color table for vector map.
void Vect_chtype_bridges(struct Map_info *, struct Map_info *, int *, int *)
Change type of bridges in vector map.
Definition: bridges.c:69
int V2_read_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *, int)
int Vect_get_area_boundaries(struct Map_info *, int, struct ilist *)
Creates list of boundaries for given area.
const char * Vect_get_full_name(struct Map_info *)
Get fully qualified name of vector map.
void Vect_snap_lines_list(struct Map_info *, const struct ilist *, double, struct Map_info *)
Snap selected lines to existing vertex in threshold.
Definition: Vlib/snap.c:169
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.
Definition: geos_to_wktb.c:223
int Vect_tin_get_z(struct Map_info *, double, double, double *, double *, double *)
int Vect_rename(const char *, const char *)
Rename existing vector map (in the current mapset).
Definition: map.c:233
int Vect_find_poly_centroid(const struct line_pnts *, double *, double *)
Get centroid of polygon.
Definition: Vlib/poly.c:355
int Vect_copy_pnts_to_xyz(const struct line_pnts *, double *, double *, double *, int *)
Copy points from line structure to array.
Definition: line.c:380
void Vect_line_buffer(const struct line_pnts *, double, double, struct line_pnts *)
Create buffer around the line line.
Definition: buffer.c:381
int Vect_val_in_boxlist(const struct boxlist *, int)
Find a given item in the list.
int Vect_save_frmt(struct Map_info *)
Save format definition file for vector map.
int V2_delete_line_pg(struct Map_info *, off_t)
void Vect_line_reverse(struct line_pnts *)
Reverse the order of vertices.
Definition: line.c:898
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
void Vect_snap_lines(struct Map_info *, int, double, struct Map_info *)
Snap lines in vector map to existing vertex in threshold.
Definition: Vlib/snap.c:899
int Vect_cidx_get_field_number(struct Map_info *, int)
Get layer number for given index.
Definition: Vlib/cindex.c:98
int Vect_get_map_box(struct Map_info *, struct bound_box *)
Get bounding box of map (all features in the map)
int Vect_hist_command(struct Map_info *)
Write command info to history file.
Definition: hist.c:29
int Vect_read_colors(const char *, const char *, struct Colors *)
Read color table of vector map.
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.
Definition: intersect2.c:675
int Vect_box_extend(struct bound_box *, const struct bound_box *)
Extend box A by box B.
int Vect_find_line_list(struct Map_info *, double, double, double, int, double, int, const struct ilist *, struct ilist *)
Find the nearest line(s).
int Vect_get_map_box1(struct Map_info *, struct bound_box *)
Get bounding box of map on level 1 (all features in the map)
void Vect_destroy_boxlist(struct boxlist *)
Frees all memory associated with a struct boxlist, including the struct itself.
int Vect_get_area_cats(struct Map_info *, int, struct line_cats *)
Get area categories.
int Vect_overlay_and(struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *)
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)
off_t V2_write_line_pg(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
int Vect_cidx_get_num_fields(struct Map_info *)
Get number of layers in category index.
Definition: Vlib/cindex.c:81
int Vect_set_constraint_region(struct Map_info *, double, double, double, double, double, double)
Set constraint region.
Definition: constraint.c:48
int Vect_set_scale(struct Map_info *, int)
Set map scale in map header.
int Vect_get_isle_points(struct Map_info *, int, struct line_pnts *)
Returns polygon array of points for given isle.
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.
Definition: Vlib/snap.c:952
int Vect_get_area_points(struct Map_info *, int, struct line_pnts *)
Returns polygon array of points (outer ring) of given area.
char * Vect_sfa_line_geometry_type(const struct line_pnts *, int)
Get geometry type (string)
int Vect_get_centroid_area(struct Map_info *, int)
Get area id the centroid is within.
Definition: level_two.c:429
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)
Definition: write_sfa.c:152
int Vect_build_nat(struct Map_info *, int)
Build topology.
Definition: build_nat.c:34
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.
void Vect_destroy_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
int Vect_level(struct Map_info *)
Returns level that Map is opened at.
Definition: level.c:29
GEOSGeometry * Vect_read_line_geos(struct Map_info *, int, int *)
Read vector feature and stores it as GEOSGeometry instance.
Definition: geos.c:45
int Vect_open_tmp_update(struct Map_info *, const char *, const char *)
Open existing temporary vector map for reading/writing.
int V2_close_pg(struct Map_info *)
int Vect_read_ascii_head(FILE *, struct Map_info *)
Read header of GRASS ASCII vector format.
Definition: ascii.c:257
int Vect_close(struct Map_info *)
Close vector map.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_sfa_is_line_closed(const struct line_pnts *, int, int)
Check if feature is closed.
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.
Definition: Vlib/cindex.c:262
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.
int Vect_sfa_is_line_simple(const struct line_pnts *, int, int)
int Vect_isle_alive(struct Map_info *, int)
Check if isle is alive or dead (topological level required)
struct field_info * Vect_get_field2(struct Map_info *, const char *)
Get information about link to database (by layer number or layer name)
Definition: field.c:571
int Vect_get_constraint_box(struct Map_info *, struct bound_box *)
Get constraint box.
Definition: constraint.c:79
void Vect_cidx_find_all(struct Map_info *, int, int, int, struct ilist *)
Find all line/area id's for given category.
Definition: Vlib/cindex.c:373
int Vect_set_map_date(struct Map_info *, const char *)
Set date when the source map was originally produced in map header.
int Vect__build_sfa(struct Map_info *, int)
Build pseudo-topology (for simple features) - internal use only.
Definition: build_sfa.c:700
void Vect_set_category_index_update(struct Map_info *)
Set category index to be updated when vector is changed.
Definition: map.c:561
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.
Definition: read_nat.c:71
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)
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_copy_xyz_to_pnts(struct line_pnts *, const double *, const double *, const double *, int)
Copy points from array to line_pnts structure.
Definition: line.c:99
int V2_read_next_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *)
int Vect_set_comment(struct Map_info *, const char *)
Set comment or other info string in map header.
plus_t Vect_get_num_kernels(struct Map_info *)
Fetch number of kernels in vector map.
Definition: level_two.c:99
int Vect_get_point_in_poly(const struct line_pnts *, double *, double *)
Get point inside polygon.
Definition: Vlib/poly.c:208
int Vect_get_updated_line(struct Map_info *, int)
Get updated line by index.
Definition: level_two.c:191
int Vect_check_line_breaks(struct Map_info *, int, struct Map_info *)
Check for and count intersecting lines, do not break.
Definition: break_lines.c:82
void Vect_set_release_support(struct Map_info *)
Set spatial index to be released when vector is closed.
Definition: map.c:545
int V1_rewind_pg(struct Map_info *)
Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1)
Definition: rewind_pg.c:34
int Vect_copy(const char *, const char *, const char *)
Copy vector map including attribute tables.
Definition: map.c:125
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)
Definition: write_nat.c:67
void Vect_graph_build(dglGraph_s *)
Build network graph.
struct varray * Vect_new_varray(int)
Create new struct varray and allocate space for given number of items.
Definition: array.c:39
struct cat_list * Vect_cats_set_constraint(struct Map_info *, int, char *, char *)
Set category constraints using 'where' or 'cats' option and layer number.
void Vect_spatial_index_init(struct spatial_index *, int)
Initialize spatial index structure.
int Vect_get_num_updated_lines(struct Map_info *)
Get number of updated features.
Definition: level_two.c:175
void Vect_remove_duplicates(struct Map_info *, int, struct Map_info *)
Remove duplicate features from vector map.
int Vect_get_num_line_points(const struct line_pnts *)
Get number of line points.
Definition: line.c:267
int Vect_get_line_box(struct Map_info *, int, struct bound_box *)
Get bounding box of given feature.
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.
Definition: buffer2.c:1009
int V2_delete_line_nat(struct Map_info *, off_t)
Deletes feature at topological level (internal use only)
Definition: write_nat.c:290
int Vect_box_clip(double *, double *, double *, double *, const struct bound_box *)
Clip coordinates to box, if necessary, lines extending outside of a box.
int Vect_get_zone(struct Map_info *)
int Vect_get_area_isle(struct Map_info *, int, int)
Returns isle id for area.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int Vect_delete(const char *)
Delete vector map including attribute tables.
Definition: map.c:367
int Vect_write_dblinks(struct Map_info *)
Write dblinks to file.
Definition: field.c:878
int Vect_line_check_intersection(struct line_pnts *, struct line_pnts *, int)
Check if 2 lines intersect.
int Vect_line_distance(const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
Calculate distance of point to line.
Definition: line.c:648
int Vect_sfa_get_type(SF_FeatureType)
Get relevant GV type.
int Vect_net_build_graph(struct Map_info *, int, int, int, const char *, const char *, const char *, int, int)
Build network graph.
Definition: net_build.c:704
const char * Vect_get_column_names(struct Map_info *, int)
Fetches list of DB column names of vector map attribute table.
Definition: dbcolumns.c:37
int V1_close_nat(struct Map_info *)
Close vector map.
Definition: close_nat.c:34
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_save_topo(struct Map_info *)
Save topology file for vector map.
Definition: build.c:1016
int Vect_legal_filename(const char *)
Check if output is legal vector name.
Definition: legal_vname.c:32
int Vect_list_delete_list(struct ilist *, const struct ilist *)
Delete list from existing list.
int Vect_get_area_num_isles(struct Map_info *, int)
Returns number of isles for given area.
int Vect_attach_isle(struct Map_info *, int, const struct bound_box *)
(Re)Attach isle to area
Definition: build.c:385
int Vect_find_line(struct Map_info *, double, double, double, int, double, int, int)
Find the nearest line.
int V1_restore_line_nat(struct Map_info *, off_t, off_t)
Restores feature at level 1 (internal use only)
Definition: write_nat.c:350
int Vect_print_header(struct Map_info *)
Print vector map header to stdout.
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)
Definition: read_ogr.c:179
int Vect_list_append_list(struct ilist *, const struct ilist *)
Append new items to the end of list if not yet present.
int Vect_get_proj(struct Map_info *)
Get projection from map header.
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.
Definition: array.c:124
const char * Vect_get_finfo_format_info(struct Map_info *)
Get format info as string (relevant only for non-native formats)
Definition: header_finfo.c:110
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.
Definition: geos_to_wktb.c:285
int Vect_box_overlap(const struct bound_box *, const struct bound_box *)
Tests for overlap of two boxes.
int Vect_check_dblink(const struct dblinks *, int, const char *)
Check if DB connection exists in dblinks structure.
Definition: field.c:252
int Vect_open_tmp_new(struct Map_info *, const char *, int)
Create new temporary vector map.
int Vect_net_get_node_cost(struct Map_info *, int, double *)
Get cost of node.
Definition: net_analyze.c:468
int Vect_maptype(struct Map_info *)
Gets vector map format.
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.
Definition: break_lines.c:63
int Vect_point_in_poly(double, double, const struct line_pnts *)
Determines if a point (X,Y) is inside a polygon.
Definition: Vlib/poly.c:824
double Vect_points_distance(double, double, double, double, double, double, int)
Calculate distance of 2 points.
Definition: line.c:866
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.
Definition: geos_to_wktb.c:89
char * Vect_subst_var(const char *, struct Map_info *)
Substitute variable in string.
Definition: field.c:932
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.
Definition: Vlib/poly.c:854
void Vect_spatial_index_destroy(struct spatial_index *)
Destroy existing spatial index.
int Vect_cat_list_to_array(const struct cat_list *, int **, int *)
Convert cat_list struct to ordered array of unique integers.
double Vect_get_thresh(struct Map_info *)
Get threshold used for digitization from map header.
int Vect_open_update2(struct Map_info *, const char *, const char *, const char *)
Open existing vector map for reading/writing.
int Vect_line_alive(struct Map_info *, int)
Check if feature is alive or dead (topological level required)
plus_t Vect_get_num_primitives(struct Map_info *, int)
Get number of primitives in vector map.
Definition: level_two.c:47
int Vect_array_to_cat_list(const int *, int, struct cat_list *)
Convert ordered array of integers to cat_list structure.
void Vect_reset_updated(struct Map_info *)
Reset list of updated lines/nodes.
Definition: level_two.c:469
int Vect_get_line_cat(struct Map_info *, int, int)
Fetches FIRST category number for given vector line and field.
Definition: line.c:929
double Vect_get_area_perimeter(struct Map_info *, int)
Returns perimeter of area with perimeter of isles.
int Vect_get_area_box(struct Map_info *, int, struct bound_box *)
Get bounding box of area.
struct Map_info * Vect_new_map_struct(void)
Creates and initializes Map_info structure.
Definition: map.c:41
int Vect_isle_find_area(struct Map_info *, int, const struct bound_box *)
Find area outside island.
Definition: build.c:179
int Vect_cidx_get_num_cats_by_index(struct Map_info *, int)
Get number of categories for given layer index.
Definition: Vlib/cindex.c:161
int Vect_save_sidx(struct Map_info *)
Save spatial index file for vector map.
Definition: build.c:1270
int Vect_topo_dump(struct Map_info *, FILE *)
Dump topology to file.
Definition: build.c:1059
int Vect_overlay_str_to_operator(const char *)
Get operator code from string.
Definition: overlay.c:35
int Vect_boxlist_delete(struct boxlist *, int)
Remove a given value (item) from list.
GEOSGeometry * Vect_read_area_geos(struct Map_info *, int)
Read vector area and stores it as GEOSGeometry instance (polygon)
Definition: geos.c:84
int V1_delete_line_ogr(struct Map_info *, off_t)
Deletes feature at the given offset on level 1 (OGR interface)
Definition: write_ogr.c:119
int Vect_field_cat_del(struct line_cats *, int, int)
Delete field/cat from line_cats structure.
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)
Definition: write_nat.c:161
int Vect_copy_head_data(struct Map_info *, struct Map_info *)
Copy header data from one to another map.
Definition: init_head.c:77
void Vect_break_lines(struct Map_info *, int, struct Map_info *)
Break lines in vector map at each intersection.
Definition: break_lines.c:33
int Vect_cidx_get_num_unique_cats_by_index(struct Map_info *, int)
Get number of unique categories for given layer index.
Definition: Vlib/cindex.c:144
void Vect_spatial_index_del_item(struct spatial_index *, int, const struct bound_box *)
Delete item from spatial index structure.
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.
Definition: net_analyze.c:499
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)
Definition: write_nat.c:105
int Vect_sfa_line_dimension(int)
Get geometry dimension.
int Vect_hist_copy(struct Map_info *, struct Map_info *)
Copy history from one map to another.
Definition: hist.c:131
int Vect_get_isle_boundaries(struct Map_info *, int, struct ilist *)
Creates list of boundaries for given isle.
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.
void Vect_line_parallel(struct line_pnts *, double, double, int, struct line_pnts *)
Create parallel line.
Definition: buffer.c:353
int Vect_set_constraint_field(struct Map_info *, int)
Set constraint field.
Definition: constraint.c:147
int Vect_clean_small_angles_at_nodes(struct Map_info *, int, struct Map_info *)
Clean small angles at nodes.
Definition: clean_nodes.c:33
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.
Definition: ascii.c:337
int Vect__read_head(struct Map_info *)
Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only.
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
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.
Definition: buffer2.c:1074
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).
Definition: read_ogr.c:49
int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *, struct boxlist *)
Select areas with bounding boxes by box.
Definition: sindex.c:121
int Vect_open_old(struct Map_info *, const char *, const char *)
Open existing vector map for reading.
int Vect_point_in_box_2d(double, double, const struct bound_box *)
Tests if point is in 2D box.
int Vect_set_organization(struct Map_info *, const char *)
Set organization string in map header.
int Vect_get_num_dblinks(struct Map_info *)
Get number of defined dblinks.
Definition: level_two.c:159
int Vect_build_ogr(struct Map_info *, int)
Build pseudo-topology (simple features) for OGR layer.
Definition: build_ogr.c:49
int Vect_get_point_in_area(struct Map_info *, int, double *, double *)
Get point inside area and outside all islands.
Definition: Vlib/poly.c:55
int Vect_line_check_duplicate(const struct line_pnts *, const struct line_pnts *, int)
Check for duplicate lines.
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.
Definition: line.c:176
void Vect_graph_set_node_costs(dglGraph_s *, int, double)
Set node costs.
int Vect_point_in_area(double, double, struct Map_info *, int, struct bound_box *)
Check if point is in area.
int Vect_get_area_cat(struct Map_info *, int, int)
Find FIRST category of given field and area.
int V1_rewind_ogr(struct Map_info *)
Rewind vector map (OGR layer) to cause reads to start at beginning (level 1)
Definition: rewind_ogr.c:32
int Vect_save_fidx(struct Map_info *, struct Format_info_offset *)
Save feature index file for vector map.
Definition: build_ogr.c:116
void Vect_copy_map_dblinks(struct Map_info *, struct Map_info *, int)
Copy DB links from input vector map to output vector map.
Definition: field.c:205
const char * Vect_maptype_info(struct Map_info *)
Gets vector map format (as string)
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
plus_t Vect_get_num_faces(struct Map_info *)
Get number of faces in vector map.
Definition: level_two.c:111
int Vect__intersect_line_with_poly(const struct line_pnts *, double, struct line_pnts *)
struct field_info * Vect_get_field(struct Map_info *, int)
Get information about link to database (by layer number)
Definition: field.c:515
int Vect_build(struct Map_info *)
Build topology for vector map.
Definition: build.c:586
void Vect_destroy_field_info(struct field_info *)
Free a struct field_info and all memory associated with it.
Definition: field.c:633
off_t Vect_get_updated_line_offset(struct Map_info *, int)
Get updated line offset by index.
Definition: level_two.c:207
int Vect_set_date(struct Map_info *, const char *)
Set date of digitization in map header.
int V1_close_ogr(struct Map_info *)
Close vector map (OGR dsn & layer) on level 1.
Definition: close_ogr.c:35
int Vect_merge_lines(struct Map_info *, int, int *, struct Map_info *)
Merge lines or boundaries in vector map.
Definition: merge_lines.c:79
int Vect_build_partial(struct Map_info *, int)
Build partial topology for vector map.
Definition: build.c:864
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
Definition: line.c:45
const char * Vect_get_finfo_geometry_type(struct Map_info *)
Get geometry type as string (relevant only for non-native formats)
Definition: header_finfo.c:145
int Vect_read_ascii(FILE *, struct Map_info *)
Read data in GRASS ASCII vector format.
Definition: ascii.c:42
int Vect_cidx_get_type_count(struct Map_info *, int, int)
Get count of features of certain type by layer and type.
Definition: Vlib/cindex.c:223
struct field_info * Vect_get_dblink(struct Map_info *, int)
Get information about link to database.
Definition: field.c:475
const char * Vect_get_person(struct Map_info *)
Get user name string who digitized the map from map header.
int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int, struct boxlist *)
Select lines with bounding boxes by box.
Definition: sindex.c:32
SF_FeatureType Vect_sfa_get_line_type(const struct line_pnts *, int, int)
Get SF type of given vector feature.
int Vect_get_num_updated_nodes(struct Map_info *)
Get number of updated nodes.
Definition: level_two.c:219
int Vect_cidx_dump(struct Map_info *, FILE *)
Write (dump) category index in text form to file.
Definition: Vlib/cindex.c:420
int Vect_boxlist_append_boxlist(struct boxlist *, const struct boxlist *)
Append new items to the end of list if not yet present.
void Vect_remove_bridges(struct Map_info *, struct Map_info *, int *, int *)
Remove bridges from vector map.
Definition: bridges.c:48
off_t Vect_get_line_offset(struct Map_info *, int)
Get feature offset (topological level required)
char * Vect_line_to_wkt(const struct line_pnts *, int, bool)
Create a Well Known Text (WKT) representation of given feature type from points.
Definition: geos_to_wktb.c:259
int Vect_get_isle_box(struct Map_info *, int, struct bound_box *)
Get bounding box of isle.
int Vect_open_sidx(struct Map_info *, int)
Open spatial index file ('sidx')
int Vect_val_in_list(const struct ilist *, int)
Find a given item in the list.
void Vect_chtype_dangles(struct Map_info *, double, struct Map_info *)
Change boundary dangles to lines.
Definition: dangles.c:74
int Vect_get_node_n_lines(struct Map_info *, int)
Get number of lines for node.
Definition: level_two.c:380
int Vect_boxlist_append(struct boxlist *, int, const struct bound_box *)
Append new item to the end of list if not yet present.
plus_t Vect_get_num_nodes(struct Map_info *)
Get number of nodes in vector map.
Definition: level_two.c:34
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.
Definition: array.c:79
void Vect_destroy_cat_list(struct cat_list *)
Frees allocated cat_list memory.
int V2_rewind_pg(struct Map_info *)
Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2)
Definition: rewind_pg.c:70
const char * Vect_get_column_types(struct Map_info *, int)
Fetches list of DB column types of vector map attribute table.
Definition: dbcolumns.c:92
int Vect_get_area_centroid(struct Map_info *, int)
Returns centroid id for given area.
void Vect__init_head(struct Map_info *)
Initialize Map_info head structure (dig_head)
Definition: init_head.c:29
int Vect_find_node(struct Map_info *, double, double, double, double, int)
Find the nearest node.
char * Vect_hist_read(char *, int, struct Map_info *)
Reads one line from history file without newline character.
Definition: hist.c:90
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.
Definition: field.c:120
int V1_close_pg(struct Map_info *)
int Vect_build_sidx_from_topo(struct Map_info *)
Create spatial index from topology if necessary (not longer supported)
Definition: build.c:1251
int V2_read_next_line_ogr(struct Map_info *, struct line_pnts *, struct line_cats *)
Read next feature from OGR layer on topological level.
Definition: read_ogr.c:75
int Vect_line_delete_point(struct line_pnts *, int)
Delete point at given index and move all points above down.
Definition: line.c:210
int Vect_node_alive(struct Map_info *, int)
Check if node is alive or dead (topological level required)
void Vect_reset_line(struct line_pnts *)
Reset line.
Definition: line.c:129
char * Vect_get_finfo_layer_name(struct Map_info *)
Get layer name (relevant only for non-native formats)
Definition: header_finfo.c:74
int Vect_rewind(struct Map_info *)
Rewind vector map to cause reads to start at beginning.
const char * Vect_get_proj_name(struct Map_info *)
Query cartographic projection name of pointer to Map_info structure.
int V1_open_new_ogr(struct Map_info *, const char *, int)
Prepare OGR datasource for creating new OGR layer (level 1)
Definition: open_ogr.c:182
int V1_read_line_pg(struct Map_info *, struct line_pnts *, struct line_cats *, off_t)
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.
Definition: geos_to_wktb.c:146
int Vect_fidx_dump(struct Map_info *, FILE *)
Dump feature index to file.
Definition: build_sfa.c:750
const char * Vect_get_name(struct Map_info *)
Get name of vector map.
int Vect_get_node_line(struct Map_info *, int, int)
Get line id for node line index.
Definition: level_two.c:396
int Vect_attach_isles(struct Map_info *, const struct bound_box *)
(Re)Attach isles in given bounding box to areas
Definition: build.c:427
int Vect_read_next_line(struct Map_info *, struct line_pnts *, struct line_cats *)
Read next vector feature.
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.
Definition: read_nat.c:43
int Vect__write_head(struct Map_info *)
Writes head information to text file (GV_HEAD_ELEMENT)
void Vect_destroy_map_struct(struct Map_info *)
Frees all memory associated with a Map_info structure, including the structure itself.
Definition: map.c:61
int Vect_line_segment(const struct line_pnts *, double, double, struct line_pnts *)
Create line segment.
Definition: line.c:517
int Vect_hist_write(struct Map_info *, const char *)
Write string to history file.
Definition: hist.c:65
int Vect_sfa_line_astext(const struct line_pnts *, int, int, int, FILE *)
Export geometry to Well-Known Text.
void Vect_point_buffer2(double, double, double, double, double, int, double, struct line_pnts **)
Creates buffer around the point (px, py).
Definition: buffer2.c:1141
int V2_restore_line_nat(struct Map_info *, off_t, off_t)
Restores feature at topological level (internal use only)
Definition: write_nat.c:398
double Vect_get_area_area(struct Map_info *, int)
Returns area of area without areas of isles.
GEOSGeometry * Vect_line_to_geos(const struct line_pnts *, int, int)
Create GEOSGeometry of given type from feature points.
Definition: geos.c:137
int Vect_net_ttb_build_graph(struct Map_info *, int, int, int, int, int, const char *, const char *, const char *, int, int)
int V2_open_old_ogr(struct Map_info *)
Open existing OGR layer on topological level.
Definition: open_ogr.c:145
int Vect_line_check_intersection2(struct line_pnts *, struct line_pnts *, int)
Check if 2 lines intersect.
Definition: intersect2.c:1540
int Vect_set_constraint_type(struct Map_info *, int)
Set constraint type.
Definition: constraint.c:106
int Vect_point_in_box(double, double, double, const struct bound_box *)
Tests if point is in 3D box.
void Vect_spatial_index_add_item(struct spatial_index *, int, const struct bound_box *)
Add a new item to spatial index structure.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
Definition: line.c:279
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
const char * Vect_get_mapset(struct Map_info *)
Get name of mapset where vector map lives.
int V1_delete_line_nat(struct Map_info *, off_t)
Deletes feature at level 1 (internal use only)
Definition: write_nat.c:248
int Vect_get_line_areas(struct Map_info *, int, int *, int *)
Get area id on the left and right side of the boundary.
Definition: level_two.c:346
const char * Vect_get_finfo_dsn_name(struct Map_info *)
Get datasource name (relevant only for non-native formats)
Definition: header_finfo.c:37
int RTreeSearch2(struct RTree *, struct RTree_Rect *, struct ilist *)
Definition: rtree_search.c:40
struct field_info * Vect_get_field_by_name(struct Map_info *, const char *)
Get information about link to database (by layer name)
Definition: field.c:541
GEOSCoordSequence * Vect_get_isle_points_geos(struct Map_info *, int)
Returns the polygon (isle) array of points (inner ring)
Definition: geos.c:442
int Vect_field_cat_get(const struct line_cats *, int, struct ilist *)
Get list of categories of given field.
int Vect_set_person(struct Map_info *, const char *)
Set name of user who digitized the map in map header.
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.
Definition: Vlib/cindex.c:200
int Vect_line_prune_thresh(struct line_pnts *, double)
Remove points in threshold.
Definition: line.c:309
int Vect_set_thresh(struct Map_info *, double)
Set threshold used for digitization in map header.
int Vect_set_open_level(int)
Predetermine level at which a vector map will be opened for reading.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int V2_close_ogr(struct Map_info *)
Close vector map on topological level (write out fidx file)
Definition: close_ogr.c:90
int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *, struct ilist *)
Select nodes by box.
Definition: sindex.c:187
void Vect_set_error_handler_io(struct Map_info *, struct Map_info *)
Define standard error handler for input and output vector maps.
int Vect_is_3d(struct Map_info *)
Check if vector map is 3D.
int Vect_open_old_head(struct Map_info *, const char *, const char *)
Reads only info about vector map (headers)
int Vect_line_get_point(const struct line_pnts *, int, double *, double *, double *)
Get line point of given index.
Definition: line.c:244
void Vect_set_updated(struct Map_info *, int)
Enable/disable maintenance of list of updated lines/nodes.
Definition: level_two.c:454
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
Definition: line.c:148
const char * Vect_get_map_name(struct Map_info *)
Get map name from map header.
void Vect_break_polygons(struct Map_info *, int, struct Map_info *)
Break polygons in vector map.
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.
Definition: overlay.c:62
int Vect_line_get_intersections2(struct line_pnts *, struct line_pnts *, struct line_pnts *, int)
Get 2 lines intersection points.
Definition: intersect2.c:1562
int Vect_append_points(struct line_pnts *, const struct line_pnts *, int)
Appends points to the end of a line.
Definition: line.c:335
int Vect_copy_tables(struct Map_info *, struct Map_info *, int)
Copy attribute tables linked to vector map.
off_t V2_rewrite_line_pg(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
int Vect_find_area(struct Map_info *, double, double)
Find the nearest area.
int Vect_open_old_head2(struct Map_info *, const char *, const char *, const char *)
Reads only info about vector map (headers)
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.
Definition: sindex.c:317
int V2_read_line_sfa(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Reads feature from OGR/PostGIS layer on topological level.
Definition: read_sfa.c:40
int V2_delete_line_sfa(struct Map_info *, off_t)
Deletes feature on level 2 (OGR/PostGIS interface)
Definition: write_sfa.c:193
int Vect_line_get_intersections(struct line_pnts *, struct line_pnts *, struct line_pnts *, int)
Get 2 lines intersection points.
void Vect_set_db_updated(struct Map_info *)
Rewrite 'dbln' file.
Definition: field.c:991
int Vect_get_built(struct Map_info *)
Return current highest built level (part)
Definition: build.c:760
int Vect_get_isle_area(struct Map_info *, int)
Returns area id for isle.
int Vect_box_copy(struct bound_box *, const struct bound_box *)
Copy box B to box A.
int V1_open_old_pg(struct Map_info *, int)
int Vect_open_topo(struct Map_info *, int)
Open topology file ('topo')
int Vect_get_finfo_topology_info(struct Map_info *, char **, char **, int *)
Get topology type (relevant only for non-native formats)
Definition: header_finfo.c:250
const char * Vect_get_column_names_types(struct Map_info *, int)
Fetches list of DB column names and types of vector map attribute table.
Definition: dbcolumns.c:149
off_t V1_write_line_pg(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
off_t V1_rewrite_line_pg(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
SF_FeatureType
Simple feature types.
Definition: dig_defines.h:239
int plus_t
plus_t size
Definition: dig_structs.h:41
2D/3D raster map header (used also for region)
Definition: gis.h:440
Definition: gis.h:686
Coor file info.
Definition: dig_structs.h:371
Data structure used for building pseudo-topology.
Definition: dig_structs.h:388
Non-native format info (currently only OGR is implemented)
Definition: dig_structs.h:700
Vector map info.
Definition: dig_structs.h:1243
Structure that stores option information.
Definition: gis.h:557
Definition: rtree.h:123
Bounding box.
Definition: dig_structs.h:64
List of bounding boxes with id.
Definition: dig_structs.h:1723
Category list.
Definition: dig_structs.h:1697
Layer (old: field) information.
Definition: dig_structs.h:131
List of integers.
Definition: gis.h:709
Feature category info.
Definition: dig_structs.h:1677
Feature geometry info - coordinates.
Definition: dig_structs.h:1651
Spatial index info.
Definition: dig_structs.h:1770
Vector array.
Definition: dig_structs.h:1751
struct GEOSCoordSeq_t GEOSCoordSequence
Definition: vector.h:10
struct GEOSGeom_t GEOSGeometry
Definition: vector.h:9