From 1ba8e2695745d00352f400c6cab17fd058250bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 26 May 2020 15:54:16 +0300 Subject: [PATCH] add clipping --- II/Referatas/layer2img.py | 22 ++++++++++++++++++++-- II/Referatas/mj-referatas.tex | 18 ++++++++++++++---- II/Referatas/zeimena.gpkg | Bin 167936 -> 167936 bytes 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/II/Referatas/layer2img.py b/II/Referatas/layer2img.py index 5f52ea8..837c0d9 100755 --- a/II/Referatas/layer2img.py +++ b/II/Referatas/layer2img.py @@ -29,9 +29,23 @@ def parse_args(): parser.add_argument('-o', '--outfile', metavar='', type=str) parser.add_argument( '--size', type=plt_size, help='Figure size in mm (WWxHH)') + parser.add_argument( + '--clip', type=float, nargs=4, + metavar=('xmin', 'ymin', 'xmax', 'ymax')) return parser.parse_args() +#def makebox(t): +# xmin, ymin, xmax, ymax = t +# if xmin > xmax: +# raise Exception("xmin should be > xmax") +# if ymin > ymax: +# raise Exception("ymin should be > ymax") +# left, bottom = xmin, ymin +# width, height = xmax - xmin, ymax - ymin +# return {'left': left, 'bottom': bottom, 'width': width, 'height': height} + + def main(): args = parse_args() if args.table: @@ -41,8 +55,12 @@ def main(): else: f = geopandas.read_file(args.infile) f.plot(figsize=args.size) - plt.axis('off') - plt.margins(0, 0) + ax = plt.gca() + if args.clip: + ax.set_ylim(bottom=args.clip[1], top=args.clip[3]) + ax.set_xlim(left=args.clip[0], right=args.clip[2]) + ax.axis('off') + ax.margins(0, 0) plt.tight_layout(0) if args.outfile: plt.savefig(args.outfile, bbox_inches=0, dpi=300) diff --git a/II/Referatas/mj-referatas.tex b/II/Referatas/mj-referatas.tex index e519f6d..9241ade 100644 --- a/II/Referatas/mj-referatas.tex +++ b/II/Referatas/mj-referatas.tex @@ -46,6 +46,12 @@ a6: 105x148xmm a7: 74x105mm a8: 52x74mm +Xmin: 623306.313 +Ymin: 6109635.515 +Xmax: 625526.313 +Ymax: 6111210.515 +623306.313 6109635.515 625526.313 6111210.515 + connect rivers first to a single polylines: - some algs can preserve connectivity, some not. @@ -136,14 +142,18 @@ are often used for line generalization: Review of the available algorithms will be followed by desiderata for a possible open-source addition. In the end, we will issue a recommendation, -which algorithm can be picked up and implemented by a willing GIS developer. +which algorithm can be picked up and implemented by an avid GIS developer. \section{Visual comparison} Lakaja and large part of Žeimena (see figure~\ref{fig:zeimena} on -page~\pageref{fig:zeimena}) will be used, because the river exhibits both both -straight and curved shape, is a combination of two curly rivers, and author's -familiarity with the location. +page~\pageref{fig:zeimena}) will be used as inputs to the generalization +algorithms, because the river exhibits both both straight and curved shape, is +a combination of two curly rivers, and author's familiarity with the location. + +Since the map area is large (scale $1:150 000$), we will also review a +zoomed-in subset of the map of scale $1:10 000$. The zoomed-in version will +help explain some of the deficiencies in the reviewed algorithms. \begin{figure}[H] \centering diff --git a/II/Referatas/zeimena.gpkg b/II/Referatas/zeimena.gpkg index 354483ea8a81a3de682d00f8cf26f9dda6bf3090..6332005ca1f69e7979d860f9bc1703cf08e86a02 100644 GIT binary patch delta 50 zcmZozz}2vTOC~tbC$l6~AuYcsH?c&)m_dMniHX5ML4kpRL29CmGow^vLTdu!)&!;n F{QzSX4P^iT delta 50 zcmZozz}2vTOC~tbC$l6~AuYcsH?c&)m_dMnk&(ecL4kpRL2{yuGoxf