Browse Source

bloing

master
Norwin Roosen 1 year ago
commit
d858b64f2f
No account linked to committer's email address
7 changed files with 173 additions and 0 deletions
  1. 38
    0
      README.md
  2. 25
    0
      convert_alkis_nas.bat
  3. 19
    0
      convert_alkis_nas.sh
  4. 1
    0
      tools/25832.epsg
  5. 90
    0
      tools/7z-License.txt
  6. BIN
      tools/7z.dll
  7. BIN
      tools/7z.exe

+ 38
- 0
README.md View File

@@ -0,0 +1,38 @@
1
+# ALKIS NAS converter
2
+
3
+Tiny commandline tool for conversion of ALKIS NAS konvois to (Q)GIS compatible
4
+data formats.
5
+
6
+- shell script for unix, dependent on gzip and ogr2ogr
7
+- batch script for windows, dependent on QGIS 2.18, ships with 7zip
8
+
9
+## usage on unix
10
+Given you have an *ALKIS NAS Konvoi*, a set of compressed GML files like the following:
11
+
12
+```
13
+EcoLibro_20180313T000000_00von25_32400000_5585000.xml.gz
14
+EcoLibro_20180313T000000_01von25_32400000_5585000.xml.gz
15
+EcoLibro_20180313T000000_02von25_32400000_5585000.xml.gz
16
+...
17
+EcoLibro_20180313T000000_25von25_32400000_5585000.xml.gz
18
+```
19
+
20
+Run `./convert_alkis_nas.sh <input-nas-dir>`.
21
+This will generate `./alkis_2018-03-13.gpkg` file containing your data.
22
+Parameters to customize output filename, format, and SRS are available:
23
+
24
+```sh
25
+./convert_alkis_nas.sh <input dir> <outfile> <ogr driver> <out srs>
26
+```
27
+
28
+## usage on windows
29
+Place your NAS Konvoi input data files (`*.gz`, see above) inside the directory of this batch script.
30
+Run the `convert_alkis_nas.bat` script. `alkis.gpkg` will contain your data.
31
+No parameters are available.
32
+
33
+## todos
34
+- [ ] add parameters to windows version
35
+- [ ] windows: search for `ogr2ogr` in path, use QGIS/bin as fallback only
36
+
37
+## license
38
+GPL-3.0

+ 25
- 0
convert_alkis_nas.bat View File

@@ -0,0 +1,25 @@
1
+@ECHO OFF
2
+
3
+SET tooldir="tools"
4
+SET ogr2ogr="%PROGRAMFILES%\QGIS 2.18\bin\ogr2ogr.exe"
5
+SET sevenzip="%tooldir%\7z.exe"
6
+
7
+IF NOT EXIST %ogr2ogr% (
8
+    echo QGIS 2.18 installation not found
9
+    exit /B 1
10
+)
11
+
12
+IF NOT EXIST %sevenzip% (
13
+    echo 7zip not found
14
+    exit /B 2
15
+)
16
+
17
+FOR %%G IN (*.gz) DO (
18
+    %sevenzip% -aoa e %%G
19
+)
20
+
21
+FOR %%G IN (*.xml) DO (
22
+  %ogr2ogr% alkis.gpkg -f GPKG -append -update -a_srs %tooldir%\25832.epsg %%G 
23
+)
24
+
25
+del *.gfs *.xml

+ 19
- 0
convert_alkis_nas.sh View File

@@ -0,0 +1,19 @@
1
+#!/bin/bash
2
+
3
+srs=${4:-"EPSG:25832"}
4
+format=${3:-"gpkg"}
5
+outfile=${2:-"alkis_`date -I`.$format"}
6
+srcdir=${1:-"."}
7
+
8
+function cleanup { rm -f $srcdir/*.{xml,gfs} }
9
+trap cleanup EXIT
10
+
11
+echo "unpacking $srcdir/*.gz"
12
+gunzip -dkf $srcdir/*.gz
13
+
14
+for f in $srcdir/*.xml; do
15
+  # tested for alkis data RhlPfalz on fedora 27 (ogr2ogr 2.1.4)
16
+  echo "adding $f to $outfile"
17
+  ogr2ogr "$outfile" -f "$format" -append -update -a_srs "$srs" "$f"
18
+done
19
+

+ 1
- 0
tools/25832.epsg View File

@@ -0,0 +1 @@
1
++proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

+ 90
- 0
tools/7z-License.txt View File

@@ -0,0 +1,90 @@
1
+  7-Zip
2
+  ~~~~~
3
+  License for use and distribution
4
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+  7-Zip Copyright (C) 1999-2018 Igor Pavlov.
7
+
8
+  The licenses for files are:
9
+
10
+    1) 7z.dll:
11
+         - The "GNU LGPL" as main license for most of the code
12
+         - The "GNU LGPL" with "unRAR license restriction" for some code
13
+         - The "BSD 3-clause License" for some code
14
+    2) All other files: the "GNU LGPL".
15
+
16
+  Redistributions in binary form must reproduce related license information from this file.
17
+
18
+  Note:
19
+    You can use 7-Zip on any computer, including a computer in a commercial
20
+    organization. You don't need to register or pay for 7-Zip.
21
+
22
+
23
+  GNU LGPL information
24
+  --------------------
25
+
26
+    This library is free software; you can redistribute it and/or
27
+    modify it under the terms of the GNU Lesser General Public
28
+    License as published by the Free Software Foundation; either
29
+    version 2.1 of the License, or (at your option) any later version.
30
+
31
+    This library is distributed in the hope that it will be useful,
32
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
33
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
34
+    Lesser General Public License for more details.
35
+
36
+    You can receive a copy of the GNU Lesser General Public License from
37
+    http://www.gnu.org/
38
+
39
+
40
+
41
+
42
+  BSD 3-clause License
43
+  --------------------
44
+
45
+    The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
46
+    That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
47
+    that also uses the "BSD 3-clause License":
48
+
49
+    ----
50
+    Copyright (c) 2015-2016, Apple Inc. All rights reserved.
51
+
52
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
53
+
54
+    1.  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
55
+
56
+    2.  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
57
+        in the documentation and/or other materials provided with the distribution.
58
+
59
+    3.  Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
60
+        from this software without specific prior written permission.
61
+
62
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
63
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
64
+    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
65
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67
+    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68
+    ----
69
+
70
+
71
+
72
+
73
+  unRAR license restriction
74
+  -------------------------
75
+
76
+    The decompression engine for RAR archives was developed using source
77
+    code of unRAR program.
78
+    All copyrights to original unRAR code are owned by Alexander Roshal.
79
+
80
+    The license for original unRAR code has the following restriction:
81
+
82
+      The unRAR sources cannot be used to re-create the RAR compression algorithm,
83
+      which is proprietary. Distribution of modified unRAR sources in separate form
84
+      or as a part of other software is permitted, provided that it is clearly
85
+      stated in the documentation and source comments that the code may
86
+      not be used to develop a RAR (WinRAR) compatible archiver.
87
+
88
+
89
+  --
90
+  Igor Pavlov

BIN
tools/7z.dll View File


BIN
tools/7z.exe View File


Loading…
Cancel
Save