2024-02-07 01:22:34 +00:00
|
|
|
{ runCommand, gdal, jdk }:
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (gdal) pname version;
|
|
|
|
|
|
|
|
in
|
2024-01-02 11:29:13 +00:00
|
|
|
runCommand "${pname}-tests" { meta.timeout = 60; }
|
|
|
|
''
|
2023-08-04 22:07:22 +00:00
|
|
|
# test version
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/ogrinfo --version \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GDAL ${version}'
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/gdalinfo --version \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GDAL ${version}'
|
|
|
|
|
|
|
|
|
|
|
|
# test formats
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/ogrinfo --formats \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GPKG.*GeoPackage'
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/gdalinfo --formats \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GTiff.*GeoTIFF'
|
|
|
|
|
|
|
|
|
|
|
|
# test vector file
|
|
|
|
echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/ogrinfo ./test.csv
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
# test raster file
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/gdal_create \
|
2023-08-04 22:07:22 +00:00
|
|
|
-a_srs "EPSG:4326" \
|
|
|
|
-of GTiff \
|
|
|
|
-ot UInt16 \
|
|
|
|
-a_nodata 255 \
|
|
|
|
-burn 0 \
|
|
|
|
-outsize 800 600 \
|
|
|
|
-co COMPRESS=LZW \
|
|
|
|
test.tif
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
${gdal}/bin/gdalinfo ./test.tif
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
# test java bindings
|
|
|
|
cat <<EOF > main.java
|
|
|
|
import org.gdal.gdal.gdal;
|
|
|
|
class Main {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
gdal.AllRegister();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
${jdk}/bin/java -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
touch $out
|
|
|
|
''
|