vectorlib.dox 64 KB

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