wm/mj-msc.tex

1741 lines
69 KiB
TeX
Raw Permalink Normal View History

2021-05-19 22:57:47 +03:00
\documentclass[a4paper]{article}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:49 +03:00
\usepackage[T1]{fontenc}
2021-05-19 22:57:49 +03:00
\usepackage[american]{babel}
2021-05-19 22:57:46 +03:00
\usepackage[utf8]{inputenc}
2021-05-19 22:57:50 +03:00
\usepackage{fvextra}
\usepackage[autostyle,english=american]{csquotes}
2021-05-19 22:57:47 +03:00
\MakeOuterQuote{"}
2021-05-19 22:57:50 +03:00
\usepackage[
maxbibnames=99,
style=numeric,
sorting=none,
alldates=iso,
seconds=true
]{biblatex}
2021-05-19 22:57:47 +03:00
\addbibresource{bib.bib}
2021-05-19 22:57:48 +03:00
\usepackage[
pdfusetitle,
2021-05-19 22:57:49 +03:00
pdfkeywords={Line Generalization,Line Simplification,Wang--Mueller},
2021-05-19 22:57:48 +03:00
pdfborderstyle={/S/U/W 0} % /S/U/W 1 to enable reasonable decorations
]{hyperref}
2021-05-19 22:57:46 +03:00
\usepackage{enumitem}
\usepackage[toc,page,title]{appendix}
\usepackage{caption}
\usepackage{subcaption}
2021-05-19 22:57:49 +03:00
\usepackage{dcolumn}
2021-05-19 22:57:46 +03:00
\usepackage{gensymb}
2021-05-19 22:57:47 +03:00
\usepackage{units}
2021-05-19 22:57:46 +03:00
\usepackage{varwidth}
\usepackage{tabularx}
\usepackage{float}
2021-05-19 22:57:49 +03:00
\usepackage{numprint}
2021-05-19 22:57:46 +03:00
\usepackage{tikz}
2021-05-19 22:57:50 +03:00
\usetikzlibrary{shapes.geometric,arrows,positioning}
2021-05-19 22:57:47 +03:00
\usepackage{fancyvrb}
2021-05-19 22:57:49 +03:00
\usepackage{layouts}
2021-05-19 22:57:50 +03:00
\usepackage{minted}
2021-05-19 22:57:48 +03:00
%\usepackage{charter}
%\usepackage{setspace}
%\doublespacing
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:49 +03:00
\input{version.inc}
\input{vars.inc}
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:47 +03:00
\newcommand{\onpage}[1]{\ref{#1} on page~\pageref{#1}}
\newcommand{\titlecite}[1]{\citetitle{#1}\cite{#1}}
2021-05-19 22:57:50 +03:00
\newcommand{\titleciteauthor}[1]{\citetitle{#1} by \citeauthor{#1}\cite{#1}}
2021-05-19 22:57:46 +03:00
\newcommand{\DP}{Douglas \& Peucker}
\newcommand{\VW}{Visvalingam--Whyatt}
\newcommand{\WM}{Wang--M{\"u}ller}
2021-05-19 22:57:49 +03:00
\newcommand{\WnM}{Wang and M{\"u}ller}
2021-05-19 22:57:51 +03:00
\newcommand{\WirM}{Wang ir M{\"u}ller}
2021-05-19 22:57:48 +03:00
% {\WM} algoritmo realizacija kartografinei upių generalizacijai
2021-05-19 22:57:48 +03:00
\newcommand{\MYTITLE}{{\WM} algorithm realization for cartographic line generalization}
2021-05-19 22:57:49 +03:00
\newcommand{\MYTITLENOCAPS}{wang--m{\"u}ller algorithm realization for cartographic line generalization}
2021-05-19 22:57:46 +03:00
\newcommand{\MYAUTHOR}{Motiejus Jakštys}
2021-05-19 22:57:50 +03:00
\newcommand{\inputcode}[2]{\inputminted[fontsize=\small]{#1}{#2}}
2021-05-19 22:57:51 +03:00
\newenvironment{longlisting}{\captionsetup{type=listing}}{}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:46 +03:00
\title{\MYTITLE}
\author{\MYAUTHOR}
\date{\VCDescribe}
2021-05-19 22:57:46 +03:00
\begin{document}
2021-05-19 22:57:46 +03:00
\begin{titlepage}
\begin{center}
2021-05-19 22:57:49 +03:00
\includegraphics[width=0.2\textwidth]{vu.pdf} \\[4ex]
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:48 +03:00
\large
\textbf{\textsc{
vilnius university \\
faculty of chemistry and geosciences \\
department of cartography and geoinformatics
}} \\[8ex]
2021-05-19 22:57:46 +03:00
\textbf{\MYAUTHOR} \\[8ex]
2021-05-19 22:57:48 +03:00
\normalsize
2021-05-19 22:57:51 +03:00
A Thesis Presented for the Degree of Master in Cartography \\[8ex]
2021-05-19 22:57:48 +03:00
\LARGE
2021-05-19 22:57:49 +03:00
\textbf{\textsc{\MYTITLENOCAPS}}
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:46 +03:00
\vfill
2021-05-19 22:57:48 +03:00
\normalsize
Supervisor Dr. Andrius Balčiūnas \\[16ex]
2021-05-19 22:57:46 +03:00
\VCDescribe
\end{center}
\end{titlepage}
2021-05-19 22:57:46 +03:00
\begin{abstract}
\label{sec:abstract}
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:51 +03:00
Currently available line simplification algorithms are rooted in
mathematics and geometry, and are unfit for bendy map features like rivers
and coastlines. {\WnM} observed how cartographers simplify these natural
2021-05-19 22:57:49 +03:00
features and created an algorithm. We implemented this algorithm and
documented it in great detail. Our implementation makes {\WM} algorithm
freely available in PostGIS, and this paper explains it.
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:51 +03:00
\vfill
2021-05-19 22:57:52 +03:00
Šiuo metu esami linijų supaprastinimo algoritmai yra kilę iš matematikos ir
geometrijos, bet nėra tinkami lankstiems geografiniams objektams, tokiems
kaip upės ir pakrantės, atvaizduoti. {\WirM} ištyrė, kaip kartografai
atlieka upių generalizaciją, ir sukūrė algoritmą. Mes realizavome šį
2021-05-19 22:57:51 +03:00
algoritmą ir išsamiai jį dokumentavome. Mūsų {\WM} realizacija ir
2021-05-19 22:57:52 +03:00
dokumentacija yra nemokamos ir laisvai prieinamos, naudojant PostGIS
2021-05-19 22:57:51 +03:00
platformą.
2021-05-19 22:57:51 +03:00
\end{abstract}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:52 +03:00
\clearpage
2021-05-19 22:57:46 +03:00
\tableofcontents
2021-05-19 22:57:49 +03:00
2021-05-19 22:57:52 +03:00
\listoftables
2021-05-19 22:57:51 +03:00
\listoflistings
2021-05-19 22:57:46 +03:00
\newpage
2021-05-19 22:57:47 +03:00
\section{Introduction}
2021-05-19 22:57:46 +03:00
\label{sec:introduction}
2021-05-19 22:57:48 +03:00
\iffalse
NOTICE: this value should be copied to layer2img.py:TEXTWIDTH, so dimensions
of inline images are reasonable.
2021-05-19 22:57:48 +03:00
Textwidth in cm: {\printinunitsof{cm}\prntlen{\textwidth}}
2021-05-19 22:57:48 +03:00
\fi
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:46 +03:00
When creating small-scale maps, often the detail of the data source is greater
2021-05-19 22:57:48 +03:00
than desired for the map. While many features can be removed or simplified, it
is more tricky with natural features that have many bends, like coastlines,
2021-05-19 22:57:51 +03:00
rivers, or forest boundaries.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:48 +03:00
To create a small-scale map from a large-scale data source, features need to be
2021-05-19 22:57:49 +03:00
simplified, i.e., detail should be reduced. While performing the
simplification, it is important to retain the "defining" shape of the original
2021-05-19 22:57:51 +03:00
feature. Otherwise, if the simplified feature looks too different from the
2021-05-19 22:57:51 +03:00
original, the result will look unrealistic. Simplification problem for some
objects can often be solved by non-geometric means:
2021-05-19 22:57:46 +03:00
\begin{itemize}
2021-05-19 22:57:51 +03:00
\item Towns and cities can be filtered by the number of inhabitants.
2021-05-19 22:57:46 +03:00
\item Roads can be eliminated by the road length, number of lanes, or
classification of the road (local, regional, international).
\end{itemize}
2021-05-19 22:57:51 +03:00
However, things are not as simple for natural features like rivers or
coastlines. If a river is nearly straight, it should remain such after
simplification. An overly straightened river will look like a canal, and the
other way around --- too curvy would not reflect the natural shape. Conversely,
if the river originally is highly wiggly, the number of bends should be
reduced, but not removed altogether. Natural line simplification problem can be
viewed as a task of finding a delicate balance between two competing goals:
2021-05-19 22:57:46 +03:00
\begin{itemize}
\item Reduce detail by removing or simplifying "less important" features.
2021-05-19 22:57:51 +03:00
\item Retain enough detail, so the original is still recognizable.
2021-05-19 22:57:46 +03:00
\end{itemize}
2021-05-19 22:57:51 +03:00
Given the discussed complexities with natural features, a fine line between
2021-05-19 22:57:52 +03:00
under-simplification (leaving an object as-is) and over-simplification (making a
2021-05-19 22:57:51 +03:00
straight line) needs to be found. Therein lies the complexity of simplification
algorithms: all have different trade-offs.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:51 +03:00
The purpose of the thesis is to implement a cartographic line generalization
2021-05-19 22:57:51 +03:00
algorithm on the basis of {\WM} algorithm, using open-source software. Tasks:
2021-05-19 22:57:50 +03:00
\begin{itemize}
\item Evaluate existing line simplification algorithms.
2021-05-19 22:57:51 +03:00
\item Identify main river generalization problems, using classical line
2021-05-19 22:57:50 +03:00
simplification algorithms.
2021-05-19 22:57:51 +03:00
\item Define the method of the {\WM} technical implementation.
2021-05-19 22:57:50 +03:00
\item Realize {\WM} algorithm technically, explaining the geometric
transformations in detail.
\item Apply the created algorithm for different datasets and compare
2021-05-19 22:57:51 +03:00
the results with national datasets.
2021-05-19 22:57:50 +03:00
\end{itemize}
Scientific relevance of this work --- the simplification processes (steps)
2021-05-19 22:57:51 +03:00
described by the {\WM} algorithm --- are analyzed in detail, practically
implemented, and the implementation is described. That expands the knowledge of
2021-05-19 22:57:50 +03:00
cartographic theory about the generalization of natural objects' boundaries
after their natural defining properties.
In the original {\WM} article introducing the algorithm, the steps are not
2021-05-19 22:57:51 +03:00
detailed in a way that can be put into practice for specific data; the steps are
specified in this work. Practically, this work makes it possible to use open-source software to perform cartographic line generalization. The developed
2021-05-19 22:57:50 +03:00
specialized cartographic line simplification algorithm can be applied by
cartographers to implement automatic data generalization solutions. Given the
open-source nature of this work, the algorithm implementation can be modified
freely.
2021-05-19 22:57:51 +03:00
\section{Literature Review And Problematic}
2021-05-19 22:57:49 +03:00
\label{sec:literature-review-problematic}
2021-05-19 22:57:51 +03:00
\subsection{Available Algorithms}
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:50 +03:00
This section reviews the classical line simplification algorithms, which,
besides being around for a long time, offer easily accessible implementations,
as well as more modern ones, which only theorize, but do not provide an
implementation.
2021-05-19 22:57:48 +03:00
\subsubsection{{\DP}, {\VW} and Chaikin's}
2021-05-19 22:57:52 +03:00
\label{sec:dp-vwchaikin}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:48 +03:00
{\DP}\cite{douglas1973algorithms} and {\VW}\cite{visvalingam1993line} are
2021-05-19 22:57:49 +03:00
"classical" line simplification computer graphics algorithms. They are
2021-05-19 22:57:51 +03:00
relatively simple to implement and require few runtime resources. Both of them
accept a single parameter based on desired scale of the map, which makes them
2021-05-19 22:57:49 +03:00
straightforward to adjust for different scales.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:51 +03:00
Both algorithms are available in PostGIS, a free-software GIS suite:
2021-05-19 22:57:46 +03:00
\begin{itemize}
2021-05-19 22:57:47 +03:00
\item {\DP} via
2021-05-19 22:57:50 +03:00
\href{https://postgis.net/docs/ST_Simplify.html}{PostGIS \textsc{st\_simplify}}.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:47 +03:00
\item {\VW} via
2021-05-19 22:57:50 +03:00
\href{https://postgis.net/docs/ST_SimplifyVW.html}{PostGIS
\textsc{st\_simplifyvw}}.
2021-05-19 22:57:46 +03:00
\end{itemize}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:51 +03:00
It may be worthwhile to post-process those through Chaikin's line smoothing
algorithm\cite{chaikin1974algorithm} via
2021-05-19 22:57:47 +03:00
\href{https://postgis.net/docs/ST_ChaikinSmoothing.html}{PostGIS
2021-05-19 22:57:50 +03:00
\textsc{st\_chaikinsmoothing}}.
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:51 +03:00
In generalization examples, we will use two rivers: Šalčia and Visinčia.
These rivers were chosen because they have both large and small bends, and
thus are convenient to analyze for both small- and large-scale generalization.
2021-05-19 22:57:50 +03:00
Figure~\onpage{fig:salvis-25} illustrates the original two rivers without any
simplification.
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:50 +03:00
\begin{figure}[ht]
2021-05-19 22:57:48 +03:00
\centering
\includegraphics[width=\textwidth]{salvis-25k}
2021-05-19 22:57:49 +03:00
\caption{Example rivers for visual tests (1:{\numprint{25000}}).}
2021-05-19 22:57:48 +03:00
\label{fig:salvis-25}
\end{figure}
2021-05-19 22:57:50 +03:00
\begin{figure}[ht]
2021-05-19 22:57:48 +03:00
\centering
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-2x50k}
2021-05-19 22:57:49 +03:00
\caption{Example scaled 1:\numprint{50000}.}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-2x50k}
2021-05-19 22:57:48 +03:00
\end{subfigure}
\hfill
\begin{subfigure}[b]{.49\textwidth}
\centering
2021-05-19 22:57:51 +03:00
\includegraphics[width=.2\textwidth]{salvis-250k-10x}
2021-05-19 22:57:49 +03:00
\caption{Example scaled 1:\numprint{250000}.}
2021-05-19 22:57:48 +03:00
\end{subfigure}
2021-05-19 22:57:48 +03:00
\caption{Down-scaled original river.}
2021-05-19 22:57:48 +03:00
\label{fig:salvis-50-250}
\end{figure}
2021-05-19 22:57:51 +03:00
Same rivers, unprocessed but in higher scales (1:\numprint{50000} and
2021-05-19 22:57:52 +03:00
1:\numprint{250000}), are depicted in Figure~\ref{fig:salvis-50-250}. Some
2021-05-19 22:57:49 +03:00
river features are so compact that a reasonably thin line depicting the river
is touching itself, creating a thicker line. We can assume that some
simplification for scale 1:\numprint{50000} and especially for
2021-05-19 22:57:52 +03:00
1:\numprint{250000} is worthwhile.
2021-05-19 22:57:50 +03:00
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-dp64-2x50k}
2021-05-19 22:57:50 +03:00
\caption{Using {\DP}.}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-vw64-2x50k}
2021-05-19 22:57:50 +03:00
\caption{Using {\VW}.}
\end{subfigure}
2021-05-19 22:57:50 +03:00
\caption{Simplified using classical algorithms (1:\numprint{50000}).}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-generalized-1x50k}
\end{figure}
2021-05-19 22:57:52 +03:00
Figure~\ref{fig:salvis-generalized-1x50k} illustrates the same river bend, but
2021-05-19 22:57:49 +03:00
simplified using {\DP} and {\VW} algorithms. The resulting lines are jagged,
2021-05-19 22:57:51 +03:00
and thus the resulting line looks unlike a real river. To smoothen the jaggedness,
traditionally, Chaikin's\cite{chaikin1974algorithm} is applied after
2021-05-19 22:57:52 +03:00
generalization, illustrated in Figure~\ref{fig:salvis-generalized-chaikin-1x50k}.
2021-05-19 22:57:50 +03:00
\begin{figure}[ht!]
\centering
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-dpchaikin64-2x50k}
2021-05-19 22:57:50 +03:00
\caption{{\DP} and Chaikin's.}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-dpchaikin64-2x50k}
\end{subfigure}
\hfill
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-vwchaikin64-2x50k}
2021-05-19 22:57:50 +03:00
\caption{{\VW} and Chaikin's.}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-vwchaikin64-2x50k}
\end{subfigure}
2021-05-19 22:57:50 +03:00
\caption{Simplified and smoothened river (1:\numprint{50000}).}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-generalized-chaikin-1x50k}
\end{figure}
2021-05-19 22:57:50 +03:00
\begin{figure}[ht!]
2021-05-19 22:57:48 +03:00
\centering
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-overlaid-dpchaikin64-2x50k}
2021-05-19 22:57:51 +03:00
2021-05-19 22:57:52 +03:00
\caption{Original (fig.~\ref{fig:salvis-2x50k}) and simplified
(fig.~\ref{fig:salvis-dpchaikin64-2x50k}).}
2021-05-19 22:57:51 +03:00
2021-05-19 22:57:48 +03:00
\end{subfigure}
\hfill
\begin{subfigure}[b]{.49\textwidth}
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{salvis-overlaid-vwchaikin64-2x50k}
2021-05-19 22:57:51 +03:00
2021-05-19 22:57:52 +03:00
\caption{Original (fig.~\ref{fig:salvis-2x50k}) and simplified
(fig.~\ref{fig:salvis-vwchaikin64-2x50k}.)}
2021-05-19 22:57:51 +03:00
2021-05-19 22:57:48 +03:00
\end{subfigure}
2021-05-19 22:57:50 +03:00
\caption{Zoomed-in simplified and smoothened river and original.}
2021-05-19 22:57:52 +03:00
\label{fig:salvis-overlaid-generalized-chaikin-1x50k}
2021-05-19 22:57:48 +03:00
\end{figure}
2021-05-19 22:57:52 +03:00
\begin{figure}[b]
2021-05-19 22:57:50 +03:00
\centering
2021-05-19 22:57:52 +03:00
\includegraphics[width=\textwidth]{amalgamate1}
2021-05-19 22:57:51 +03:00
\caption{Narrow bends amalgamating into thick unintelligible blobs.}
2021-05-19 22:57:50 +03:00
\label{fig:pixel-amalgamation}
\end{figure}
2021-05-19 22:57:50 +03:00
The resulting simplified and smoothened example
2021-05-19 22:57:52 +03:00
(Figure~\onpage{fig:salvis-generalized-chaikin-1x50k}) yields a more
2021-05-19 22:57:51 +03:00
aesthetically pleasing result; however, it obscures natural river features.
2021-05-19 22:57:48 +03:00
Given the absence of rocks, the only natural features that influence the river
direction are topographic:
2021-05-19 22:57:48 +03:00
\begin{itemize}
2021-05-19 22:57:48 +03:00
\item Relatively straight river (completely straight or with small-angled
bends over a relatively long distance) implies greater slope, more
water, and/or faster flow.
2021-05-19 22:57:48 +03:00
\item Bendy river, on the contrary, implies slower flow, slighter slope,
2021-05-19 22:57:48 +03:00
and/or less water.
2021-05-19 22:57:48 +03:00
\end{itemize}
2021-05-19 22:57:51 +03:00
Both {\VW} and {\DP} have a tendency to remove the small bends altogether,
removing a valuable characterization of the river.
2021-05-19 22:57:48 +03:00
Sometimes low-water rivers in slender slopes have many bends next to each
other. In low resolutions (either in small-DPI screens or paper, or when the
river is sufficiently zoomed out, or both), the small bends will amalgamate to
2021-05-19 22:57:51 +03:00
a unintelligible blob. Figure~\ref{fig:pixel-amalgamation} illustrates a
real-world example where a bendy river, normally 1 or 2 pixels wide, creates a
wide area, of which the shapes of the bend become unintelligible. In this
example, classical algorithms would remove these bends altogether. A
cartographer would retain a few of those distinctive bends, but would increase
the distance between the bends, remove some of the bends, or both.
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:51 +03:00
% TODO: figues shouldn't split the sentence.
2021-05-19 22:57:48 +03:00
For the reasons discussed in this section, the "classical" {\DP} and {\VW} are
2021-05-19 22:57:51 +03:00
not well-suited for natural river generalization, and a more robust line
generalization algorithm is worthwhile to look for.
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:52 +03:00
\clearpage
2021-05-19 22:57:51 +03:00
\subsubsection{Modern Approaches}
2021-05-19 22:57:46 +03:00
Due to their simplicity and ubiquity, {\DP} and {\VW} have been established as
2021-05-19 22:57:46 +03:00
go-to algorithms for line generalization. During recent years, alternatives
have emerged. These modern replacements fall into roughly two categories:
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:46 +03:00
\begin{itemize}
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:46 +03:00
\item Cartographic knowledge was encoded to an algorithm (bottom-up
2021-05-19 22:57:47 +03:00
approach). One among these are \titlecite{wang1998line}, also known
as {\WM}'s algorithm.
2021-05-19 22:57:46 +03:00
\item Mathematical shape transformation which yields a more cartographic
2021-05-19 22:57:49 +03:00
result. E.g., \titlecite{jiang2003line},
2021-05-19 22:57:47 +03:00
\titlecite{dyken2009simultaneous}, \titlecite{mustafa2006dynamic},
2021-05-19 22:57:51 +03:00
\titlecite{nollenburg2008morphing}, \titlecite{devangleserrorbends}.
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:46 +03:00
\end{itemize}
2021-05-19 22:57:46 +03:00
Authors of most of the aforementioned articles have implemented the
2021-05-19 22:57:48 +03:00
generalization algorithm, at least to generate the illustrations in the
2021-05-19 22:57:51 +03:00
articles. However, code is not available for evaluation with a desired dataset, much less for use as a basis for creating new maps. To the author's knowledge,
2021-05-19 22:57:48 +03:00
{\WM}\cite{wang1998line} is available in a commercial product, but requires a
purchase of the commercial product suite, without a way to license the
standalone algorithm.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:50 +03:00
{\WM} algorithm was created by encoding professional cartographers' knowledge
into a computer algorithm. It has a few main properties which make it
especially suitable for generalization of natural linear features:
2021-05-19 22:57:52 +03:00
\begin{figure}[h!]
2021-05-19 22:57:51 +03:00
\centering
\includegraphics[width=.8\textwidth]{wang125}
2021-05-19 22:57:51 +03:00
\caption{Figure 12.5 in \cite{wang1998line}: example of cartographic line
2021-05-19 22:57:51 +03:00
generalization.}
\label{fig:wang125}
\end{figure}
2021-05-19 22:57:50 +03:00
\begin{itemize}
2021-05-19 22:57:51 +03:00
\item Small bends are not always removed, but either combined (e.g.,
2021-05-19 22:57:50 +03:00
3 bends into 2), exaggerated, or removed, depending on the neighboring
bends.
\item Long and gentle bends are not straightened, but kept as-is.
\end{itemize}
As a result of these properties, {\WM} algorithm retains the defining
2021-05-19 22:57:51 +03:00
properties of the natural features: high-current rivers keep their appearance
2021-05-19 22:57:50 +03:00
as such, instead of becoming canals; low-stream bendy rivers retain their
frequent small bends.
2021-05-19 22:57:51 +03:00
Figure~\ref{fig:wang125}, sub-figure labeled "proposed method" (from the
original \titlecite{wang1998line}) illustrates the {\WM} algorithm.
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:51 +03:00
\subsection{Problematic with Generalization of Rivers}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:50 +03:00
This section introduces the reader to simplification and generalization, and
2021-05-19 22:57:51 +03:00
discusses two main problems with current-day automatic cartographic line
generalization:
2021-05-19 22:57:48 +03:00
2021-05-19 22:57:50 +03:00
\begin{itemize}
\item Currently available line simplification algorithms were created
2021-05-19 22:57:51 +03:00
to simplify geometries, but do not encode cartographic knowledge.
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:50 +03:00
\item Existing cartographic line generalization algorithms are not freely
accessible.
\end{itemize}
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:50 +03:00
\subsubsection{Simplification versus Generalization}
2021-05-19 22:57:50 +03:00
It is important to note the distinction between simplification, line
2021-05-19 22:57:51 +03:00
generalization, and cartographic generalization.
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:51 +03:00
Simplification reduces an object's detail in isolation, not taking the object's
2021-05-19 22:57:50 +03:00
natural properties or surrounding objects into account. For example, if a
river is simplified, it may have an approximate shape of the original river,
but lose some shapes that define it. For example:
\begin{itemize}
\item Low-water rivers in slender slopes have many small bends next to each
other. A non-cartographic line simplification may remove all of them,
thus losing an important river's characteristic feature: after such
simplification, it will be hard to tell that the original river was
low-water in a slender slope.
\item Low-angle river bend river over a long distance differs significantly
from a completely straight canal. Non-cartographic line simplification
2021-05-19 22:57:51 +03:00
may replace that bend with a straight line, making the river more
2021-05-19 22:57:50 +03:00
similar to a canal than a river.
\end{itemize}
2021-05-19 22:57:51 +03:00
In other words, simplification processes the line, ignoring its geographic
features. It works well when the features are human-made (e.g., roads,
2021-05-19 22:57:50 +03:00
administrative boundaries, buildings). There is a number of freely available
non-cartographic line simplification algorithms, which this paper will review.
2021-05-19 22:57:51 +03:00
Contrary to line simplification, cartographic generalization does not focus
2021-05-19 22:57:50 +03:00
into a single feature class (e.g., rivers), but the whole map. For example,
line simplification may change river bends in a way that bridges (and roads to
the bridges) become misplaced. While line simplification is limited to a single
feature class, cartographic generalization is not. Fully automatic cartographic
2021-05-19 22:57:51 +03:00
generalization is not yet a solved problem. % <TODO: Reference needed>.
2021-05-19 22:57:50 +03:00
Cartographic line generalization falls in between the two: it does more than
line simplification, and less than cartographic generalization. Cartographic
2021-05-19 22:57:51 +03:00
line generalization deals with a single feature class, takes into account its
geographic properties, but ignores other features. This paper examines {\WM}'s
2021-05-19 22:57:50 +03:00
\titlecite{wang1998line}, a cartographic line generalization algorithm.
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:51 +03:00
\subsubsection{Availability of Generalization Algorithms}
2021-05-19 22:57:50 +03:00
Lack of robust openly available generalization algorithm implementations poses
2021-05-19 22:57:51 +03:00
a problem for map creation with free software: there is no high-quality
simplification algorithm to create down-scaled maps, so any cartographic work,
which uses line generalization as part of its processing, will be of sub-par
2021-05-19 22:57:52 +03:00
quality. We believe that the availability of high-quality open-source tools is an
2021-05-19 22:57:51 +03:00
important foundation for future cartographic experimentation and development,
2021-05-19 22:57:51 +03:00
thus it benefits the cartographic society as a whole.
2021-05-19 22:57:50 +03:00
{\WM}'s commercial availability signals something about the value of the
algorithm: at least the authors of the commercial software suite deemed it
worthwhile to include it. However, not everyone has access to the commercial
software suite, access to funds to buy the commercial suite, or access to the
operating system required to run the commercial suite. PostGIS, in contrast, is
2021-05-19 22:57:51 +03:00
free itself, and runs on free platforms. Therefore, algorithm
2021-05-19 22:57:50 +03:00
implementations that run on PostGIS or other free platforms are useful to a
wider cartographic society than proprietary ones.
2021-05-19 22:57:51 +03:00
\subsubsection{Unfitness of Line Simplification Algorithms}
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:52 +03:00
Section~\ref{sec:dp-vwchaikin} illustrates the current gaps with line
2021-05-19 22:57:51 +03:00
simplification algorithms for real rivers. To sum up, we highlight the
2021-05-19 22:57:50 +03:00
following cartographic problems from our examples:
\begin{description}
2021-05-19 22:57:51 +03:00
\item[Long bends] should remain as long bends, instead of becoming fully
2021-05-19 22:57:50 +03:00
straight lines.
2021-05-19 22:57:51 +03:00
\item[Many small bends] should not be removed. To retain a river's character,
2021-05-19 22:57:50 +03:00
the algorithm should retain some small bends, and, when they are too
2021-05-19 22:57:51 +03:00
small to be visible, they should be combined or exaggerated.
2021-05-19 22:57:50 +03:00
\end{description}
2021-05-19 22:57:50 +03:00
We are limiting the problem to cartographic line generalization. That is, full
2021-05-19 22:57:50 +03:00
cartographic generalization, which takes topology and other feature classes
into account, is out of scope.
2021-05-19 22:57:50 +03:00
Figure~\onpage{fig:wang125} illustrates {\WM} algorithm from their original
2021-05-19 22:57:51 +03:00
paper. Note how the long bends retain curvy, and how some small bends get
2021-05-19 22:57:50 +03:00
exaggerated.
2021-05-19 22:57:47 +03:00
\section{Methodology}
2021-05-19 22:57:46 +03:00
\label{sec:methodology}
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:47 +03:00
The original {\WM}'s algorithm \cite{wang1998line} leaves something to be
desired for a practical implementation: it is not straightforward to implement
the algorithm from the paper alone.
2021-05-19 22:57:46 +03:00
Explanations in this document are meant to expand, rather than substitute, the
2021-05-19 22:57:51 +03:00
original description in {\WM}. Therefore, familiarity with the original paper is
2021-05-19 22:57:48 +03:00
assumed, and, for some sections, having the original close-by is necessary to
2021-05-19 22:57:47 +03:00
meaningfully follow this document.
2021-05-19 22:57:48 +03:00
This paper describes {\WM} in detail that is more useful for anyone who wishes
to follow the algorithm implementation more closely: each section is expanded
2021-05-19 22:57:51 +03:00
with additional commentary, and illustrations added for non-obvious steps. Corner
cases are discussed, too.
2021-05-19 22:57:46 +03:00
2021-05-19 22:57:51 +03:00
\subsection{Main Geometry Elements Used by Algorithm}
2021-05-19 22:57:48 +03:00
\label{sec:vocab}
2021-05-19 22:57:50 +03:00
This section defines and explains the geometry elements that are used
2021-05-19 22:57:52 +03:00
throughout this paper and the implementation. Assume Euclidean geometry
throughout this document, unless noted otherwise.
\begin{description}
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{vertex}] is a point on a plane, can be expressed
by a pair of $(x,y)$ coordinates.
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{line segment}] or \textsc{segment} joins two
vertices by a straight line. A segment can be expressed by two
2021-05-19 22:57:51 +03:00
coordinate pairs: $(x_1, y_1)$ and $(x_2, y_2)$. Line segment and
segment are used interchangeably.
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{line}] or \textsc{linestring} represents a single
2021-05-19 22:57:51 +03:00
linear feature. For example, a river or a coastline.
2021-05-19 22:57:51 +03:00
Geometrically, a line is a series of connected line segments, or,
equivalently, a series of connected vertices. Each vertex connects to
2021-05-19 22:57:51 +03:00
two other vertices, with the exception of the vertices at either ends of the line:
these two connect to a single other vertex.
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{multiline}] or \textsc{multilinestring} is a
2021-05-19 22:57:51 +03:00
collection of linear features. Throughout this implementation, this is
used rarely (normally, a river is a single line) but can be valid
2021-05-19 22:57:51 +03:00
when, for example, a river has an island.
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{bend}] is a subset of a line that humans perceive
as a curve. The geometric definition is complex and is discussed in
2021-05-19 22:57:48 +03:00
section~\ref{sec:definition-of-a-bend}.
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{baseline}] is a line between the bend's first and last
2021-05-19 22:57:51 +03:00
vertices.
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{sum of inner angles}] is a measure of how "curved"
2021-05-19 22:57:51 +03:00
the bend is. Assume that first and last bend vertices are vectors. Then sum
2021-05-19 22:57:51 +03:00
of inner angles will be the angular difference of those two vectors.
2021-05-19 22:57:47 +03:00
2021-05-19 22:57:51 +03:00
\item[\normalfont\textsc{algorithmic complexity}] measured in \textsc{big o
notation}, is a relative measure that helps explain how
2021-05-19 22:57:51 +03:00
long\footnote{the upper bound, i.e., the worst case.} the
algorithm will run depending on its input. It is widely used in computing
2021-05-19 22:57:51 +03:00
science when discussing the efficiency of a given algorithm.
2021-05-19 22:57:48 +03:00
For example, given $n$ objects and time complexity of $O(log(n))$, the
time it takes to execute the algorithm is logarithmic to $n$.
Conversely, if complexity is $O(n^2)$, then the time it takes to
2021-05-19 22:57:50 +03:00
execute the algorithm grows quadratically with input. Importantly, if
the input size doubles, the time it takes to run the algorithm
2021-05-19 22:57:48 +03:00
quadruples.
2021-05-19 22:57:51 +03:00
\textsc{big o notation} was first suggested by
2021-05-19 22:57:50 +03:00
Bachmann\cite{bachmann1894analytische} and Landau\cite{landau1911} in
2021-05-19 22:57:51 +03:00
late \textsc{xix} century, and clarified and popularized for computing
science by Donald Knuth\cite{knuth1976big} in the 1970s.
2021-05-19 22:57:48 +03:00
\end{description}
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:52 +03:00
\clearpage
2021-05-19 22:57:51 +03:00
\subsection{Algorithm Implementation Process}
2021-05-19 22:57:51 +03:00
\label{sec:algorithm-implementation-process}
2021-05-19 22:57:50 +03:00
2021-05-19 22:57:50 +03:00
\tikzset{
startstop/.style={trapezium,text centered,minimum height=2em,
trapezium left angle=70,trapezium right angle=110,draw=black,fill=red!20},
proc/.style={rectangle,minimum height=2em,text centered,draw=black,
fill=orange!20},
decision/.style={diamond,minimum height=2em,text centered,aspect=3,
draw=black,fill=green!20},
arrow/.style={thick,->,>=stealth},
}
2021-05-19 22:57:50 +03:00
\begin{figure}[!ht]
2021-05-19 22:57:50 +03:00
\centering
2021-05-19 22:57:50 +03:00
\begin{tikzpicture}[node distance=1.5cm,auto]
2021-05-19 22:57:50 +03:00
\node (start) [startstop] {Read \textsc{linestring}};
\node (detect) [proc,below of=start] {Detect bends};
\node (inflections) [proc,below of=detect] {Fix gentle inflections};
\node (selfcrossing) [proc,below of=inflections] {Eliminate self-crossing};
\node (mutated1) [decision,below of=selfcrossing] {Mutated?};
\node (bendattrs) [proc,below of=mutated1] {Compute bend attributes};
\node (exaggeration) [proc,below of=bendattrs] {Exaggeration};