%
%  HOW TO BUILD TOOLMAP DATAMODEL
%
%  Created by Lucien Schreiber on 2013-02-19.
%  Copyright (c) 2013. All rights reserved.
%

\documentclass[a4paper, 12pt]{article}
\usepackage{crealp-report}
\usepackage{upquote} %to force Latex not substitute ' by `
\usepackage{tocbibind}
\usepackage{mdwlist}
%\usepackage{natbib}

\begin{document}
\crealptitle {Tutorial} {How to create a ToolMap datamodel using TmDmCreator} {Lucien Schreiber} {lucien.schreiber@crealp.vs.ch}
\tableofcontents
\pagebreak

\section{Introduction}
This tutorial explains how to create a project ToolMap manually. This approach has the following advantages:
\begin{enumerate*}
  \item It ensures the IDs used
  \item It generates a multilingual model
  \item It allows better monitoring of model changes
\end{enumerate*}
The main disadvantage of this approach is the lack of user interface as well as the need for the user to have some knowledge of SQL. Finally, this approach has been developed to meet the need for rigor in the management of the geological data model.


\section{Conceptual Workflow}
The diagram shown in figure~\ref{fig:conceptual-workflow} illustrates the proposed workflow. User edits the user\_structure.sql and user\_content.txt files. These files as well as base\_structure.sql are used by the software TmDmCreator to produces either:
\begin{enumerate*}
  \item	a SQL file defining the project (output 1)
  \item	a ToolMap project (output 2)
\end{enumerate*}

\begin{figure} [htbp]
	\centering
    \includegraphics[width=1\textwidth]{img/workflow.pdf}
    \caption{Conceptual workflow}
    \label{fig:conceptual-workflow}
\end{figure}



\section{Data needed}
In order to produce a ToolMap project, TmDmCreator needs the following files:
%\begin{itemize}
    \begin{description*}
  \item[base\_structure.sql]\hfill \\ contains the necessary SQL code base for all ToolMap projects. This file should normally not be edited by users
  \item[user\_structure.sql]\hfill \\ contains the SQL structure describing the layers attributes
  \item[user\_content.txt]\hfill \\ Is a tabular file (editable in Excel for example) containing the definition of layers, objects, and attribute values.
\end{description*}
%\end{itemize}
The recommended way to work with user\_structure.sql and user\_content.txt is described below


\section{Preparing user data}

\subsection{Layers}
Open user\_content.txt using a spreadsheet and edit the thematic\_layers part. Each of the layers that we want to export should appear here. The structure is as follows (see figure ???):
\begin{description*}
  \item [LAYER\_INDEX] unique identifier of the layer
  \item [TYPE\_CD] layer spatial type as follow
    \begin{description*}
      \item [0] Line
      \item [1] Point
      \item [2] Polygon
    \end{description*}
  \item [LAYER\_NAME] the layer name. This name will be given to the SHP file when exporting
\end{description*}

\subsection{Objects}

\subsection{Attributes structure}

\subsection{Value domain of the attributes}


\end{document}
