2024-02-29 20:09:43 +00:00
|
|
|
{ runCommand, gdal, jdk, lib, testers }:
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (gdal) pname version;
|
|
|
|
|
|
|
|
in
|
2024-02-29 20:09:43 +00:00
|
|
|
{
|
|
|
|
ogrinfo-version = testers.testVersion {
|
|
|
|
package = gdal;
|
|
|
|
command = "ogrinfo --version";
|
|
|
|
};
|
|
|
|
|
|
|
|
gdalinfo-version = testers.testVersion {
|
|
|
|
package = gdal;
|
|
|
|
command = "gdalinfo --version";
|
|
|
|
};
|
|
|
|
|
|
|
|
ogrinfo-format-geopackage = runCommand "${pname}-ogrinfo-format-geopackage" { } ''
|
|
|
|
${lib.getExe' gdal "ogrinfo"} --formats \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GPKG.*GeoPackage'
|
2024-02-29 20:09:43 +00:00
|
|
|
touch $out
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
gdalinfo-format-geotiff = runCommand "${pname}-gdalinfo-format-geotiff" { } ''
|
|
|
|
${lib.getExe' gdal "gdalinfo"} --formats \
|
2023-08-04 22:07:22 +00:00
|
|
|
| grep 'GTiff.*GeoTIFF'
|
2024-02-29 20:09:43 +00:00
|
|
|
touch $out
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
vector-file = runCommand "${pname}-vector-file" { } ''
|
2023-08-04 22:07:22 +00:00
|
|
|
echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv
|
2024-02-29 20:09:43 +00:00
|
|
|
${lib.getExe' gdal "ogrinfo"} ./test.csv
|
|
|
|
touch $out
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
raster-file = runCommand "${pname}-raster-file" { } ''
|
|
|
|
${lib.getExe' gdal "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-02-29 20:09:43 +00:00
|
|
|
${lib.getExe' gdal "gdalinfo"} ./test.tif
|
|
|
|
touch $out
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
java-bindings = runCommand "${pname}-java-bindings" { } ''
|
2024-02-07 01:22:34 +00:00
|
|
|
cat <<EOF > main.java
|
|
|
|
import org.gdal.gdal.gdal;
|
|
|
|
class Main {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
gdal.AllRegister();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
2024-02-29 20:09:43 +00:00
|
|
|
${lib.getExe jdk} -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java
|
2023-08-04 22:07:22 +00:00
|
|
|
touch $out
|
2024-02-29 20:09:43 +00:00
|
|
|
'';
|
|
|
|
}
|