about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gdal/tests.nix
blob: 37b958706b32ccfaa2140a73b4c116ab7b406812 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ runCommand, gdal }:

let
  inherit (gdal) pname version;

in
runCommand "${pname}-tests" {
  nativeBuildInputs = [ gdal ];
  meta.timeout = 60;
} ''
    # test version
    ogrinfo --version \
      | grep 'GDAL ${version}'

    gdalinfo --version \
      | grep 'GDAL ${version}'


    # test formats
    ogrinfo --formats \
      | grep 'GPKG.*GeoPackage'

    gdalinfo --formats \
      | grep 'GTiff.*GeoTIFF'


    # test vector file
    echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv
    ogrinfo ./test.csv


    # test raster file
    gdal_create \
      -a_srs "EPSG:4326" \
      -of GTiff \
      -ot UInt16 \
      -a_nodata 255 \
      -burn 0 \
      -outsize 800 600 \
      -co COMPRESS=LZW \
      test.tif

    gdalinfo ./test.tif

    touch $out
  ''