-
I expected the bounding box column (bbox) to be generated automatically in my GeoParquet output, as described in the Radiant Earth blog and related discussions. I ran a COPY TO with the spatial extension loaded, using this (simplified for clarity): LOAD spatial;
COPY (
SELECT
ST_Hilbert(geom, (SELECT ST_Extent(ST_Extent_Agg(geom))::BOX_2D FROM st_read('input.gpkg'))) AS hilbert_order,
*,
geom -- renamed from msGeometry
FROM st_read('input.gpkg')
ORDER BY hilbert_order
)
TO 'output_dir/' (
FORMAT PARQUET,
COMPRESSION 'zstd',
ROW_GROUP_SIZE 100000,
PARTITION_BY (some_region_code),
OVERWRITE_OR_IGNORE
); I did not manually include ST_Envelope(geom) in the query, because I understood that the bbox column would be created automatically during the export. After exporting, I ran:
And the output shows no bbox or geometry_bbox field — only geom. Is the bbox column supposed to be created automatically by COPY TO when the spatial extension is loaded? Or must I explicitly compute it with ST_Envelope() in the SELECT clause? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
From a GeoParquet perspective it'd be ideal if it was created automatically (or at least had an option to), if writing GeoParquet 1.1, but it's not currently supported (apologies for the mis-information on that blog, I'll correct it now - I only realized a couple months later that it doesn't actually write the bbox, as I had just happened to be mostly working with files like Overture that include the bbox). The call to create the bbox is a bit non-obvious, as writing out with ST_Envelope() doesn't exactly match the GeoParquet spec. But you can do it with a call like:
Note that this doesn't actually add the GeoParquet covering / bbox metadata, so it's not technically spec compliant (but some libraries will take advantage of it). A couple other notes:
|
Beta Was this translation helpful? Give feedback.
From a GeoParquet perspective it'd be ideal if it was created automatically (or at least had an option to), if writing GeoParquet 1.1, but it's not currently supported (apologies for the mis-information on that blog, I'll correct it now - I only realized a couple months later that it doesn't actually write the bbox, as I had just happened to be mostly working with files like Overture that include the bbox). The call to create the bbox is a bit non-obvious, as writing out with ST_Envelope() doesn't exactly match …