Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Nov 29, 2023
1 parent a371cad commit 6b252f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/website/geospatial/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -32,7 +32,7 @@ installBufferPolyfill();

const LOADERS: Loader[] = [
GeoArrowLoader,
ParquetLoader,
GeoParquetLoader,
FlatGeobufLoader,
// GeoPackageLoader
ShapefileLoader,
Expand Down
5 changes: 3 additions & 2 deletions modules/parquet/src/lib/parsers/parse-geoparquet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export async function parseGeoParquetFile(
file: ReadableFile,
options?: ParquetLoaderOptions
): Promise<ObjectRowTable | GeoJSONTable> {
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);
}
Expand All @@ -28,7 +29,7 @@ export async function* parseGeoParquetFileInBatches(
file: ReadableFile,
options?: ParquetLoaderOptions
): AsyncIterable<ObjectRowTableBatch | GeoJSONTableBatch> {
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;
Expand Down
4 changes: 4 additions & 0 deletions modules/parquet/src/lib/parsers/parse-parquet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/parquet/src/parquet-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b252f5

Please sign in to comment.