viewtif 0.1.2__tar.gz → 0.1.4__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.2
3
+ Version: 0.1.4
4
4
  Summary: Simple GeoTIFF viewer with optional shapefile overlay.
5
5
  Project-URL: Homepage, https://github.com/nkeikon/tifviewer
6
6
  Project-URL: Source, https://github.com/nkeikon/tifviewer
@@ -13,6 +13,9 @@ Requires-Dist: matplotlib>=3.7
13
13
  Requires-Dist: numpy>=1.23
14
14
  Requires-Dist: pyside6>=6.5
15
15
  Requires-Dist: rasterio>=1.3
16
+ Provides-Extra: geo
17
+ Requires-Dist: geopandas>=0.13; extra == 'geo'
18
+ Requires-Dist: shapely>=2.0; extra == 'geo'
16
19
  Description-Content-Type: text/markdown
17
20
 
18
21
  # viewtif
@@ -29,6 +32,13 @@ You can visualize single-band GeoTIFFs, RGB composites, and shapefile overlays i
29
32
  pip install viewtif
30
33
  ```
31
34
 
35
+ If you want to enable shapefile overlays, install with optional dependencies:
36
+ ```bash
37
+ pip install "viewtif[geo]"
38
+ ```
39
+ Note for macOS(zsh) users:
40
+ Make sure to include the quotes, or zsh will interpret it as a pattern.
41
+
32
42
  ## Quick Start
33
43
  ```bash
34
44
  # View a GeoTIFF
@@ -12,6 +12,13 @@ You can visualize single-band GeoTIFFs, RGB composites, and shapefile overlays i
12
12
  pip install viewtif
13
13
  ```
14
14
 
15
+ If you want to enable shapefile overlays, install with optional dependencies:
16
+ ```bash
17
+ pip install "viewtif[geo]"
18
+ ```
19
+ Note for macOS(zsh) users:
20
+ Make sure to include the quotes, or zsh will interpret it as a pattern.
21
+
15
22
  ## Quick Start
16
23
  ```bash
17
24
  # View a GeoTIFF
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "viewtif"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = "Simple GeoTIFF viewer with optional shapefile overlay."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -18,6 +18,9 @@ dependencies = [
18
18
  "PySide6>=6.5"
19
19
  ]
20
20
 
21
+ [project.optional-dependencies]
22
+ geo = ["geopandas>=0.13", "shapely>=2.0"]
23
+
21
24
  [project.scripts]
22
25
  viewtif = "viewtif.tif_viewer:main"
23
26
 
@@ -74,8 +74,8 @@ class TiffViewer(QMainWindow):
74
74
  rgb: list[int] | None = None,
75
75
  rgbfiles: list[str] | None = None,
76
76
  shapefiles: list[str] | None = None,
77
- shp_color: str = "cyan",
78
- shp_width: float = 1.5,
77
+ shp_color: str = "white",
78
+ shp_width: float = 2,
79
79
  ):
80
80
  super().__init__()
81
81
 
@@ -482,14 +482,36 @@ def run_viewer(
482
482
  import click
483
483
 
484
484
  @click.command()
485
- @click.argument("tif_path")
485
+ @click.argument("tif_path", required=False)
486
486
  @click.option("--band", default=1, show_default=True, type=int, help="Band number to display")
487
487
  @click.option("--scale", default=1.0, show_default=True, type=float, help="Scale factor for display")
488
- @click.option("--shapefile", type=str, help="Optional shapefile to overlay")
489
- @click.option("--shp-width", default=1.0, show_default=True, type=float, help="Line width for shapefile overlay")
490
- def main(tif_path, band, scale, shapefile, shp_width):
488
+ @click.option("--rgb", nargs=3, type=int, help="Three band numbers for RGB, e.g. --rgb 4 3 2")
489
+ @click.option("--rgbfiles", nargs=3, type=str, help="Three single-band TIFFs for RGB, e.g. --rgbfiles B4.tif B3.tif B2.tif")
490
+ @click.option("--shapefile", multiple=True, type=str, help="One or more shapefiles to overlay")
491
+ @click.option("--shp-color", default="white", show_default=True, help="Overlay color (name or #RRGGBB).")
492
+ @click.option("--shp-width", default=1.0, show_default=True, type=float, help="Overlay line width (screen pixels).")
493
+ def main(tif_path, band, scale, rgb, rgbfiles, shapefile, shp_color, shp_width):
491
494
  """Lightweight GeoTIFF viewer."""
492
- run_viewer(tif_path, scale=scale, band=band, shapefile=shapefile, shp_width=shp_width)
495
+
496
+ # --- Warn early if shapefile requested but geopandas missing ---
497
+ if shapefile and not HAVE_GEO:
498
+ print(
499
+ "[WARN] --shapefile requires geopandas and shapely.\n"
500
+ " Install them with: pip install viewtif[geo]\n"
501
+ " Proceeding without shapefile overlay."
502
+ )
503
+
504
+ run_viewer(
505
+ tif_path,
506
+ scale=scale,
507
+ band=band,
508
+ rgb=rgb,
509
+ rgbfiles=rgbfiles,
510
+ shapefile=shapefile,
511
+ shp_color=shp_color,
512
+ shp_width=shp_width,
513
+ )
514
+
493
515
 
494
516
  if __name__ == "__main__":
495
517
  main()
File without changes
File without changes