duckdb_spatial
duckdb_spatial copied to clipboard
Specify format to ST_READ when feeding data via stdin?
Can ST_READ
be given a file format or can that only be inferred from a filename? I was hoping something like the following would work but I'm getting ERROR 4: `/dev/stdin' not recognized as a supported file format.
$ unzip -p test.zip land.gpkg \
| ~/duckdb_spatial/build/release/duckdb \
-unsigned \
-json \
-c "SELECT * EXCLUDE(geom),
ST_AsHEXWKB(
ST_GeomFromWkb(geom))::TEXT AS geom,
printf('%x', h3_latlng_to_cell(
ST_Y(ST_CENTROID(ST_GeomFromWkb(geom))),
ST_X(ST_CENTROID(ST_GeomFromWkb(geom))),
7)::bigint) as h3_7,
printf('%x', h3_latlng_to_cell(
ST_Y(ST_CENTROID(ST_GeomFromWkb(geom))),
ST_X(ST_CENTROID(ST_GeomFromWkb(geom))),
8)::bigint) as h3_8,
printf('%x', h3_latlng_to_cell(
ST_Y(ST_CENTROID(ST_GeomFromWkb(geom))),
ST_X(ST_CENTROID(ST_GeomFromWkb(geom))),
9)::bigint) as h3_9
FROM st_read('/dev/stdin')" \
| jq -S .