- Timestamp:
- 02/20/13 16:35:52 (12 years ago)
- Location:
- trunk/tutorial
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tutorial/model_tutorial.tex
r12 r13 79 79 80 80 \subsection{Objects} 81 \label{sec:objects} 81 82 82 83 Edit the file user\_content.txt to add objects. They must have the following structure (See figure:~\ref{fig:objects}): … … 109 110 CREATE TABLE `layer_at1` ( 110 111 `OBJECT_ID` int(10) unsigned NOT NULL, 112 -- add user attributes here -- 111 113 PRIMARY KEY (`OBJECT_ID`), 112 114 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 113 115 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 114 116 \end{lstlisting} 115 This code is the basic template for creating an attribute table. The number after layer\_at (see line 2) indicates the layer index and refers to the LAYER\_INDEX column in user\_content.txt. In our example layer\_at1 describe the attributes for the layer Boreholes\_PT. 116 Below are described the five attributes that can be used as well as the corresponding SQL code 117 \begin{description*} 118 \item [Enumeration] \hfill \\ 117 This code is the basic template for creating an attribute table. The number after layer\_at (see line 2) indicates the layer index and refers to the LAYER\_INDEX column in user\_content.txt. In our example layer\_at1 describe the attributes for the layer Boreholes\_PT. User attributes can then be added on line 4 of this template. 118 Below are described the five attributes that can be used in a ToolMap data model as well as the corresponding SQL code 119 \subsubsection {Enumeration} 119 120 \crealplisting{SQL} 120 121 \begin{lstlisting} … … 122 123 \end{lstlisting} 123 124 If you add such fields, then you must also fill the list of supported values (see section~\ref{sec:attribute-values}). 124 \item [Text] \hfill \\125 \subsubsection {Text} 125 126 \begin{lstlisting} 126 127 `DESCRIPT` varchar(255) DEFAULT NULL, 127 128 \end{lstlisting} 128 129 The number next to the keyword varchar indicates the maximum text length. 129 \item [Integer] \hfill \\130 \subsubsection {Integer} 130 131 \begin{lstlisting} 131 132 `NUM_REF` int(11) DEFAULT NULL, 132 133 \end{lstlisting} 133 134 There is no special option for integer fields 134 \ item [Float] \hfill \\135 \subsubsection {Float} 135 136 136 137 \begin{lstlisting} … … 138 139 \end{lstlisting} 139 140 The two digits next to the keyword decimal indicate the field precision and scale. In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. In this case, values that can be stored range from -999.99 to 999.99. 140 \item [Date] \hfill \\141 \subsubsection {Date} 141 142 142 143 \begin{lstlisting} … … 144 145 \end{lstlisting} 145 146 There is no special option for date fields 147 148 149 \subsection{Attributes values} 150 \label{sec:attribute-values} 151 For each enumeration field previously added in the user\_structure.sql file, it is necessary to define the allowed values. Therefore it is necessary to edit the attributes section of user\_content.txt. The structure of the Attributes section is shown in Figure~\ref{fig:attributs}. This table is divided into two parts, the first three columns describe the attribute fields, the remaining columns describe the values supported by these fields. Below is a description of each column. 152 153 \begin{description*} 154 \item [ATTRIBUT\_ID] attribute unique ID. 155 \item [LAYER\_INDEX] the index of the layer that the attribute refers to. The value 1 shown in the example (Figure 4, row 42 and 43) therefore relates to the theme Boreholes\_PT. 156 \item [ATTRIBUT\_NAME] attribute name. This name will be used as the column name in the exported SHP. Some limitations apply to SHP format for column names, for more information you can refer to \url{http://en.wikipedia.org/wiki/Shapefile#Shapefile\_attribute\_format\_.28.dbf.29} or \url{http://www.gdal.org/ogr/drv\_shapefile.html} 157 \item [CATALOG\_ID] attribute value unique ID 158 \item [CODE] attribute value code, should not necessarily be unique 159 \item [DESCRIPTION\_0,1,2,3,4,5] attribute value description in up to 5 languages. The order of language is not important, but it must be identical to the one chosen for the objects (see~\ref{sec:objects}). 160 146 161 \end{description*} 147 162 148 149 \subsection{Value domain of the attributes} 150 \label{sec:attribute-values} 163 \begin{figure} [htbp] 164 \centering 165 \includegraphics[width=.9\textwidth]{img/attributs.png} 166 \caption{Attributes section structure} 167 \label{fig:attributs} 168 \end{figure} 151 169 152 170
Note: See TracChangeset
for help on using the changeset viewer.