ImagesTiles & PictureCollection — Managing images

  • ``ImagesTiles`` — scan a directory of GeoTIFFs and manage them as tiled layers

  • ``PictureCollection`` — georeferenced photo management

Both inherit from Zones (which inherits from Element_To_Draw).

ImagesTiles — tiled raster images

ImagesTiles scans a directory for GeoTIFF files, extracts their spatial extent, and stores each as a zone/vector with an attached image.

[1]:
from wolfhece.images_tiles import ImagesTiles
from pathlib import Path

Usage

tiles = ImagesTiles(idx='ortho_tiles')

# Scan a directory for .tif files
tiles.scan_dir(Path('path/to/geotiffs/'), extensions=['tif', 'tiff'])

print(f"Found {len(tiles.myzones)} tiles")

# Each zone contains a vector with:
# - 4 vertices defining the bounding box
# - myprop.attachedimage -> Path to the GeoTIFF
# - myprop.imagevisible -> bool (auto-hidden if >8M pixels)

for z in tiles.myzones[:3]:
    v = z.myvectors[0]
    print(f"  {v.myprop.attachedimage.name}: visible={v.myprop.imagevisible}")

Adding to WolfMapViewer

viewer.add_object(which='imagestiles', newobj=tiles)

PictureCollection — georeferenced photos

PictureCollection manages photos positioned at real-world coordinates. Useful for field survey documentation, damage mapping, etc.

[2]:
from wolfhece.PyPictures import PictureCollection

Creating a collection

pics = PictureCollection(idx='field_photos')

# Add a photo at specific coordinates (Lambert 72)
pics.add_picture(
    picture='photos/damage_001.jpg',
    x=220150.0,
    y=130200.0,
    name='damage_001'
)

# Add to a specific zone (group)
pics.add_picture(
    picture='photos/bridge_north.jpg',
    x=220300.0,
    y=130100.0,
    name='bridge_north',
    keyzone='bridges'
)

Visibility control

pics.hide_all_pictures()   # set all imagevisible = False
pics.show_all_pictures()   # set all imagevisible = True

Extracting visible photos

# Copy all visible photos to a directory
pics.extract_pictures(Path('output/selected_photos/'))

Saving / loading

# Save as .vec file (Zones format)
pics.saveas('field_photos.vec')

# Reload
pics2 = PictureCollection(filename='field_photos.vec')

Summary

Class

Input

Key methods

ImagesTiles

Directory of GeoTIFFs

scan_dir(), scan_dir_ext()

PictureCollection

Individual photos + coordinates

add_picture(), show/hide_all_pictures(), extract_pictures()

Both classes can be loaded into WolfMapViewer for interactive viewing.