depot/third_party/nixpkgs/pkgs/development/libraries/gdal/tests.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

46 lines
792 B
Nix

{ 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
''