vectorlib.dox 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316
  1. /*! \page vectorlib GRASS Vector Library
  2. by GRASS Development Team (http://grass.osgeo.org)
  3. <b>Table of contents</b>
  4. - \subpage background
  5. - \subpage intro
  6. - \subpage vector_map
  7. - \subpage directory_structure
  8. - \subpage head_file_format
  9. - \subpage categories_layers
  10. - \subpage attributes
  11. - \subpage dbln_file_format
  12. - \subpage vlibs
  13. - \subpage vlib_structures
  14. - \subpage Map_info
  15. - \subpage Plus_head
  16. - \subpage dig_head
  17. - \subpage feature_geom
  18. - \subpage ftypes
  19. - \subpage coor_file_format
  20. - \subpage coor_file_head
  21. - \subpage coor_file_body
  22. - \subpage topology_management
  23. - \subpage topo_file_format
  24. - \subpage topo_file_header
  25. - \subpage topo_file_body
  26. - \subpage topo_levels
  27. - \subpage topo_examples
  28. - \subpage topo_memory
  29. - \subpage spidx
  30. - \subpage sidx_file_format
  31. - \subpage cidx
  32. - \subpage cidx_file_format
  33. - \subpage cidx_file_head
  34. - \subpage tin
  35. - \subpage ogr_iface
  36. - \subpage frmt_file_format
  37. - \subpage fidx_file_format
  38. - \subpage grassdglib
  39. - \subpage ascii
  40. - \subpage vlibfunc
  41. - \subpage authors
  42. - \subpage references
  43. - \subpage seealso
  44. \section background Background
  45. Generally, the vector data model is used to describe geographic
  46. phenomena which may be represented by geometric entities like points,
  47. lines, and areas. The GRASS vector data model includes the description
  48. of topology, where besides the coordinates describing the location of
  49. the primitives (points, lines, boundaries, centroids, faces, and
  50. kernels), their spatial relations are also stored. In general,
  51. topological GIS requires a data structure where the common boundary
  52. between two adjacent areas is stored as a single line, simplifying the
  53. vector data maintenance.
  54. \section intro Introduction
  55. The GRASS 6/7 vector format is very similar to the previous GRASS 4.x
  56. (5.0/5.3) vector format.
  57. This description covers the new GRASS 6 vector library architecture.
  58. This new architecture overcomes the vector limitations of GRASS
  59. 4.x-5.4.x by extending the vector support with attributes stored in
  60. the external relational databases, and by new 3D capabilities. Besides
  61. internal file based storage the geometry may alternatively be stored
  62. in a PostGIS database (accessible via OGR interface). This enables
  63. users to maintain large data sets with simultaneous write
  64. access. External GIS formats such as SHAPE-files may be used directly,
  65. without requiring format conversion.
  66. The current implementation includes:
  67. - <b>multi-layer</b>: features in one vector map may represent more
  68. layers and may be linked to more external tables (see \ref
  69. categories_layers);
  70. - 2D and 3D vector geometry with full topology support for 2D and
  71. partial topology support for 3D (see \ref topology_management);
  72. - <b>multi-format</b>: external data formats supported (SHAPE-file,
  73. OGR sources etc.);
  74. - <b>portability</b>: platform independent internal format, read- and
  75. writable on 32bit, 64bit etc. computer architectures;
  76. - integrated \ref dglib - support for vector network analysis;
  77. - <b>spatial index</b>: based on R-tree method for fast vector
  78. geometry access (see \ref spidx);
  79. - <b>multi-attribute</b>: attributes saved in external Relational
  80. Database Management System (RDBMS) connected through DBMI
  81. library and drivers (\ref attributes);
  82. \subsection vector_map Vector map
  83. GRASS vector maps are stored in an <em>arc-node</em> representation,
  84. consisting of curves called arcs. An arc is stored as a series of
  85. x,y,z coordinate pairs. The two endpoints of an arc are called
  86. <em>nodes</em>. Two consecutive x,y,z pairs define an arc segment. The
  87. user specifies the type of input to GRASS; GRASS doesn't decide. GRASS
  88. allows for the feature definition which allows for multiple types to
  89. co-exist in the same map. Centroid are assigned to area it is
  90. within/inside (geometrically). An area is identified by an x,y,z
  91. centroid point geometrically inside with a category number (ID). This
  92. identifies the area. Such centroids are stored in the same binary
  93. 'coor' file with other primitives. Each element may have none, one or
  94. more categories (cats). More cats are distinguished by field number
  95. (field, called "layer" at user level). Single and multi-category
  96. support on modules level are implemented. Z-coordinate is optional and
  97. both 2D and 3D files may be written.
  98. The following vector features are defined (see \ref ftypes):
  99. - point: a point;
  100. - line: a directed sequence of connected vertices with two endpoints called nodes;
  101. - boundary: the border line to describe an area;
  102. - centroid: a point within a closed boundary;
  103. - area: the topological composition of centroid and boundary;
  104. - face: a 3D area;
  105. - kernel: a 3D centroid in a volume;
  106. - volume: a 3D corpus, the topological composition of faces and kernel.
  107. Note that all lines and boundaries can consist of multiple segments.
  108. Topology also holds information about isles. Isles are located within an area, not
  109. touching the boundaries of the outer area. Isles consist of one or more areas
  110. and are used internally by the vector libraries to maintain correct topology of areas.
  111. \subsubsection directory_structure Directory structure
  112. Vector map is stored in a number of data files. Vector map directory
  113. structure and file names were changed in GRASS 6 with respect to
  114. previous GRASS versions. All vector files for one vector map are
  115. stored in one directory:
  116. \verbatim
  117. $MAPSET/vector/vector_name/
  118. \endverbatim
  119. This directory contains these files:
  120. - <b>coor</b> - binary file, coordinates [former dig/ file] (see \ref coor_file_format)
  121. - <b>topo</b> - binary file, topology [former dig_plus/ file] (see \ref topo_file_format)
  122. - <b>sidx</b> - binary file, spatial index (see \ref sidx_file_format)
  123. - <b>cidx</b> - binary file, category index (see \ref cidx_file_format)
  124. - <b>head</b> - text file, header information [former part of dig/ file] (see \ref head_file_format)
  125. - <b>dbln</b> - text file, link(s) to attribute table(s) (see \ref dbln_file_format)
  126. - <b>hist</b> - text file, vector map change history
  127. - <b>frmt</b> - text file, format description (external format only)
  128. - <b>fidx</b> - binary file, feature index (OGR format only)
  129. \subsubsection head_file_format Head file format specification
  130. The header contains historical information, a description of the
  131. vector map and many other information. The file is an unordered list
  132. of key/value entries. The <i>key</i> is a string separated from
  133. <i>value</i> by a colon and optional whitespace. Keywords are:
  134. <table border="1" style="border-collapse: collapse">
  135. <tr><td>ORGANIZATION</td><td>organization that digitized the data</td></tr>
  136. <tr><td>DIGIT DATE</td><td>date the data was digitized</td></tr>
  137. <tr><td>DIGIT NAME</td><td>person who digitized the data</td></tr>
  138. <tr><td>MAP NAME</td><td>title of the original source map</td></tr>
  139. <tr><td>MAP DATE</td><td>date of the original source map</td></tr>
  140. <tr><td>MAP SCALE</td><td>scale of the original source map</td></tr>
  141. <tr><td>OTHER INFO</td><td>other comments about the map</td></tr>
  142. <tr><td>ZONE</td><td>zone of the map (e.g., UTM zone)</td></tr>
  143. <tr><td>MAP THRESH</td><td>digitizing threshold</td></tr>
  144. </table>
  145. \subsection categories_layers Categories and layers
  146. <i>Note: "layer" was called "field" in earlier version.</i>
  147. In GRASS, a "category" or "category number" is a vector feature ID
  148. used to link geometry to attributes which are stored in one or several
  149. (external) database table(s). This category number is stored into the
  150. vector geometry as well as a "cat" column (integer type) in each
  151. attribute database table. The category number is used to lookup an
  152. attribute assigned to a vector object. At user level, category numbers
  153. can be assigned to vector objects with the <tt>v.category</tt> command.
  154. In order to assign multiple attributes in different tables to vector
  155. objects, each map can hold multiple category numbers. This is achieved
  156. by assigning more than one "layer" to the map (<tt>v.db.connect</tt>
  157. command). The layer number determines which table to be used for
  158. attribute queries. For example, a cadastrial vector area map can be
  159. assigned on layer 1 to an attribute table containing landuse
  160. descriptions which are maintained by department A while layer 2 is
  161. assigned to an attribute table containing owner descriptions which are
  162. maintained by department B.
  163. Each vector feature inside a vector map has zero, one or more
  164. &lt;layer,category&gt; tuple(s). A user can (but not must) create
  165. attribute tables which are referenced by the layer, and rows which are
  166. essentially referenced by the &lt;layer,category&gt; pair.
  167. Categories start with 1 (category '0' is allowed for OGR
  168. layers). Categories do not have to be continuous.
  169. \subsection attributes Attributes
  170. The old GRASS 4.x 'dig_cats' files are not used any more and vectors'
  171. attributes are stored in external database. Connection with the
  172. database is done through drivers based on \ref dbmilib. Records in a
  173. table are linked to vector entities by layer and category number. The
  174. layer identifies table and the category identifies record. I.e., for
  175. any unique combination
  176. \verbatim
  177. map+mapset+layer+category
  178. \endverbatim
  179. there exists one unique combination
  180. \verbatim
  181. driver+database+table+row
  182. \endverbatim
  183. Information about database links holds <tt>dblinks</tt> structure.
  184. \code
  185. struct dblinks
  186. {
  187. struct field_info *field; /* pointer to the first field_info structure */
  188. int alloc_fields; /* number of allocated slots */
  189. int n_fields; /* number of available fields */
  190. };
  191. \endcode
  192. The general DBMI settings are defined in the '$MAPSET/VAR' text file
  193. (maintained with <tt>db.connect</tt> command at user level).
  194. \subsection dbln_file_format Dbln file format specification
  195. Each vector maps has its own DBMI settings stored in the
  196. '$MAPSET/vector/vector_name/dbln' text file. For each pair <b>vector map +
  197. layer</b>, all of <b>table, key column, database, driver</b> must be
  198. defined in a new row. This definition must be written to
  199. '$MAPSET/vector/vector_name/dbln' text file. Each row in the 'dbln'
  200. file contains names separated by spaces in following order ([ ] -
  201. optional):
  202. \verbatim
  203. map[@mapset] layer table [key [database [driver]]]
  204. \endverbatim
  205. If key, database or driver are omitted (on second and higher row only)
  206. the last definition is used. When reading a vector map from another
  207. mapset (if mapset is specified along with map name), definitions in
  208. the related "dbln" file may overwrite the DBMI definition in the
  209. current mapset. This means that the map-wise definition is always
  210. "stronger".
  211. Wild cards <b>*</b> and <b>?</b> may be used in map and mapset names.
  212. Variables $GISDBASE, $LOCATION_NAME, $MAPSET, and $MAP may be used in
  213. table, key, database and driver names (function
  214. Vect_subst_var()). Note that $MAPSET is not the current mapset but
  215. mapset of the map the rule is defined for.
  216. Note that vector features in GRASS vector maps may have attributes in
  217. different tables or may be without attributes. Boundaries form areas
  218. but it may happen that some boundaries are not closed (such boundaries
  219. would not appear in polygon layer). Boundaries may have
  220. attributes. All types may be mixed in one vector map.
  221. The link to the table is permanent and it is stored in 'dbln' file in
  222. vector directory. Tables are considered to be a part of the vector and
  223. the command <tt>g.remove</tt>, for example, deletes linked tables of
  224. the vector. Attributes must be joined with geometry.
  225. <b>Examples:</b>
  226. Examples are written mostly for the DBF driver, where database is full
  227. path to the directory with dbf files and table name is the name of dbf
  228. file without .dbf extension:
  229. \verbatim
  230. * 1 mytable id $GISDBASE/$LOCATION_NAME/$MAPSET/vector/$MAP dbf
  231. \endverbatim
  232. This definition says that entities with category of layer 1 are linked
  233. to dbf tables with names "mytable.dbf" saved in vector directories of
  234. each map. The attribute column containing the category numbers is
  235. called "id".
  236. \verbatim
  237. * 1 $MAP id $GISDBASE/$LOCATION_NAME/$MAPSET/dbf dbf
  238. \endverbatim
  239. Similar as above but all dbf files are in one directory dbf/ in mapset
  240. and names of dbf files are $MAP.dbf
  241. \verbatim
  242. water* 1 rivers id /home/grass/dbf dbf
  243. water* 2 lakes lakeid /home/guser/mydb
  244. trans* 1 roads key basedb odbc
  245. trans* 5 rails
  246. \endverbatim
  247. These definitions define more layers (called "field" in the API) for
  248. one vector map i.e. in one vector map may be more features linked to
  249. more attribute tables. Definitions on first 2 rows are applied for
  250. example on maps water1, water2, ... so that more maps may share one
  251. table.
  252. \verbatim
  253. water@PERMANENT 1 myrivers id /home/guser/mydbf dbf
  254. \endverbatim
  255. This definion overwrites the definition saved in PERMANENT/VAR and
  256. links the water map from PERMANENT mapset to the user's table.
  257. Modules should be written so that connections to databases for each
  258. vector layer are independent. It should be possible to read attributes
  259. of an input vector map from one database and write to some other and
  260. even with some other driver (should not be a problem).
  261. There are open questions, however. For one, how does one distinguish when
  262. new tables should be written and when not? For example, definitions:
  263. \verbatim
  264. river 1 river id water odbc
  265. river.backup* 1 NONE
  266. \endverbatim
  267. could be used to say that tables should not be copied for backups of
  268. map river because table is stored in a reliable RDBMS.
  269. \section vlibs Vector libraries
  270. Besides internal library functions there are two main libraries:
  271. - Vlib (Vector library), see \ref vlib
  272. - DGLib (Directed Graph Library), see \ref dglib
  273. For historical reasons, there are two internal libraries:
  274. - diglib (with dig_*() functions), GRASS 3.x/4.x
  275. - Vlib (with V1_*(), V2_*() and Vect_*() functions), GRASS 4.x/5.x
  276. (except for the 5.7 interim version)
  277. The vector library was introduced in GRASS 4.0 to hide internal vector
  278. files' formats and structures. In GRASS 6/7, everything is accessed via
  279. Vect_*() functions, for example:
  280. Old 4.x code:
  281. \code
  282. xx = Map.Att[Map.Area[area_num].att].x;
  283. \endcode
  284. New 6.x/7.x functions:
  285. \code
  286. centroid = Vect_get_area_centroid(Map, area_num);
  287. Vect_read_line(Map, line_p, NULL, centroid);
  288. Vect_line_get_point(line_p, 0, &xx, NULL, NULL);
  289. \endcode
  290. In GRASS 6/7, all internal, mostly non-topological vector functions are
  291. hidden from the modules' API (mainly dig_*(), V1_*() and V2_*()
  292. functions). All available Vect_*() functions are topological vector
  293. functions.
  294. The following include file contains definitions and structures
  295. required by some of the routines in this library. The programmer
  296. should therefore include this file in any code that uses the vector
  297. library:
  298. \code
  299. #include <grass/vector.h>
  300. \endcode
  301. <i>Note: For details please read Blazek et al. 2002 (see below) as
  302. well as the references in this document.</i>
  303. \section vlib_structures Vector library structures
  304. \subsection Map_info Map_info structure
  305. <tt>Map_info</tt> structure holds basic information about open vector map.
  306. \code
  307. struct Map_info
  308. {
  309. /* common info for all formats */
  310. int format; /* format (native, ogr) */
  311. int temporary; /* temporary file flag, not yet used */
  312. struct dblinks *dblnk; /* info about db links */
  313. struct Plus_head plus; /* topo file head info */
  314. /* graph-related section */
  315. int graph_line_type; /* line type used to build the graph */
  316. dglGraph_s graph; /* graph structure */
  317. dglSPCache_s spCache; /* shortest path cache */
  318. double *edge_fcosts; /* costs used for graph, (dglGetEdge()
  319. is not supported for _DGL_V1) */
  320. double *edge_bcosts;
  321. double *node_costs; /* node costs */
  322. int cost_multip; /* edge and node costs
  323. multiplicator */
  324. /* All of these apply only to runtime, and none get written out
  325. to the dig_plus file
  326. */
  327. int open; /* should be 0x5522AA22 if opened correctly
  328. or 0x22AA2255 if closed
  329. anything else implies that structure has
  330. never been initialized
  331. */
  332. int mode; /* Open mode - read, write, rw */
  333. int level; /* Topology level - 1, 2, (3) */
  334. int head_only; /* only header is opened */
  335. int support_updated; /* support files were updated */
  336. plus_t next_line; /* for level 2 sequential reads */
  337. char *name; /* for 4.0 just name, and mapset */
  338. char *mapset; /* mapset name */
  339. /* location and gisdbase is usefull if changed (v.proj or external apps) */
  340. char *location; /* location name */
  341. char *gisdbase; /* gisdbase path */
  342. /* constraints for reading in lines (not polys yet) */
  343. int Constraint_region_flag;
  344. int Constraint_type_flag;
  345. double Constraint_N;
  346. double Constraint_S;
  347. double Constraint_E;
  348. double Constraint_W;
  349. double Constraint_T;
  350. double Constraint_B;
  351. int Constraint_type;
  352. int proj;
  353. /* format specific */
  354. /* native */
  355. struct gvfile dig_fp; /* dig file pointer */
  356. struct dig_head head; /* coor file head */
  357. /* non native */
  358. struct Format_info fInfo; /* format information */
  359. /* history file */
  360. FILE *hist_fp;
  361. /* temporary solution for sites */
  362. struct site_att *site_att; /* array of attributes loaded from db */
  363. int n_site_att; /* number of attributes in site_att array */
  364. int n_site_dbl; /* number of double attributes for one site */
  365. int n_site_str; /* number of string attributes for one site */
  366. };
  367. \endcode
  368. \subsection Plus_head Plus_head structure
  369. <tt>Plus_head</tt> holds basic topology-related information about vector map.
  370. \code
  371. struct Plus_head
  372. {
  373. int Version_Major; /* version codes */
  374. int Version_Minor;
  375. int Back_Major; /* earliest version that can use this data format */
  376. int Back_Minor;
  377. int spidx_Version_Major; /* version codes for spatial index */
  378. int spidx_Version_Minor;
  379. int spidx_Back_Major; /* earliest version that can use this data format */
  380. int spidx_Back_Minor;
  381. int cidx_Version_Major; /* version codes for category index */
  382. int cidx_Version_Minor;
  383. int cidx_Back_Major; /* earliest version that can use this data format */
  384. int cidx_Back_Minor;
  385. int with_z; /* 2D/3D vector data */
  386. int spidx_with_z; /* 2D/3D spatial index */
  387. int off_t_size; /* offset size here because Plus_head
  388. is available to all releveant
  389. functions */
  390. long head_size; /* topo header size */
  391. long spidx_head_size; /* spatial index header size */
  392. long cidx_head_size; /* category index header size */
  393. int release_support; /* release memory occupied by support
  394. (topo, spatial, category) */
  395. struct Port_info port; /* portability information */
  396. struct Port_info spidx_port; /* portability information for
  397. spatial index */
  398. struct Port_info cidx_port; /* portability information for
  399. category index */
  400. int mode; /* read, write, RW */
  401. int built; /* the highest level of topology
  402. currently available
  403. (GV_BUILD_*) */
  404. struct bound_box box; /* vector map bounding box */
  405. /* topology info */
  406. struct P_node **Node; /* struct P_node array of pointers
  407. 1st item is 1 for */
  408. struct P_line **Line; /* struct P_line array of pointers
  409. all these (not 0) */
  410. struct P_area **Area;
  411. struct P_isle **Isle;
  412. /* add here P_FACE, P_VOLUME, P_HOLE */
  413. plus_t n_nodes; /* current number of nodes */
  414. plus_t n_edges; /* current number of edges */
  415. plus_t n_lines; /* current number of lines */
  416. plus_t n_areas; /* current number of areas */
  417. plus_t n_isles; /* current number of isles */
  418. plus_t n_faces; /* current number of faces */
  419. plus_t n_volumes; /* current number of volumes */
  420. plus_t n_holes; /* current number of holes */
  421. plus_t n_plines; /* current number of points */
  422. plus_t n_llines; /* current number of lines */
  423. plus_t n_blines; /* current number of boundaries */
  424. plus_t n_clines; /* current number of centroids */
  425. plus_t n_flines; /* current number of faces */
  426. plus_t n_klines; /* current number of kernels*/
  427. plus_t n_vfaces; /* current number of volumes */
  428. plus_t n_hfaces; /* current number of hole faces */
  429. plus_t alloc_nodes; /* number of nodes we have alloc'ed
  430. space for i.e. array size - 1 */
  431. plus_t alloc_edges; /* number of edges we have alloc'ed space for */
  432. plus_t alloc_lines; /* number of lines we have alloc'ed space for */
  433. plus_t alloc_areas; /* number of areas we have alloc'ed space for */
  434. plus_t alloc_isles; /* number of isles we have alloc'ed space for */
  435. plus_t alloc_faces; /* number of faces we have alloc'ed space for */
  436. plus_t alloc_volumes; /* number of volumes we have alloc'ed space for */
  437. plus_t alloc_holes; /* number of holes we have alloc'ed space for */
  438. off_t Node_offset; /* offset of array of nodes in topo file */
  439. off_t Edge_offset; /* offset of array of edges in topo file */
  440. off_t Line_offset; /* offset of array of lines in topo file */
  441. off_t Area_offset; /* offset of array of areas in topo file */
  442. off_t Isle_offset; /* offset of array of isles in topo file */
  443. off_t Volume_offset; /* offset of array of volumes in topo file */
  444. off_t Hole_offset; /* offset of array of holes in topo file */
  445. int Spidx_built; /* set to 1 if spatial index is available */
  446. int Spidx_new; /* set to 1 if new spatial index will be generated */
  447. struct gvfile spidx_fp; /* spatial index file pointer */
  448. char *spidx_node_fname; /* node spatial index file name */
  449. off_t Node_spidx_offset; /* offset of nodes in sidx file */
  450. off_t Line_spidx_offset; /* offset of lines in sidx file */
  451. off_t Area_spidx_offset; /* offset of areas in sidx file */
  452. off_t Isle_spidx_offset; /* offset of isles in sidx file */
  453. off_t Face_spidx_offset; /* offset of faces in sidx file */
  454. off_t Volume_spidx_offset; /* offset of volumes in sidx file */
  455. off_t Hole_spidx_offset; /* offset of holes in sidx file */
  456. struct RTree *Node_spidx; /* node spatial index */
  457. struct RTree *Line_spidx; /* line spatial index */
  458. struct RTree *Area_spidx; /* area spatial index */
  459. struct RTree *Isle_spidx; /* isle spatial index */
  460. struct RTree *Face_spidx; /* face spatial index */
  461. struct RTree *Volume_spidx; /* volume spatial index */
  462. struct RTree *Hole_spidx; /* hole spatial index */
  463. /* Category index
  464. By default, category index is not updated */
  465. int update_cidx; /* update category index if vector is modified */
  466. int n_cidx; /* number of cat indexes (one for each field) */
  467. int a_cidx; /* allocated space for cat indexes */
  468. struct Cat_index *cidx; /* array of category indexes */
  469. int cidx_up_to_date; /* set to 1 when cidx is created and reset to 0 whenever any line is changed */
  470. off_t coor_size; /* size of coor file */
  471. long coor_mtime; /* time of last coor modification */
  472. /* Level2 update: list of lines and nodes updated (topo info for
  473. the line was changed) by last write/rewrite/delete operation.
  474. Lines/nodes in the list may be deleted (e.g. delete boundary:
  475. first added for delete area and then delete */
  476. int do_uplist; /* used internaly in diglib to know if list is maintained */
  477. int *uplines; /* array of updated lines */
  478. int alloc_uplines; /* allocated array */
  479. int n_uplines; /* number of updated lines */
  480. int *upnodes; /* array of updated nodes */
  481. int alloc_upnodes; /* allocated array */
  482. int n_upnodes; /* number of updated nodes */
  483. };
  484. \endcode
  485. \subsection dig_head dig_head structure
  486. <tt>dig_head</tt> holds header data of vector map (see \ref Map_info).
  487. \code
  488. struct dig_head
  489. {
  490. /* elements */
  491. char *organization; /* orgranization name */
  492. char *date; /* map date */
  493. char *your_name; /* user name */
  494. char *map_name; /* map name */
  495. char *source_date; /* source date */
  496. long orig_scale; /* original scale */
  497. char *line_3; /* comments */
  498. int plani_zone; /* zone */
  499. double digit_thresh; /* threshold for digitization */
  500. /* Programmers should NOT touch any thing below here */
  501. /* Library takes care of everything for you */
  502. /* coor elements */
  503. int Version_Major; /* backward compatibility info */
  504. int Version_Minor;
  505. int Back_Major;
  506. int Back_Minor;
  507. int with_z; /* 2D/3D vector data */
  508. off_t size; /* coor file size */
  509. long head_size; /* coor header size */
  510. struct Port_info port; /* portability information */
  511. off_t last_offset; /* offset of last read line */
  512. struct recycle *recycle; /* recycle dead line, not implemented yet */
  513. struct Map_info *Map; /* X-ref to Map_info struct (needed?) */
  514. };
  515. \endcode
  516. \section feature_geom Vector library feature geometry
  517. \subsection ftypes Feature types
  518. \code
  519. #define GV_POINT 0x01
  520. #define GV_LINE 0x02
  521. #define GV_BOUNDARY 0x04
  522. #define GV_CENTROID 0x08
  523. #define GV_FACE 0x10
  524. #define GV_KERNEL 0x20
  525. #define GV_AREA 0x40
  526. #define GV_VOLUME 0x80
  527. #define GV_POINTS (GV_POINT | GV_CENTROID )
  528. #define GV_LINES (GV_LINE | GV_BOUNDARY )
  529. \endcode
  530. Face and kernel are 3D equivalents of boundary and centroid, but there
  531. is no support (yet) for 3D topology (volumes). Faces are used in a
  532. couple of modules including NVIZ to visualize 3D buildings and other
  533. volumetric figures.
  534. \subsection coor_file_format Coor file format specification
  535. In the coor file the following is stored: 'line' (element) type,
  536. number of attributes and layer number for each category. Coordinates
  537. in binary file are stored as double (8 bytes).
  538. \subsubsection coor_file_head Header
  539. <table border="1" style="border-collapse: collapse">
  540. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  541. <tr><td>Version_Major </td><td>C</td><td>1</td><td>file version (major)</td></tr>
  542. <tr><td>Version_Minor </td><td>C</td><td>1</td><td>file version (minor)</td></tr>
  543. <tr><td>Back_Major</td><td>C</td><td>1</td><td>supported from GRASS version (major)</td></tr>
  544. <tr><td>Back_Minor</td><td>C</td><td>1</td><td>supported from GRASS version (minor)</td></tr>
  545. <tr><td>byte_order</td><td>C</td><td>1</td><td>little or big endian
  546. flag; files are written in machine native order but
  547. files in both little and big endian order may be
  548. read; zero for little endian</td></tr>
  549. <tr><td>size</td><td>L</td><td>1</td><td>coor file size</td></tr>
  550. <tr><td>with_z</td><td>C</td><td>1</td><td>2D or 3D flag; zero for 2D</td></tr>
  551. <tr><td>reserved</td><td>C</td><td>10</td><td>not used</td></tr>
  552. </table>
  553. \subsubsection coor_file_body Body
  554. The body consists of line records:
  555. <table border="1" style="border-collapse: collapse">
  556. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  557. <tr><td>record header</td><td>C</td><td>1</td><td>
  558. <UL>
  559. <LI><B>0. bit</B> : 1 - alive, 0 - dead line
  560. <LI><B>1. bit</B> : 1 - categories, 0 - no categories
  561. <LI><B>2.-3. bit</B> : type - one of: GV_POINT, GV_LINE,
  562. GV_BOUNDARY, GV_CENTROID
  563. <LI><B>4.-7. bit</B> : reserved, not used
  564. </UL>
  565. </td></tr>
  566. <tr><td>ncats</td><td>I</td><td>1</td><td>number of categories
  567. (written only if categories exist) </td></tr>
  568. <tr><td>field</td><td>I</td><td>ncats</td><td>field identifier,
  569. distinguishes between more categories append to one feature (written
  570. only if categories exist; field is called "layer" at user
  571. level)</td></tr>
  572. <tr><td>cat</td><td>I</td><td>ncats</td><td>category value (written
  573. only if categories exist)</td></tr>
  574. <tr><td>ncoor</td><td>I</td><td>1</td><td>written for GV_LINES and GV_BOUNDARIES
  575. only</td></tr>
  576. <tr><td>x</td><td>D</td><td>ncoor</td><td>x coordinate</td></tr>
  577. <tr><td>y</td><td>D</td><td>ncoor</td><td>y coordinate</td></tr>
  578. <tr><td>z</td><td>D</td><td>ncoor</td><td>z coordinate; present if
  579. with_z in head is set to 1</td></tr> </table>
  580. <B>Types used in coor file</B>
  581. <table border="1" style="border-collapse: collapse">
  582. <tr><td>Type</td><td>Name</td><td>Size in Bytes</td></tr>
  583. <tr><td>D</td><td>Double</td><td>8</td></tr>
  584. <tr><td>L</td><td>Long </td><td>4</td></tr>
  585. <tr><td>I</td><td>Int </td><td>4</td></tr>
  586. <tr><td>S</td><td>Short </td><td>4</td></tr>
  587. <tr><td>C</td><td>Char </td><td>1</td></tr>
  588. </table>
  589. \section topology_management Vector library topology management
  590. Topology general characteristics:
  591. - geometry and attributes are stored separately
  592. (don't read both if it is not necessary (usually it is not))</li>
  593. - the format is topological (areas build from boundaries)</li>
  594. - currently only 2D topology is supported
  595. Topology is written for native format while pseudo-topology is written
  596. for OGR sources, SHAPE-link.
  597. The following rules apply to the vector data:
  598. - Lines should not cross each other (i.e., lines which would cross must
  599. be split at their intersection to form distict lines).
  600. - Linear primitives which share nodes at exactly same points (i.e.,
  601. must be snapped together). This is particulary important since nodes
  602. are not exactly represented in the coor file, but only implicitly as
  603. endpoints of lines.
  604. - Common area boundaries should appear only once (i.e., should not be
  605. double digitized).
  606. - Areas must be explicitly closed. This means that it must be possible
  607. to complete each area by following one or more boundaries that are
  608. connected by common nodes, and that such tracings result is closed
  609. areas.
  610. - It is recommended that area features and linear features be placed
  611. in separate layers. However if area features and linear features
  612. must appear in one layer, common boundaries should be digitized only
  613. once. A boundary that is also a line (e.g., a road which is also a
  614. field boundary), should be digitized as a boundary to complete the
  615. area. The area feature should be labeled by a centroid as an
  616. area. Additionally, the common boundary itself (i.e., the boundary
  617. which is also a line) should be labeled as a line by a distict
  618. category number.
  619. Vector map topology can be cleaned at user level by <tt>v.clean</tt>
  620. command.
  621. \subsection topo_file_format Topo file format specification
  622. Topo file is read by Vect_open_topo().
  623. \subsubsection topo_file_header Header
  624. Note: <tt>plus</tt> is instance of <tt>Plus_head</tt> structure.
  625. <table border="1" style="border-collapse: collapse">
  626. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  627. <tr><td>plus->Version_Major </td><td>C</td><td>1</td><td>file version (major)</td></tr>
  628. <tr><td>plus->Version_Minor </td><td>C</td><td>1</td><td>file version (minor)</td></tr>
  629. <tr><td>plus->Back_Major</td><td>C</td><td>1</td><td>supported from GRASS version (major)</td></tr>
  630. <tr><td>plus->Back_Minor</td><td>C</td><td>1</td><td>supported from GRASS version (minor)</td></tr>
  631. <tr><td>plus->port->byte_order</td><td>C</td><td>1</td><td>little or big endian
  632. flag; files are written in machine native order but
  633. files in both little and big endian order may be
  634. readl; zero for little endian</td></tr>
  635. <tr><td>plus->head_size</td><td>L</td><td>1</td><td>header size</td></tr>
  636. <tr><td>plus->with_z</td><td>C</td><td>1</td><td>2D or 3D flag; zero for 2D</td></tr>
  637. <tr><td>plus->box</td><td>D</td><td>6</td><td>Bounding box coordinates (N,S,E,W,T,B)</td></tr>
  638. <tr><td>plus->n_nodes, plus->n_lines, etc.</td><td>I</td><td>7</td><td>Number of
  639. nodes, edges, lines, areas, isles, volumes and holes</td></tr>
  640. <tr><td>plus->n_plines, plus->n_llines, etc.</td><td>I</td><td>7</td><td>Number of
  641. points, lines, boundaries, centroids, faces and kernels</td></tr>
  642. <tr><td>plus->Node_offset, plus->Edge_offset,
  643. etc.</td><td>L</td><td>7</td><td>Offset value for nodes, edges, lines,
  644. areas, isles, volumes and holes</td></tr>
  645. <tr><td>plus->coor_size</td><td>L</td><td>1</td><td>File size</td></tr>
  646. </table>
  647. \subsubsection topo_file_body Body (nodes, lines, areas, isles)
  648. <b>Nodes</b>
  649. For each node (n_nodes):
  650. <table border="1" style="border-collapse: collapse">
  651. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  652. <tr><td>n_lines</td><td>I</td><td>1</td><td>Number of lines (0 for dead node)</td></tr>
  653. <tr><td>lines</td><td>I</td><td>n_lines</td><td>Line ids</td></tr>
  654. <tr><td>angles</td><td>D</td><td>n_lines</td><td>Angle value</td></tr>
  655. <tr><td>n_edges</td><td>I</td><td>1</td><td>Reserved for edges (only for with_z)</td></tr>
  656. <tr><td>x,y</td><td>D</td><td>2</td><td>Coordinate pair</td></tr>
  657. <tr><td>z</td><td>D</td><td>1</td><td>Only for with_z</td></tr>
  658. </table>
  659. \code
  660. struct P_node
  661. {
  662. double x; /* X coordinate */
  663. double y; /* Y coordinate */
  664. double z; /* Z coordinate */
  665. plus_t alloc_lines; /* allocated space for lines */
  666. plus_t n_lines; /* number of attached lines (size of
  667. lines, angle). If 0, then is
  668. degenerate node, for snappingi ???
  669. */
  670. plus_t *lines; /* list of connected lines */
  671. float *angles; /* respected angles; angles for
  672. lines/boundaries are in radians
  673. between -PI and PI. Value for
  674. points or lines with identical
  675. points (degenerated) is set to
  676. -9. */
  677. };
  678. \endcode
  679. <b>Lines</b>
  680. For each line (n_lines):
  681. <table border="1" style="border-collapse: collapse">
  682. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  683. <tr><td>feature type</td><td>C</td><td>1</td><td>0 for dead</td></tr>
  684. <tr><td>offset</td><td>L</td><td>1</td><td>Line offset</td></tr>
  685. <tr><td>N1</td><td>I</td><td>1</td><td>First node id (only if feature type is GV_POINTS, GV_LINES or GV_KERNEL)</td></tr>
  686. <tr><td>N2</td><td>I</td><td>1</td><td>Second node id (only if feature type is GV_LINE or GV_BOUNDARY)</td></tr>
  687. <tr><td>left</td><td>I</td><td>1</td><td>Left area id for feature type GV_BOUNDARY / Area id for feature type GV_CENTROID</td></tr>
  688. <tr><td>right</td><td>I</td><td>1</td><td>Right area id (for feature type GV_BOUNDARY)</td></tr>
  689. <tr><td>vol</td><td>I</td><td>1</td><td>Reserved for kernel (volume number, for feature type GV_KERNEL)</td></tr>
  690. <tr><td>N,S,E,W</td><td>D</td><td>4</td><td>Line bounding box (for feature type GV_LINE, GV_BOUNDARY or GV_FACE)</td></tr>
  691. <tr><td>T,B</td><td>D</td><td>2</td><td>Line bounding box for 3D (only if with_z=1)</td></tr>
  692. </table>
  693. \code
  694. struct P_line
  695. {
  696. plus_t N1; /* start node */
  697. plus_t N2; /* end node */
  698. plus_t left; /* area/isle number to left, negative
  699. for isle area number for centroid,
  700. negative for duplicate centroid
  701. */
  702. plus_t right; /* area/isle number to right, negative
  703. * for isle */
  704. double N; /* line bounding Box */
  705. double S;
  706. double E;
  707. double W;
  708. double T; /* top */
  709. double B; /* bottom */
  710. off_t offset; /* offset in coor file for line */
  711. int type; /* line type */
  712. };
  713. \endcode
  714. <b>Areas</b>
  715. For each area (n_areas):
  716. <table border="1" style="border-collapse: collapse">
  717. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  718. <tr><td>n_lines</td><td>I</td><td>1</td><td>number of boundaries</td></tr>
  719. <tr><td>lines</td><td>I</td><td>n_lines</td><td>Line ids</td></tr>
  720. <tr><td>n_isles</td><td>I</td><td>1</td><td>Number of isles</td></tr>
  721. <tr><td>isles</td><td>I</td><td>n_isles</td><td>Isle ids</td></tr>
  722. <tr><td>centroid</td><td>I</td><td>1</td><td>Centroid id</td></tr>
  723. <tr><td>N,S,E,W</td><td>D</td><td>4</td><td>Area bounding box</td></tr>
  724. <tr><td>T,B</td><td>D</td><td>2</td><td>Area bounding box for 3D (only if with_z=1)</td></tr>
  725. </table>
  726. \code
  727. struct P_area
  728. {
  729. double N; /* area bounding Box */
  730. double S;
  731. double E;
  732. double W;
  733. double T; /* top */
  734. double B; /* bottom */
  735. plus_t n_lines; /* number of boundary lines */
  736. plus_t alloc_lines; /* allocated space */
  737. plus_t *lines; /* list of boundary lines, negative
  738. means direction N2 to N1, lines are
  739. in clockwise order */
  740. /********* Above this line is compatible with P_isle **********/
  741. plus_t centroid; /* number of first centroid within area */
  742. plus_t n_isles; /* number of islands inside */
  743. plus_t alloc_isles;
  744. plus_t *isles; /* 1st generation interior islands */
  745. };
  746. \endcode
  747. <b>Isles</b>
  748. For each isle (n_isle):
  749. <table border="1" style="border-collapse: collapse">
  750. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  751. <tr><td>n_lines</td><td>I</td><td>1</td><td>number of boundaries</td></tr>
  752. <tr><td>lines</td><td>I</td><td>n_lines</td><td>Line ids</td></tr>
  753. <tr><td>area</td><td>I</td><td>1</td><td>Outer area id</td></tr>
  754. <tr><td>N,S,E,W</td><td>D</td><td>4</td><td>Isle bounding box</td></tr>
  755. <tr><td>T,B</td><td>D</td><td>2</td><td>Isle bounding box for 3D (only if with_z=1)</td></tr>
  756. </table>
  757. \code
  758. struct P_isle
  759. {
  760. double N; /* isle bounding Box */
  761. double S;
  762. double E;
  763. double W;
  764. double T; /* top */
  765. double B; /* bottom */
  766. plus_t n_lines; /* number of boundary lines */
  767. plus_t alloc_lines;
  768. plus_t *lines; /* list of boundary lines, negative
  769. means direction N2 to N1, lines are
  770. in counter clockwise order */
  771. /********* Above this line is compatible with P_area **********/
  772. plus_t area; /* area it exists w/in, if any */
  773. };
  774. \endcode
  775. \subsection topo_levels Topology levels
  776. \code
  777. #define GV_BUILD_NONE 0
  778. #define GV_BUILD_BASE 1
  779. #define GV_BUILD_AREAS 2
  780. #define GV_BUILD_ATTACH_ISLES 3
  781. #define GV_BUILD_CENTROIDS 4
  782. #define GV_BUILD_ALL GV_BUILD_CENTROIDS
  783. \endcode
  784. GV_BOUNDARY contains geometry and it is used to build areas.
  785. GV_LINE cannot form an area.
  786. \subsection topo_examples Topology examples
  787. \subsubsection Topology_Example_1 Topology Example 1
  788. A polygon may be formed by many boundaries (more primitives but connected).
  789. One boundary is shared by adjacent areas.
  790. \verbatim
  791. +--1--+--5--+
  792. | | |
  793. 2 A 4 B 6
  794. | | |
  795. +--3--+--7--+
  796. 1,2,3,4,5,6,7 = 7 boundaries (primitives)
  797. A,B = 2 areas
  798. \endverbatim
  799. \subsubsection Topology_Example_2 Topology Example 2
  800. This is handled correctly in GRASS: A can be filled, B filled differently.
  801. \verbatim
  802. +---------+
  803. | A |
  804. +-----+ |
  805. | B | |
  806. +-----+ |
  807. | |
  808. +---------+
  809. \endverbatim
  810. In GRASS, whenever an 'inner' ring touches the boundary of an outside
  811. area, even in one point, it is no longer an 'inner' ring (Isle in
  812. GRASS topology), it is simply another area. A, B above can never be
  813. exported from GRASS as polygon A with inner ring B because there are
  814. only 2 areas A and B and no island.
  815. \subsubsection Topology_Example_3 Topology Example 3
  816. This is handled correctly in GRASS: Areas A1, A2, and A3 can be filled differently.
  817. \verbatim
  818. +---------------------+
  819. | A1 |
  820. + +------+------+ |
  821. | | A2 | A3 | |
  822. + +------+------+ |
  823. | I1 |
  824. +---------------------+
  825. \endverbatim
  826. In GRASS, whenever an 'inner' ring does not touch the boundary of an
  827. outside area, also not in one point, it is an 'inner' ring (Isle). The
  828. areas A2 and A3 form a single Isle I1 located within area A1. The size
  829. of Isle I1 is substracted from the size of Area A1 when calculating
  830. the size of Area A1. Any centroids falling into Isle I1 are excluded
  831. when searching for a centroid that can be attached to Area A1. A1
  832. above can be exported from GRASS as polygon A1 with inner ring I1.
  833. \subsubsection Topology_Example_4 Topology Example 4
  834. v.in.ogr/v.clean can identify dangles and change the type from boundary
  835. to line (in TIGER data for example).
  836. Distinction between line and boundary isn't important only for dangles. Example:
  837. \verbatim
  838. +-----+-----+
  839. | . |
  840. | . |
  841. +.....+.....+
  842. | . |
  843. | x . |
  844. +-----+-----+
  845. ---- road + boundary of one parcel => type boundary
  846. .... road => type line
  847. x parcel centroid (identifies whole area)
  848. \endverbatim
  849. Because lines are not used to build areas, we have only one
  850. area/centroid, instead of 4 which would be necessary in TIGER.
  851. \subsection topo_memory Topology memory management
  852. Topology is generated for all kinds of vector types. Memory is not
  853. released by default. The programmer can force the library to release
  854. the memory by using Vect_set_release_support(). But: The programmer
  855. cannot run Vect_set_release_support() in mid process because all
  856. vectors are needed in the spatial index, which is needed to build topology.
  857. Topology is also necessary for points in case of a vector network
  858. because the graph is built using topology information about lines
  859. and points.
  860. The topology structure does not only store the topology but also
  861. the 'line' bounding box and line offset in coor file (index).
  862. The existing spatial index is using line ID in 'topology' structure
  863. to identify lines in 'coor' file. Currently it is not possible to build
  864. spatial index without topology.
  865. \section spidx Vector library spatial index management
  866. Spatial index (based on R-tree) is created with topology.
  867. Spatial index occupies a lot of memory but it is necessary for
  868. topology building. Also, it takes a long time to release the memory
  869. occupied by spatial index (dig_spidx_free()).
  870. The function building topology (Vect_build()) is usually called
  871. at the end of modules (before Vect_close()) so it is faster to call
  872. exit() and operating system releases all the memory much faster.
  873. By default the memory is not released.
  874. It is possible to call Vect_set_release_support() before Vect_close()
  875. to enforce memory release, but it takes a long time on large files.
  876. The spatial index is stored in file and not loaded for old vectors that
  877. are not updated, saving a lot of memory. Spatial queries are done in
  878. file.
  879. Currently most of the modules do not release the memory occupied for
  880. spatial index and work like this (pseudocode):
  881. \code
  882. int main
  883. {
  884. Vect_open_new();
  885. /* writing new vector */
  886. Vect_build();
  887. Vect_close(); /* memory is not released */
  888. }
  889. \endcode
  890. In general it is possible to free the memory with Vect_set_release_support()
  891. such as:
  892. \code
  893. int main
  894. {
  895. Vect_open_new();
  896. /* writing new vector */
  897. Vect_build();
  898. Vect_set_release_support();
  899. Vect_close(); /* memory is released */
  900. }
  901. \endcode
  902. but it takes longer.
  903. It makes sense to release the spatial index if it is used only at the beginning
  904. of a module or in permanently running programs like QGIS. Note that this
  905. applies only when creating a new vector or updating an old vector.
  906. For example:
  907. \code
  908. int main
  909. {
  910. Vect_open_update();
  911. /* select features using spatial index, e.g. Vect_select_lines_by_box() */
  912. Vect_set_release_support();
  913. Vect_close(); /* memory is released */
  914. /* do some processing which needs memory */
  915. }
  916. \endcode
  917. \subsection sidx_file_format Sidx file format specification
  918. Spatial index file ('sidx') is read by Vect_open_sidx().
  919. \subsubsection sidx_file_header Header
  920. Note: <tt>plus</tt> is instance of <tt>Plus_head</tt> structure.
  921. <table border="1" style="border-collapse: collapse">
  922. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  923. <tr><td>plus->spidx_Version_Major </td><td>C</td><td>1</td><td>file version (major)</td></tr>
  924. <tr><td>plus->spidx_Version_Minor </td><td>C</td><td>1</td><td>file version (minor)</td></tr>
  925. <tr><td>plus->spidx_Back_Major</td><td>C</td><td>1</td><td>supported from GRASS version (major)</td></tr>
  926. <tr><td>plus->spidx_Back_Minor</td><td>C</td><td>1</td><td>supported from GRASS version (minor)</td></tr>
  927. <tr><td>plus->spidx_port->byte_order</td><td>C</td><td>1</td><td>little or big endian
  928. flag; files are written in machine native order but
  929. files in both little and big endian order may be
  930. readl; zero for little endian</td></tr>
  931. <tr><td>plus->spidx_port.off_t_size</td><td>C</td><td>1</td><td>off_t size (LFS)</td></tr>
  932. <tr><td>plus->spidx_head_size</td><td>L</td><td>1</td><td>header size</td></tr>
  933. <tr><td>plus->spidx_with_z</td><td>C</td><td>1</td><td>2D/3D vector data</td></tr>
  934. <tr><td>ndims</td><td>C</td><td>1</td><td>Number of dimensions</td></tr>
  935. <tr><td>nsides</td><td>C</td><td>1</td><td>Number of sides</td></tr>
  936. <tr><td>nodesize</td><td>I</td><td>1</td><td>Node size</td></tr>
  937. <tr><td>nodecard</td><td>I</td><td>1</td><td>Node card (?)</td></tr>
  938. <tr><td>leafcard</td><td>I</td><td>1</td><td>Leaf card (?)</td></tr>
  939. <tr><td>min_node_fill</td><td>I</td><td>1</td><td>Minimum node fill (?)</td></tr>
  940. <tr><td>min_leaf_fill</td><td>I</td><td>1</td><td>Minimum leaf fill (?)</td></tr>
  941. <tr><td>plus->Node_spidx->n_nodes</td><td>I</td><td>1</td><td>Number of nodes</td></tr>
  942. <tr><td>plus->Node_spidx->n_leafs</td><td>I</td><td>1</td><td>Number of leafs</td></tr>
  943. <tr><td>plus->Node_spidx->n_levels</td><td>I</td><td>1</td><td>Number of levels</td></tr>
  944. <tr><td>plus->Node_spidx_offset</td><td>O</td><td>1</td><td>Node offset</td></tr>
  945. <tr><td>plus->Line_spidx->n_nodes</td><td>I</td><td>1</td><td>Number of nodes</td></tr>
  946. <tr><td>plus->Line_spidx->n_leafs</td><td>I</td><td>1</td><td>Number of leafs</td></tr>
  947. <tr><td>plus->Line_spidx->n_levels</td><td>I</td><td>1</td><td>Number of levels</td></tr>
  948. <tr><td>plus->Line_spidx_offset</td><td>O</td><td>1</td><td>Line offset</td></tr>
  949. <tr><td>plus->Area_spidx->n_nodes</td><td>I</td><td>1</td><td>Number of nodes</td></tr>
  950. <tr><td>plus->Area_spidx->n_leafs</td><td>I</td><td>1</td><td>Number of leafs</td></tr>
  951. <tr><td>plus->Area_spidx->n_levels</td><td>I</td><td>1</td><td>Number of levels</td></tr>
  952. <tr><td>plus->Area_spidx_offset</td><td>O</td><td>1</td><td>Area offset</td></tr>
  953. <tr><td>plus->Isle_spidx->n_nodes</td><td>I</td><td>1</td><td>Number of nodes</td></tr>
  954. <tr><td>plus->Isle_spidx->n_leafs</td><td>I</td><td>1</td><td>Number of leafs</td></tr>
  955. <tr><td>plus->Isle_spidx->n_levels</td><td>I</td><td>1</td><td>Number of levels</td></tr>
  956. <tr><td>plus->Isle_spidx_offset</td><td>O</td><td>1</td><td>Isle offset</td></tr>
  957. <tr><td>plus->Face_spidx_offset</td><td>O</td><td>1</td><td>Face offset</td></tr>
  958. <tr><td>plus->Volume_spidx_offset</td><td>O</td><td>1</td><td>Volume offset</td></tr>
  959. <tr><td>plus->Hole_spidx_offset</td><td>O</td><td>1</td><td>Hole offset</td></tr>
  960. <tr><td>plus->coor_size</td><td>O</td><td>1</td><td>Coor file size</td></tr>
  961. </table>
  962. \section cidx Vector library category index management
  963. The category index (stored in the cidx file) improves the performance of all
  964. selections by cats/attributes (SQL, e.g. 'd.vect cats=27591', 'v.extract list=20000-21000').
  965. This avoids that all selections have to be made by looping through all vector lines.
  966. Category index is also essential for simple feature representation of GRASS vectors.
  967. Category index is created for each field. In memory, it is stored in
  968. \code
  969. struct Cat_index
  970. {
  971. int field; /* field number */
  972. int n_cats; /* number of items in cat array */
  973. int a_cats; /* allocated space in cat array */
  974. int (*cat)[3]; /* array of cats (cat, type, lines/area) */
  975. int n_ucats; /* number of unique cats (not updated) */
  976. int n_types; /* number of types in type */
  977. int type[7][2]; /* number of elements for each type
  978. * (point, line, boundary, centroid,
  979. * area, face, kernel) */
  980. off_t offset; /* offset of the beginning of this
  981. * index in cidx file */
  982. };
  983. \endcode
  984. Category index is built with topology, but it is <b>not updated</b> if vector is edited on level 2.
  985. Category index is stored in 'cidx' file, 'cat' array is written/read by one call of
  986. dig__fwrite_port_I( (int *)ci->cat, 3 * ci->n_cats, fp) or
  987. dig__fread_port_I( (int *)ci->cat, 3 * ci->n_cats, fp).
  988. Stored values can be retrieved either by index in 'cat' array
  989. (if all features of given field are required) or by category value
  990. (one or few features), always by Vect_cidx_*() functions.
  991. To create category index, it will be necessary to rebuild topology for all existing vectors.
  992. This is an opportunity to make (hopefully) last changes in 'topo', 'cidx' formats.
  993. \subsection cidx_file_format Cidx file format specification
  994. Category index file ('cidx') is read by Vect_cidx_open().
  995. \subsubsection cidx_file_head Header
  996. Note: <tt>plus</tt> is instance of <tt>Plus_head</tt> structure.
  997. <table border="1" style="border-collapse: collapse">
  998. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  999. <tr><td>plus->cpidx_Version_Major </td><td>C</td><td>1</td><td>file version (major)</td></tr>
  1000. <tr><td>plus->cpidx_Version_Minor </td><td>C</td><td>1</td><td>file version (minor)</td></tr>
  1001. <tr><td>plus->cpidx_Back_Major</td><td>C</td><td>1</td><td>supported from GRASS version (major)</td></tr>
  1002. <tr><td>plus->cpidx_Back_Minor</td><td>C</td><td>1</td><td>supported from GRASS version (minor)</td></tr>
  1003. <tr><td>plus->cidx_port->byte_order</td><td>C</td><td>1</td><td>little or big endian
  1004. flag; files are written in machine native order but
  1005. files in both little and big endian order may be
  1006. readl; zero for little endian</td></tr>
  1007. <tr><td>plus->cidx_head_size</td><td>L</td><td>1</td><td>cidx head size</td></tr>
  1008. <tr><td>plus->n_cidx</td><td>I</td><td>1</td><td>number of fields</td></tr>
  1009. <tr><td>field</td><td>I</td><td>n_cidx</td><td>field number</td></tr>
  1010. <tr><td>n_cats</td><td>I</td><td>n_cidx</td><td>number of categories</td></tr>
  1011. <tr><td>n_ucats</td><td>I</td><td>n_cidx</td><td>number of unique categories</td></tr>
  1012. <tr><td>n_types</td><td>I</td><td>n_cidx</td><td>number of feature types</td></tr>
  1013. <tr><td>rtype</td><td>I</td><td>n_cidx * n_types</td><td>Feature type</td></tr>
  1014. <tr><td>type[t]</td><td>I</td><td>n_cidx * n_types</td><td>Number of items</td></tr>
  1015. </table>
  1016. \section tin Vector TINs
  1017. TINs are simply created as 2D/3D vector polygons consisting of
  1018. 3 vertices. See Vect_tin_get_z().
  1019. \section ogr_iface OGR interface
  1020. \subsection frmt_file_format Frmt file format specification
  1021. Frmt is a plain text file which contains basic information about
  1022. external format of linked vector map. Each line contains key, value
  1023. pairs separated by comma.
  1024. OGR specific format is described by:
  1025. - FORMAT - ogr
  1026. - DSN - datasource name
  1027. - LAYER - OGR layer name
  1028. Example:
  1029. \verbatim
  1030. FORMAT: ogr
  1031. DSN: /home/martin/src/grass_trunk
  1032. LAYER: p
  1033. \endverbatim
  1034. OGR layer can be linked via <tt>v.external</tt> command. When linking
  1035. OGR layer pseudo-topology ('topo') is built including spatial index
  1036. file ('sidx') and category index file ('cidx'). Additionally also
  1037. feature index file (see \ref fidx_file_format) is created.
  1038. \subsection fidx_file_format Fidx file format specification
  1039. Note: <tt>finfo</tt> is an instance of <tt>Format_info</tt> structure.
  1040. <table border="1" style="border-collapse: collapse">
  1041. <tr><td>Name</td><td>Type</td><td>Number</td><td>Description</td></tr>
  1042. <tr><td>Version_Major </td><td>C</td><td>1</td><td>file version (major)</td></tr>
  1043. <tr><td>Version_Minor </td><td>C</td><td>1</td><td>file version (minor)</td></tr>
  1044. <tr><td>Back_Major</td><td>C</td><td>1</td><td>supported from GRASS version (major)</td></tr>
  1045. <tr><td>Back_Minor</td><td>C</td><td>1</td><td>supported from GRASS version (minor)</td></tr>
  1046. <tr><td>byte_order</td><td>C</td><td>1</td><td>little or big endian
  1047. flag; files are written in machine native order but
  1048. files in both little and big endian order may be
  1049. readl; zero for little endian</td></tr>
  1050. <tr><td>length</td><td>L</td><td>1</td><td>header size</td></tr>
  1051. <tr><td>fInfo.ogr.offset_num</td><td>I</td><td>1</td><td>number of records</td></tr>
  1052. <tr><td>fInfo.ogr.offset</td><td>I</td><td>offset_num</td><td>offsets</td></tr>
  1053. </table>
  1054. \section grassdglib DGLib (Directed Graph Library)
  1055. <b>The Directed Graph Library</b> or DGLib (Micarelli 2002, \ref dglib ,
  1056. http://grass.osgeo.org/dglib/) provides functionality for vector network
  1057. analysis. This library released under GPL is hosted by the GRASS
  1058. project (within the GRASS source code). As a stand-alone library it
  1059. may also be used by other software projects.
  1060. The Directed Graph Library library provides functionality to assign costs to
  1061. lines and/or nodes. That means that costs can be accumulated while traveling
  1062. along polylines. The user can assign individual costs to all lines and/or
  1063. nodes of a vector map and later calculate shortest path connections based on
  1064. the accumulated costs. Applications are transport analysis, connectivity and
  1065. more. Implemented applications cover shortest path, traveling salesman (round trip),
  1066. allocation of sources (creation of subnetworks), minimum Steiner trees
  1067. (star-like connections), and iso-distances (from centers).
  1068. For details, please read Blazek et al. 2002 (see below).
  1069. Related vector functions are:
  1070. Vect_graph_add_edge(),
  1071. Vect_graph_init(),
  1072. Vect_graph_set_node_costs(),
  1073. Vect_graph_shortest_path(),
  1074. Vect_net_build_graph(),
  1075. Vect_net_nearest_nodes(),
  1076. Vect_net_shortest_path(), and
  1077. Vect_net_shortest_path_coor().
  1078. \section ascii Vector ASCII Format Specifications
  1079. The GRASS ASCII vector map format may contain a mix of primitives
  1080. including points, lines, boundaries, centroids, faces, and
  1081. kernels. The format may also contain a header with various metadata
  1082. (see example below).
  1083. Vector map can be converted to the ASCII representation at user level
  1084. by <tt>v.out.ascii format=standard</tt> command.
  1085. The header is similar as the head file of vector binary format (see
  1086. \ref head_file_format) but contains bounding box also. Keywords are:
  1087. \verbatim
  1088. ORGANIZATION
  1089. DIGIT DATE
  1090. DIGIT NAME
  1091. MAP NAME
  1092. MAP DATE
  1093. MAP SCALE
  1094. OTHER INFO
  1095. ZONE
  1096. WEST EDGE
  1097. EAST EDGE
  1098. SOUTH EDGE
  1099. NORTH EDGE
  1100. MAP THRESH
  1101. \endverbatim
  1102. Example:
  1103. \verbatim
  1104. ORGANIZATION: NC OneMap
  1105. DIGIT DATE:
  1106. DIGIT NAME: helena
  1107. MAP NAME: North Carolina selected bridges (points map)
  1108. MAP DATE: Mon Nov 6 15:32:39 2006
  1109. MAP SCALE: 1
  1110. OTHER INFO:
  1111. ZONE: 0
  1112. MAP THRESH: 0.000000
  1113. \endverbatim
  1114. The body begins with the row:
  1115. \verbatim
  1116. VERTI:
  1117. \endverbatim
  1118. followed by records of primitives:
  1119. \verbatim
  1120. TYPE NUMBER_OF_COORDINATES [NUMBER_OF_CATEGORIES]
  1121. X Y [Z]
  1122. ....
  1123. X Y [Z]
  1124. [ LAYER CATEGORY]
  1125. ....
  1126. [ LAYER CATEGORY]
  1127. \endverbatim
  1128. Everything above in <tt>[]</tt> is optional.
  1129. The primitive codes are as follows:
  1130. - 'P': point
  1131. - 'L': line
  1132. - 'B': boundary
  1133. - 'C': centroid
  1134. - 'F': face (3D boundary)
  1135. - 'K': kernel (3D centroid)
  1136. - 'A': area (boundary) - better use 'B'; kept only for backward
  1137. compatibility
  1138. The coordinates are listed following the initial line containing the
  1139. primitive code, the total number of vectors in the series, and (optionally)
  1140. the number of categories (1 for a single layer, higher for multiple layers).
  1141. Below that 1 or several lines follow to indicate the layer number and
  1142. the category number (ID).
  1143. The order of coordinates is
  1144. \verbatim
  1145. X Y [Z]
  1146. \endverbatim
  1147. Note: The points are stored as y, x (i.e., east, north), which is the
  1148. reserve of the way GRASS usually represents geographic coordinates.
  1149. Example:
  1150. \verbatim
  1151. P 1 1
  1152. 375171.4992779 317756.72097616
  1153. 1 1
  1154. B 5
  1155. 637740 219580
  1156. 639530 219580
  1157. 639530 221230
  1158. 637740 221230
  1159. 637740 219580
  1160. C 1 1
  1161. 638635 220405
  1162. 1 2
  1163. \endverbatim
  1164. In this example, the first vector feature is a point with category
  1165. number 1. The second vector feature is a boundary composed by 5
  1166. points. The third feature is a centroid with category number 2. The
  1167. boundary and the centroid form an area with category number 2. All
  1168. vector feature mentioned above are located in layer 1.
  1169. \section vlibfunc List of vector library functions
  1170. The vector library provides the GRASS programmer with routines to
  1171. process vector data. The routines in the vector library are presented
  1172. in functional groupings, rather than in alphabetical order. The order
  1173. of presentation will, it is hoped, provide better understanding of how
  1174. the library is to be used, as well as show the interrelationships
  1175. among the various routines. Note that a good way to understand how to
  1176. use these routines is to look at the source code for GRASS modules
  1177. which use them.
  1178. Note: All routines start with one of following prefixes Vect_, V1_,
  1179. V2_ or dig_. To avoid name conficts, programmers should not create
  1180. variables or routines in their own modules which use this prefix.
  1181. The Vect_*() functions are the programmer's API for GRASS vector
  1182. programming. The programmer should use only routines with this prefix.
  1183. - \subpage area
  1184. - \subpage array
  1185. - \subpage box
  1186. - \subpage break_lines
  1187. - \subpage break_polygons
  1188. - \subpage bridges
  1189. - \subpage buffer
  1190. - \subpage build
  1191. - \subpage build_nat
  1192. - \subpage build_ogr
  1193. - \subpage cats
  1194. - \subpage cindex
  1195. - \subpage clean_nodes
  1196. - \subpage close
  1197. - \subpage constraint
  1198. - \subpage dangles
  1199. - \subpage dbcolumns
  1200. - \subpage error
  1201. - \subpage field
  1202. - \subpage find
  1203. - \subpage graph
  1204. - \subpage header
  1205. - \subpage hist
  1206. - \subpage init_head
  1207. - \subpage intersect
  1208. - \subpage legal_vname
  1209. - \subpage level
  1210. - \subpage level_two
  1211. - \subpage line
  1212. - \subpage list
  1213. - \subpage map
  1214. - \subpage net
  1215. - \subpage open
  1216. - \subpage overlay
  1217. - \subpage vpoly
  1218. - \subpage read
  1219. - \subpage remove_areas
  1220. - \subpage remove_duplicates
  1221. - \subpage rewind
  1222. - \subpage select
  1223. - \subpage sindex
  1224. - \subpage snap
  1225. - \subpage tin
  1226. - \subpage type
  1227. - \subpage delete
  1228. - \subpage write
  1229. \section area Vector area functions
  1230. - Vect_get_area_area()
  1231. - Vect_get_area_boundaries()
  1232. - Vect_get_area_centroid()
  1233. - Vect_get_area_isle()
  1234. - Vect_get_area_num_isles()
  1235. - Vect_area_perimeter()
  1236. - Vect_get_area_points()
  1237. - Vect_get_isle_area()
  1238. - Vect_get_isle_boundaries()
  1239. - Vect_get_isle_points()
  1240. - Vect_point_in_area()
  1241. \section array Vector array functions
  1242. - Vect_new_varray()
  1243. - Vect_set_varray_from_cat_list()
  1244. - Vect_set_varray_from_cat_string()
  1245. - Vect_set_varray_from_db()
  1246. \section box Vector bounding box functions
  1247. - Vect_box_copy()
  1248. - Vect_box_clip()
  1249. - Vect_box_extend()
  1250. - Vect_box_overlap()
  1251. - Vect_get_area_box()
  1252. - Vect_get_isle_box()
  1253. - Vect_get_line_box()
  1254. - Vect_get_map_box()
  1255. - Vect_point_in_box()
  1256. - Vect_region_box()
  1257. \section break_lines Vector break lines functions
  1258. - Vect_break_lines()
  1259. - Vect_break_lines_list()
  1260. \section break_polygons Vector break polygons functions
  1261. - Vect_break_polygons()
  1262. \section bridges Vector bridges functions
  1263. - Vect_chtype_bridges()
  1264. - Vect_remove_bridges()
  1265. \section buffer Vector buffer functions
  1266. - Vect_line_buffer()
  1267. - Vect_line_parallel()
  1268. \section build Vector build functions
  1269. - Vect_build()
  1270. - Vect_build_partial()
  1271. - Vect_get_built()
  1272. - Vect_build_sidx_from_topo()
  1273. - Vect_build_sidx()
  1274. - Vect_save_sidx()
  1275. - Vect_save_topo()
  1276. - Vect_sidx_dump()
  1277. - Vect_topo_dump()
  1278. \subsection build_nat Vector build (native) functions
  1279. - Vect_attach_centroids()
  1280. - Vect_attach_isle()
  1281. - Vect_attach_isles()
  1282. - Vect_build_line_area()
  1283. - Vect_build_nat()
  1284. - Vect_isle_find_area()
  1285. \subsection build_ogr Vector build (OGR) functions
  1286. - Vect_build_ogr()
  1287. \section cats Vector categories functions
  1288. - Vect_array_to_cat_list()
  1289. - Vect_cat_del()
  1290. - Vect_cat_get()
  1291. - Vect_cat_in_array()
  1292. - Vect_cat_in_cat_list()
  1293. - Vect_cat_set()
  1294. - Vect_destroy_cat_list()
  1295. - Vect_destroy_cats_struct()
  1296. - Vect_field_cat_del()
  1297. - Vect_get_area_cats()
  1298. - Vect_get_area_cat()
  1299. - Vect_get_line_cat()
  1300. - Vect_new_cat_list()
  1301. - Vect_new_cats_struct()
  1302. - Vect_reset_cats()
  1303. - Vect_str_to_cat_list()
  1304. \section cindex Vector category index functions
  1305. (note: vector layer is historically called "field")
  1306. - Vect_cidx_dump()
  1307. - Vect_cidx_find_next()
  1308. - Vect_cidx_find_all()
  1309. - Vect_cidx_get_cat_by_index()
  1310. - Vect_cidx_get_field_index()
  1311. - Vect_cidx_get_field_number()
  1312. - Vect_cidx_get_num_cats_by_index()
  1313. - Vect_cidx_get_num_fields()
  1314. - Vect_cidx_get_num_types_by_index()
  1315. - Vect_cidx_get_num_unique_cats_by_index()
  1316. - Vect_cidx_get_type_count()
  1317. - Vect_cidx_get_type_count_by_index()
  1318. - Vect_cidx_open()
  1319. - Vect_cidx_save()
  1320. - Vect_set_category_index_update()
  1321. \section clean_nodes Vector clean nodes functions
  1322. - Vect_clean_small_angles_at_nodes()
  1323. \section close Vector close functions
  1324. - Vect_close()
  1325. \section constraint Vector constraint functions
  1326. - Vect_get_constraint_box()
  1327. - Vect_remove_constraints()
  1328. - Vect_set_constraint_region()
  1329. - Vect_set_constraint_type()
  1330. \section dangles Vector dangles functions
  1331. - Vect_chtype_dangles()
  1332. - Vect_remove_dangles()
  1333. - Vect_select_dangles()
  1334. \section dbcolumns Vector dbcolumns functions
  1335. - Vect_get_column_names()
  1336. - Vect_get_column_names_types()
  1337. - Vect_get_column_types()
  1338. \section error Vector error functions
  1339. - Vect_get_fatal_error()
  1340. - Vect_set_fatal_error()
  1341. \section field Vector field functions
  1342. (note: vector layer is historically called "field")
  1343. - Vect_add_dblink()
  1344. - Vect_check_dblink()
  1345. - Vect_default_field_info()
  1346. - Vect_get_dblink()
  1347. - Vect_get_field()
  1348. - Vect_get_field_by_name()
  1349. - Vect_map_add_dblink()
  1350. - Vect_map_check_dblink()
  1351. - Vect_map_del_dblink()
  1352. - Vect_new_dblinks_struct()
  1353. - Vect_read_dblinks()
  1354. - Vect_reset_dblinks()
  1355. - Vect_set_db_updated()
  1356. - Vect_subst_var()
  1357. - Vect_write_dblinks()
  1358. \section find Vector find functions
  1359. - Vect_find_area()
  1360. - Vect_find_island()
  1361. - Vect_find_line()
  1362. - Vect_find_line_list()
  1363. - Vect_find_node()
  1364. \section graph Vector graph functions
  1365. - Vect_graph_add_edge()
  1366. - Vect_graph_build()
  1367. - Vect_graph_init()
  1368. - Vect_graph_set_node_costs()
  1369. - Vect_graph_shortest_path()
  1370. \section header Vector header functions
  1371. - Vect_get_comment()
  1372. - Vect_get_constraint_box()
  1373. - Vect_get_date()
  1374. - Vect_get_full_name()
  1375. - Vect_get_map_date()
  1376. - Vect_get_map_name()
  1377. - Vect_get_mapset()
  1378. - Vect_get_name()
  1379. - Vect_get_organization()
  1380. - Vect_get_person()
  1381. - Vect_get_proj()
  1382. - Vect_get_proj_name()
  1383. - Vect_get_scale()
  1384. - Vect_get_thresh()
  1385. - Vect_get_zone()
  1386. - Vect_is_3d()
  1387. - Vect_print_header()
  1388. - Vect_read_header()
  1389. - Vect_set_comment()
  1390. - Vect_set_date()
  1391. - Vect_set_map_date()
  1392. - Vect_set_map_name()
  1393. - Vect_set_organization()
  1394. - Vect_set_person()
  1395. - Vect_set_scale()
  1396. - Vect_set_thresh()
  1397. - Vect_set_zone()
  1398. - Vect_write_header()
  1399. \section hist Vector history functions
  1400. - Vect_hist_command()
  1401. - Vect_hist_copy()
  1402. - Vect_hist_read()
  1403. - Vect_hist_rewind()
  1404. - Vect_hist_write()
  1405. \section init_head Vector header functions
  1406. - Vect_copy_head_data()
  1407. \section intersect Vector intersection functions
  1408. - Vect_line_check_intersection()
  1409. - Vect_line_intersection()
  1410. - Vect_segment_intersection()
  1411. \section legal_vname Vector valid map name functions
  1412. - Vect_check_input_output_name()
  1413. - Vect_legal_filename()
  1414. \section level Vector level functions
  1415. - Vect_level()
  1416. \section level_two Vector topological (level 2) functions
  1417. - Vect_get_centroid_area()
  1418. - Vect_get_line_areas()
  1419. - Vect_get_line_nodes()
  1420. - Vect_get_node_coor()
  1421. - Vect_get_node_line()
  1422. - Vect_get_node_line_angle()
  1423. - Vect_get_node_n_lines()
  1424. - Vect_get_num_areas()
  1425. - Vect_get_num_dblinks()
  1426. - Vect_get_num_faces()
  1427. - Vect_get_num_islands()
  1428. - Vect_get_num_lines()
  1429. - Vect_get_num_nodes()
  1430. - Vect_get_num_primitives()
  1431. - Vect_get_num_updated_lines()
  1432. - Vect_get_num_updated_nodes()
  1433. - Vect_get_updated_line()
  1434. - Vect_get_updated_node()
  1435. - Vect_set_release_support()
  1436. \section line Vector feature functions
  1437. - Vect_append_point()
  1438. - Vect_append_points()
  1439. - Vect_copy_pnts_to_xyz()
  1440. - Vect_copy_xyz_to_pnts()
  1441. - Vect_destroy_line_struct()
  1442. - Vect_get_num_line_points()
  1443. - Vect_line_box()
  1444. - Vect_line_delete_point()
  1445. - Vect_line_distance()
  1446. - Vect_line_geodesic_length()
  1447. - Vect_line_get_point()
  1448. - Vect_line_insert_point()
  1449. - Vect_line_length()
  1450. - Vect_line_prune()
  1451. - Vect_line_prune_thresh()
  1452. - Vect_line_reverse()
  1453. - Vect_line_segment()
  1454. - Vect_new_line_struct()
  1455. - Vect_point_on_line()
  1456. - Vect_points_distance()
  1457. - Vect_reset_line()
  1458. \section list Vector list functions
  1459. - Vect_destroy_list()
  1460. - Vect_list_append()
  1461. - Vect_list_append_list()
  1462. - Vect_list_delete()
  1463. - Vect_list_delete_list()
  1464. - Vect_new_list()
  1465. - Vect_reset_list()
  1466. - Vect_val_in_list()
  1467. \section map Vector map functions
  1468. - Vect_copy()
  1469. - Vect_copy_map_lines()
  1470. - Vect_copy_table()
  1471. - Vect_copy_table_by_cats()
  1472. - Vect_copy_tables()
  1473. - Vect_delete()
  1474. - Vect_rename()
  1475. \section net Vector network functions
  1476. - Vect_net_build_graph()
  1477. - Vect_net_get_line_cost()
  1478. - Vect_net_get_node_cost()
  1479. - Vect_net_nearest_nodes()
  1480. - Vect_net_shortest_path()
  1481. - Vect_net_shortest_path_coor()
  1482. \section open Vector open functions
  1483. - Vect_coor_info()
  1484. - Vect_maptype_info()
  1485. - Vect_open_new()
  1486. - Vect__open_old()
  1487. - Vect_open_old()
  1488. - Vect_open_old_head()
  1489. - Vect_open_sidx()
  1490. - Vect_open_topo()
  1491. - Vect_open_update()
  1492. - Vect_open_update_head()
  1493. - Vect_set_open_level()
  1494. \section overlay Vector overlay functions
  1495. - Vect_overlay()
  1496. - Vect_overlay_str_to_operator()
  1497. \section vpoly Vector polygon functions
  1498. - Vect_find_poly_centroid()
  1499. - Vect_get_point_in_area()
  1500. - Vect_point_in_area_outer_ring()
  1501. - Vect_point_in_island()
  1502. - Vect_get_point_in_poly()
  1503. - Vect_get_point_in_poly_isl()
  1504. \section read Vector read functions
  1505. \subsection read1_2 Level 1 and 2
  1506. - Vect_read_next_line()
  1507. \subsection read2 Level 2 only
  1508. - Vect_area_alive()
  1509. - Vect_isle_alive()
  1510. - Vect_line_alive()
  1511. - Vect_node_alive()
  1512. - Vect_read_line()
  1513. \section remove_areas Vector remove areas functions
  1514. - Vect_remove_small_areas()
  1515. \section remove_duplicates Vector remove duplicates functions
  1516. - Vect_line_check_duplicate()
  1517. - Vect_remove_duplicates()
  1518. \section rewind Vector rewind functions
  1519. - Vect_rewind()
  1520. \section sindex Vector spatial index functions
  1521. - Vect_select_areas_by_box()
  1522. - Vect_select_areas_by_polygon()
  1523. - Vect_select_isles_by_box()
  1524. - Vect_select_lines_by_box()
  1525. - Vect_select_lines_by_polygon()
  1526. - Vect_select_nodes_by_box()
  1527. \section select custom spatial index functions
  1528. - Vect_spatial_index_add_item()
  1529. - Vect_spatial_index_del_item()
  1530. - Vect_spatial_index_destroy()
  1531. - Vect_spatial_index_init()
  1532. - Vect_spatial_index_select()
  1533. \section snap Vector snap functions
  1534. - Vect_snap_lines()
  1535. - Vect_snap_lines_list()
  1536. \section tin Vector TIN functions
  1537. - Vect_tin_get_z()
  1538. \section type Vector type option functions
  1539. - Vect_option_to_types()
  1540. \section delete Vector delete functions
  1541. \subsection delete2 Level 2 only
  1542. - Vect_delete_line()
  1543. \section write Vector write functions
  1544. \subsection write1_2 Level 1 and 2
  1545. - Vect_write_line()
  1546. \subsection write2 Level 2 only
  1547. - Vect_rewrite_line()
  1548. \section geos GEOS support
  1549. Note: The functions are available only if GRASS is compiled with
  1550. <tt>--with-geos</tt> switch.
  1551. - Vect_read_line_geos()
  1552. - Vect_read_area_geos()
  1553. - Vect_line_to_geos()
  1554. - Vect_get_area_points_geos()
  1555. - Vect_get_isle_points_geos()
  1556. \section authors Authors
  1557. Radim Blazek (vector architecture) <radim.blazek gmail.com>
  1558. Roberto Micarelli (DGLib) <mi.ro iol.it>
  1559. \section references References
  1560. Text based on: R. Blazek, M. Neteler, and R. Micarelli. The new GRASS 5.1
  1561. vector architecture. In Open source GIS - GRASS users conference 2002,
  1562. Trento, Italy, 11-13 September 2002. University of Trento, Italy, 2002.
  1563. <a href="http://www.ing.unitn.it/~grass/conferences/GRASS2002/proceedings/proceedings/pdfs/Blazek_Radim.pdf">http://www.ing.unitn.it/~grass/conferences/GRASS2002/proceedings/proceedings/pdfs/Blazek_Radim.pdf</a>
  1564. \section seealso See Also
  1565. - \ref dglib
  1566. - \ref dbmilib
  1567. - \ref veditlib
  1568. Last change: $Date$
  1569. */