viewtif 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
viewtif/tif_viewer.py CHANGED
@@ -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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viewtif
3
- Version: 0.1.2
3
+ Version: 0.1.3
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
@@ -0,0 +1,5 @@
1
+ viewtif/tif_viewer.py,sha256=MGOSrYYe5rJpJRALTNQIHii8JNb5I8vMlo3Edlb09vA,19891
2
+ viewtif-0.1.3.dist-info/METADATA,sha256=AvnZVyR2afhkfRIyNv4FAAc3i-yLnfdEA__5jck7HGc,3174
3
+ viewtif-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ viewtif-0.1.3.dist-info/entry_points.txt,sha256=NVEjlRyJ7R7hFPOVsZJio3Hl0VqlX7_oVfA7819XvHM,52
5
+ viewtif-0.1.3.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- viewtif/tif_viewer.py,sha256=bzSaCKpBU3sYVT6O3VRn2tNIqoWsio7WEWf0HhQ11wM,19056
2
- viewtif-0.1.2.dist-info/METADATA,sha256=Erm3aXwL7fXXAXERxdi4HwYlyfPzIyVWVtBijf9iPgs,3063
3
- viewtif-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- viewtif-0.1.2.dist-info/entry_points.txt,sha256=NVEjlRyJ7R7hFPOVsZJio3Hl0VqlX7_oVfA7819XvHM,52
5
- viewtif-0.1.2.dist-info/RECORD,,