1 #!/usr/bin/env -S guile -s
4 (add-to-load-path "../..")
6 (use-modules (rnrs bytevectors))
10 ;; read dataset using the binding functions
12 (let* ((dataset (open-dataset "raster-small.txt" GA_READONLY))
13 (h-band (get-raster-band dataset 1))
14 (x-size (get-raster-band-x-size h-band))
15 (y-size (get-raster-band-y-size h-band))
16 (size (* x-size y-size))
17 (bv (make-s32vector size)))
19 (raster-io h-band GF_READ 0 0 x-size y-size bv x-size y-size GDT_INT32 0 0)
20 (for-each (lambda (i) (format #t "~a " (s32vector-ref bv i)))
25 ;; and using the helper functions in the extesion module
27 (use-modules (gdal extension))
29 (let* ((dataset (open-dataset "raster-small.txt" GA_READONLY))
30 (h-band (get-raster-band dataset 1))
31 (buf (make-buffer-all-from-band h-band GDT_INT32)))
32 (for-each-pixel (lambda (p) (format #t "~a " p)) buf))