depot/third_party/nixpkgs/pkgs/development/libraries/gdal/tests.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

44 lines
844 B
Nix

{ runCommand, gdal }:
let
inherit (gdal) pname version;
in
runCommand "${pname}-tests" { meta.timeout = 60; }
''
# test version
${gdal}/bin/ogrinfo --version \
| grep 'GDAL ${version}'
${gdal}/bin/gdalinfo --version \
| grep 'GDAL ${version}'
# test formats
${gdal}/bin/ogrinfo --formats \
| grep 'GPKG.*GeoPackage'
${gdal}/bin/gdalinfo --formats \
| grep 'GTiff.*GeoTIFF'
# test vector file
echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv
${gdal}/bin/ogrinfo ./test.csv
# test raster file
${gdal}/bin/gdal_create \
-a_srs "EPSG:4326" \
-of GTiff \
-ot UInt16 \
-a_nodata 255 \
-burn 0 \
-outsize 800 600 \
-co COMPRESS=LZW \
test.tif
${gdal}/bin/gdalinfo ./test.tif
touch $out
''