From 8fe256c4927cc23a4cf9a08bf454f1924390f461 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Tue, 25 Mar 2025 15:49:59 +0100
Subject: [PATCH] Updated documentation

---
 README.md                    | 50 ++++++++++++++++++++++++++----------
 download_LoD2_from_LGL_BW.py |  2 +-
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md
index 6e6416c..9bd9261 100644
--- a/README.md
+++ b/README.md
@@ -2,19 +2,23 @@
 
 Since June 2024, LoD2 CityGML files are available from Baden-Württemberg Opendata at https://opengeodata.lgl-bw.de/#/ .
 
-The server contain 3D models for whole Baden-Württemberg, but it only allows to download 2 tiles at most from the web interface. Zip files need to be extracted, merged into each other, and cut to the desired region.
+The server contain 3D models for whole Baden-Württemberg, but it only allows to download 5 tiles at most from the web interface. Zip files need to be extracted, merged into each other, and cut to the desired region.
 
-This script automates the whole process. All is needed is a name and a region, either specified as a WKT polygon or a Zipcode.
+This script automates the whole process.
 
-Multiple regions can be defined:
+All is needed is a name and a region, either specified as a WKT polygon, a Zipcode, or a comma separated list of Zipcodes..
 
 ```
-REGIONS = {
-    "StuttgartCenter": "POLYGON((9.175287 48.780916, 9.185501 48.777522, 9.181467 48.773704, 9.174429 48.768472, 9.168807 48.773902, 9.175287 48.780916))",
-    "Freiburg": "79098,79102"
-}
+python download_LoD2_from_LGL_BW.py StuttgartCenter "POLYGON((9.175287 48.780916, 9.185501 48.777522, 9.181467 48.773704, 9.174429 48.768472, 
+9.168807 48.773902, 9.175287 48.780916))"
+  python download_LoD2_from_LGL_BW.py Freiburg "79098,79102" --output-folder="/path/to/FreiburgFolder"
+  python download_LoD2_from_LGL_BW.py Möhringen "70567" --download-only
 ```
 
+By default, the CityGML files will be downloaded inside the folder containing the script, as a [Repository](https://simstadt.hft-stuttgart.de/getting-started/repository-structure/).
+
+## Example result
+
 ![freiburg_3d](./freiburg_3d.png)
 
 ## Requirements
@@ -26,9 +30,29 @@ REGIONS = {
 ## Usage
 
 * In order to be sure dependencies are installed, you can run `pip install -r requirements.txt` inside `get-bw-opendata` folder.
-* Specify desired regions in REGIONS inside `download_files_from_LGL_BW.py`:
-    * as WKT Polygon (https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry). For example from https://wktmap.com/
-    * as a ZipCode (e.g. `"70567"`)
-    * or a list of Zipcodes, separated by a comma (e.g. `"79098,79102"`)
-* Run `download_files_from_LGL_BW.py`.
-* Zip and CityGMLs files should be saved in corresponding subfolders, e.g. "StuttgartCenter.proj"
+
+```
+python download_LoD2_from_LGL_BW.py --help
+usage: download_LoD2_from_LGL_BW.py [-h] [--download-only] [--simstadt-folder SIMSTADT_FOLDER] [--output-folder OUTPUT_FOLDER] name region
+
+Download LoD2 CityGML tiles from LGL Baden-Württemberg and extract desired regions
+
+positional arguments:
+  name                  Name of the region. Output files will use this name.
+  region                Desired region as as WKT POLYGON/MULTIPOLYGON string or zipcode(s) (comma-separated).
+
+options:
+  -h, --help            show this help message and exit
+  --download-only       Only download files without extracting the region (default: False).
+  --simstadt-folder SIMSTADT_FOLDER
+                        Path to SimStadt installation folder. By default, tries to find it on the Desktop.
+  --output-folder OUTPUT_FOLDER
+                        Folder in which the tiles should be downloaded and extracted. By default, use the folder of the current script /        
+                        name.proj.
+
+Examples:
+  python download_LoD2_from_LGL_BW.py StuttgartCenter "POLYGON((9.175287 48.780916, 9.185501 48.777522, 9.181467 48.773704, 9.174429 48.768472, 
+9.168807 48.773902, 9.175287 48.780916))"
+  python download_LoD2_from_LGL_BW.py Freiburg "79098,79102" --output-folder="/path/to/FreiburgFolder"
+  python download_LoD2_from_LGL_BW.py Möhringen "70567" --download-only
+```
diff --git a/download_LoD2_from_LGL_BW.py b/download_LoD2_from_LGL_BW.py
index 2a62794..7bfcb64 100644
--- a/download_LoD2_from_LGL_BW.py
+++ b/download_LoD2_from_LGL_BW.py
@@ -229,7 +229,7 @@ Examples:
     )
 
     parser.add_argument('name', type=str,
-                        help='Name of the region (no spaces allowed). Output files will use this name.')
+                        help='Name of the region. Output files will use this name.')
 
     parser.add_argument('region', type=str,
                         help='Desired region as as WKT POLYGON/MULTIPOLYGON string or zipcode(s) (comma-separated).')
-- 
GitLab