diff --git a/examples/website/geospatial/app.tsx b/examples/website/geospatial/app.tsx index ef2025041c..d390dd92de 100644 --- a/examples/website/geospatial/app.tsx +++ b/examples/website/geospatial/app.tsx @@ -20,7 +20,7 @@ import {INITIAL_LOADER_NAME, INITIAL_EXAMPLE_NAME, INITIAL_MAP_STYLE, EXAMPLES} import {Table, GeoJSON} from '@loaders.gl/schema'; import {Loader, load /* registerLoaders */} from '@loaders.gl/core'; import {GeoArrowLoader} from '@loaders.gl/arrow'; -import {ParquetLoader, installBufferPolyfill} from '@loaders.gl/parquet'; +import {GeoParquetLoader, installBufferPolyfill} from '@loaders.gl/parquet'; import {FlatGeobufLoader} from '@loaders.gl/flatgeobuf'; import {ShapefileLoader} from '@loaders.gl/shapefile'; import {KMLLoader, GPXLoader, TCXLoader} from '@loaders.gl/kml'; @@ -32,7 +32,7 @@ installBufferPolyfill(); const LOADERS: Loader[] = [ GeoArrowLoader, - ParquetLoader, + GeoParquetLoader, FlatGeobufLoader, // GeoPackageLoader ShapefileLoader, diff --git a/modules/parquet/src/lib/parsers/parse-geoparquet.ts b/modules/parquet/src/lib/parsers/parse-geoparquet.ts index 85223d9046..260862346d 100644 --- a/modules/parquet/src/lib/parsers/parse-geoparquet.ts +++ b/modules/parquet/src/lib/parsers/parse-geoparquet.ts @@ -19,7 +19,8 @@ export async function parseGeoParquetFile( file: ReadableFile, options?: ParquetLoaderOptions ): Promise { - const table = await parseParquetFile(file, options); + + const table = await parseParquetFile(file, {...options, shape: 'object-row-table'}); const shape = options?.parquet?.shape; return convertTable(table, shape); } @@ -28,7 +29,7 @@ export async function* parseGeoParquetFileInBatches( file: ReadableFile, options?: ParquetLoaderOptions ): AsyncIterable { - const tableBatches = parseParquetFileInBatches(file, options); + const tableBatches = parseParquetFileInBatches(file, {...options, shape: 'object-row-table'}); for await (const batch of tableBatches) { const shape = options?.parquet?.shape; diff --git a/modules/parquet/src/lib/parsers/parse-parquet.ts b/modules/parquet/src/lib/parsers/parse-parquet.ts index 4135272f5a..9cec253855 100644 --- a/modules/parquet/src/lib/parsers/parse-parquet.ts +++ b/modules/parquet/src/lib/parsers/parse-parquet.ts @@ -88,6 +88,10 @@ function convertTable( case 'object-row-table': return objectRowTable; + // Hack until geoparquet fixes up forwarded shape + case 'geojson-table': + return objectRowTable; + default: throw new Error(shape); } diff --git a/modules/parquet/src/parquet-loader.ts b/modules/parquet/src/parquet-loader.ts index 3a87a4856a..14061d0300 100644 --- a/modules/parquet/src/parquet-loader.ts +++ b/modules/parquet/src/parquet-loader.ts @@ -120,7 +120,7 @@ export const GeoParquetLoader: LoaderWithParser< > = { ...GeoParquetWorkerLoader, parse(arrayBuffer: ArrayBuffer, options?: ParquetLoaderOptions) { - return parseParquetFile(new BlobFile(arrayBuffer), options); + return parseGeoParquetFile(new BlobFile(arrayBuffer), options); }, parseFile: parseGeoParquetFile, parseFileInBatches: parseGeoParquetFileInBatches