viewtif 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viewtif
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Lightweight GeoTIFF, HDF/HDF5, and Esri File Geodatabase (.gdb) viewer with shapefile overlay and large-raster safeguard.
5
5
  Project-URL: Homepage, https://github.com/nkeikon/tifviewer
6
6
  Project-URL: Source, https://github.com/nkeikon/tifviewer
@@ -87,12 +87,16 @@ viewtif AG100.v003.33.-107.0001.h5 --subset 1 --band 3
87
87
 
88
88
  ### Update in v1.0.7: File Geodatabase (.gdb) support
89
89
  `viewtif` can now open raster datasets stored inside Esri File Geodatabases (`.gdb`), using the GDAL `OpenFileGDB` driver.
90
+ When you open a .gdb directly, `viewtif`` will list available raster datasets first, then you can choose one to view.
90
91
 
91
92
  ```bash
92
- # Example
93
+ # List available raster datasets
94
+ viewtif /path/to/geodatabase.gdb
95
+
96
+ # Open a specific raster
93
97
  viewtif "OpenFileGDB:/path/to/geodatabase.gdb:RasterName"
94
98
  ```
95
- > **Note:** Requires GDAL 3.7 or later with the OpenFileGDB driver enabled. The .gdb path and raster name must be separated by a colon (:).
99
+ > **Note:** Requires GDAL 3.7 or later with the OpenFileGDB driver enabled. If multiple raster datasets are present, viewtif lists them all and shows how to open each. The .gdb path and raster name must be separated by a colon (:).
96
100
 
97
101
  ### Update in v1.0.7: Large raster safeguard
98
102
  As of v1.0.7, `viewtif` automatically checks the raster size before loading.
@@ -67,12 +67,16 @@ viewtif AG100.v003.33.-107.0001.h5 --subset 1 --band 3
67
67
 
68
68
  ### Update in v1.0.7: File Geodatabase (.gdb) support
69
69
  `viewtif` can now open raster datasets stored inside Esri File Geodatabases (`.gdb`), using the GDAL `OpenFileGDB` driver.
70
+ When you open a .gdb directly, `viewtif`` will list available raster datasets first, then you can choose one to view.
70
71
 
71
72
  ```bash
72
- # Example
73
+ # List available raster datasets
74
+ viewtif /path/to/geodatabase.gdb
75
+
76
+ # Open a specific raster
73
77
  viewtif "OpenFileGDB:/path/to/geodatabase.gdb:RasterName"
74
78
  ```
75
- > **Note:** Requires GDAL 3.7 or later with the OpenFileGDB driver enabled. The .gdb path and raster name must be separated by a colon (:).
79
+ > **Note:** Requires GDAL 3.7 or later with the OpenFileGDB driver enabled. If multiple raster datasets are present, viewtif lists them all and shows how to open each. The .gdb path and raster name must be separated by a colon (:).
76
80
 
77
81
  ### Update in v1.0.7: Large raster safeguard
78
82
  As of v1.0.7, `viewtif` automatically checks the raster size before loading.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "viewtif"
7
- version = "0.1.7"
7
+ version = "0.1.9"
8
8
  description = "Lightweight GeoTIFF, HDF/HDF5, and Esri File Geodatabase (.gdb) viewer with shapefile overlay and large-raster safeguard."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -170,6 +170,26 @@ class TiffViewer(QMainWindow):
170
170
  self.tif_path = self.tif_path or (os.path.commonprefix([red, green, blue]) or red)
171
171
 
172
172
  elif tif_path:
173
+ # ---------------- Handle File Geodatabase (.gdb) ---------------- #
174
+ if tif_path.lower().endswith(".gdb") and ":" not in tif_path:
175
+ import re, subprocess
176
+ gdb_path = tif_path # use full path to .gdb
177
+ try:
178
+ out = subprocess.check_output(["gdalinfo", "-norat", gdb_path], text=True)
179
+ rasters = re.findall(r"RASTER_DATASET=(\S+)", out)
180
+ if not rasters:
181
+ print(f"[WARN] No raster datasets found in {os.path.basename(gdb_path)}.")
182
+ sys.exit(0)
183
+ else:
184
+ print(f"Found {len(rasters)} raster dataset{'s' if len(rasters) > 1 else ''}:")
185
+ for i, r in enumerate(rasters):
186
+ print(f"[{i}] {r}")
187
+ print("\nUse one of these names to open. For example, to open the first raster:")
188
+ print(f'viewtif "OpenFileGDB:{gdb_path}:{rasters[0]}"')
189
+ sys.exit(0)
190
+ except subprocess.CalledProcessError as e:
191
+ print(f"[WARN] Could not inspect FileGDB: {e}")
192
+ sys.exit(0)
173
193
  # --- Universal size check before loading ---
174
194
  warn_if_large(tif_path, scale=self._scale_arg)
175
195
  # --------------------- Detect HDF/HDF5 --------------------- #
@@ -678,7 +698,7 @@ def run_viewer(
678
698
  import click
679
699
 
680
700
  @click.command()
681
- @click.version_option("1.0.6", prog_name="viewtif")
701
+ @click.version_option("1.0.9", prog_name="viewtif")
682
702
  @click.argument("tif_path", required=False)
683
703
  @click.option("--band", default=1, show_default=True, type=int, help="Band number to display")
684
704
  @click.option("--scale", default=1.0, show_default=True, type=float, help="Scale factor for display")
File without changes
File without changes