\subsection{Generating Maps-- Background Information and Configuration}

The artifact-server is able to process geographic data and provide them
for a WMS service rendering maps via a HTTP-based interface. The
following process chains are covered. For generating horizontal-cross sections, 
the following steps have to be processed:

\begin{enumerate}
%% FIXME: When do we clip? Sequence will influence the interpolation
    \item Selecting the data from datawarehouse
    \item Clipping the datasets along the passed polygon
    \item Calculating interpolation in the plane
    \item Generating contour lines
    \item Matching processed parameter data to the corresponding style
    \item Rendering requested map
\end{enumerate}

For generating maps from object-based datamodels like CONTIS, NAUTHIS
and Marine Features, just the following steps are needed:

\begin{enumerate}
    \item Selecting the data from datawarehouse
    \item Clipping the datasets along the passed polygon
    \item Matching processed object data to the corresponding style
    \item Rendering requested map
\end{enumerate}

In order to understand the configuration facilities for generating maps
in more detail, the internal
interaction of the artifact-server and the mapserver is described below
for the use case when a user parameterizes a horizontal-cross-section
profile and visualizes it as a map (without regarding the caching
facilities)

\begin{enumerate}
    \item After finishing the parameterization, the artifact-server
    requests the data from the database-backend and processes the data
    (see above).    
    
    \item By requesting a map in the GNV-WebClient, the artifact-server writes a ESRI
    shapefile with (clipped) geometries, attribute data, projection
    information and a special file storing meta information (\texttt{
    meta.xml}) for this artifact in the a corresponding directory in the
    \texttt{shapefile-directory}.
    
    \item After that the so called \texttt{map-generator}
    is triggered. The map-generator searches the \texttt{shape-directory}
    and its subfolders with all existing \texttt{meta.xml} files and
    generates a central configuration file for the mapserver at \texttt{
    map-generator/mapfile@path}. Each shapefile will be published as a WMS
    layer. \\
    The generated mapfile is constructed out of a base template from
    \texttt{
    map-generator/templates/maptemplate} and a parameter-/layer-specific
    part generated from \texttt{map-generator/templates/path}. The
    selection of the correct file-based templates is extracted out of
    the \texttt{meta.xml}-file.
    
    \item The matching between the generated geograpic data and the corresponding
    style files is been done by the artifact-server, constructing
    filenames of maptemplates out of parameter-information. For
    horizontal-cross-sections the schema looks like this \texttt{
    horizontalcrosssection\_\$NAME-OF-PARAMETER}; for layer-orientated
    FIS like e.g. NAUTHIS and CONTIS like this \texttt{
    layer\_\$ID\_MAPSERVICE\_\$ID\_LAYER}  e.g.
    \texttt{layer\_BSH\_IMS\_CONTIS\_Resources\_2}.
    %% FIXME@TE: Marine Feature? Name of WMS?
    In order to set at least title, geometry-type and path to the
    corresponding shapefile dynamically a templating language, called
    \texttt{velocity} is used.

    \item The corresponding subfolder of an artifact in \texttt{
    shape-directory} with their shapefiles
    and \texttt{meta.xml}-document will be deleted after the time of
    expiry. By triggering the \texttt{map-generator} the next time, the
    geographic data and the central configuration of the mapserver will
    be updated.

\end{enumerate}

The coupling of the artifact-server and mapserver is free of
maintenance. The artifact-server as master cares about deleting and
updating the configuration of the mapserver.

\begin{lstlisting}
artifact-database
|-- gnv # charts, palettes, interpolation parameters
|   |-- map-generator 
|   |-- shapefile-directory
|   `-- horizontal-cross-section
|-- mapserver
`-- velocity
\end{lstlisting}

\paragraph*{mapserver}
{\em Function}: URL of the mapserver where request can be send to. The
URL will be used for displaying the location e.g. in the GNV-WebClient and in
the {\tt meta.xml}-file.

\begin{itemize}
    \item {\tt server}: URL of the mapserver where request can send to.
\end{itemize}

\paragraph*{velocity}
{\em Function}: Templating language used in the maptemplates at \texttt{
map-generator/templates/path} for accessing the parameters from
dynamically generated \texttt{meta.xml}-configuration of artifacts.

\begin{itemize}
    \item {\tt logfile}: Setting the path to write log files.
    Preconfigured to \texttt{/var/log/artifacts/velocity.log}. {\bf Just
    absolute pathes are allowed here!}
\end{itemize}

\paragraph*{map-generator}
{\em Function}: Mechanism for generating configuration for the {\tt
mapserver} dynamically. For background information about the interaction
between artifact-server and mapserver, see above.

\begin{itemize}
    \item {\tt mapfile}: path to the mapfile accessed by the WMS wrapper
    {\tt gnv-wms}
    \item {\tt templates}: \\ {\tt path} to the directory where
    parameter-specific mapconfiguartions (as *.vm) are stored. 
    \\ {\tt
    maptemplate} containing the WMS instance-specific configurations and
    metadata, like overall boundingbox, spatial reference systems and
    contact data.
    \end{itemize}

\paragraph*{shapefile-directory}
{\em Function}: Pointer where shapefiles for map-generation are stored 

\begin{itemize}
    \item {\tt path}: path to the directory where shapefiles are stored
    and accessed by {\tt mapserver}
\end{itemize}

\paragraph*{horizontal-cross-section}
{\em Function}: Parameterization for the interpolation algorithm for
horizontal-cross-sections (maps).
  

\begin{itemize}
    \item {\tt sample}: The attribute {\tt number} sets the number of
    steps for the interpolation grid.
    \item {\tt ground}: {\tt interpolation} method for calculating the
    interpolation from the last measured value in meshes against the seafloor.
    Available methods are {\tt nearest-neighbor | bilinear | bicubic}.
\end{itemize}
