@loaders.gl/flatgeobuf 4.3.2 → 4.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ export { FlatGeobufFormat } from "./flatgeobuf-format.js";
1
2
  export type { FlatGeobufLoaderOptions } from "./flatgeobuf-loader.js";
2
3
  export { FlatGeobufLoader, FlatGeobufWorkerLoader } from "./flatgeobuf-loader.js";
4
+ export type { FlatGeobufSourceOptions } from "./flatgeobuf-source.js";
5
+ export { FlatGeobufSource as _FlatGeobufSource } from "./flatgeobuf-source.js";
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAC,uBAAuB,EAAC,+BAA4B;AACjE,OAAO,EAAC,gBAAgB,EAAE,sBAAsB,EAAC,+BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,gBAAgB,EAAC,+BAA4B;AAErD,YAAY,EAAC,uBAAuB,EAAC,+BAA4B;AACjE,OAAO,EAAC,gBAAgB,EAAE,sBAAsB,EAAC,+BAA4B;AAE7E,YAAY,EAAC,uBAAuB,EAAC,+BAA4B;AACjE,OAAO,EAAC,gBAAgB,IAAI,iBAAiB,EAAC,+BAA4B"}
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // loaders.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
+ export { FlatGeobufFormat } from "./flatgeobuf-format.js";
4
5
  export { FlatGeobufLoader, FlatGeobufWorkerLoader } from "./flatgeobuf-loader.js";
6
+ export { FlatGeobufSource as _FlatGeobufSource } from "./flatgeobuf-source.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/flatgeobuf",
3
3
  "description": "Loader for FlatGeobuf",
4
- "version": "4.3.2",
4
+ "version": "4.4.0-alpha.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {
@@ -44,9 +44,9 @@
44
44
  "build-worker": "esbuild src/workers/flatgeobuf-worker.ts --bundle --outfile=dist/flatgeobuf-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/gis": "4.3.2",
48
- "@loaders.gl/loader-utils": "4.3.2",
49
- "@loaders.gl/schema": "4.3.2",
47
+ "@loaders.gl/gis": "4.4.0-alpha.1",
48
+ "@loaders.gl/loader-utils": "4.4.0-alpha.1",
49
+ "@loaders.gl/schema": "4.4.0-alpha.1",
50
50
  "@math.gl/proj4": "^4.1.0",
51
51
  "flatgeobuf": "3.27.2"
52
52
  },
@@ -54,7 +54,7 @@
54
54
  "stream-buffers": "3.0.2"
55
55
  },
56
56
  "peerDependencies": {
57
- "@loaders.gl/core": "^4.3.0"
57
+ "@loaders.gl/core": "4.4.0-alpha.0"
58
58
  },
59
- "gitHead": "b4203b8703f64a38d6f79a3113bc7bb51d45c93a"
59
+ "gitHead": "f1732de45907bd500bf4eedb4803beca8bf4bfb0"
60
60
  }
@@ -0,0 +1,15 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Format} from '@loaders.gl/loader-utils';
6
+
7
+ /** flatgeobuf format */
8
+ export const FlatGeobufFormat = {
9
+ id: 'flatgeobuf',
10
+ name: 'FlatGeobuf',
11
+ module: 'flatgeobuf',
12
+ extensions: ['fgb'],
13
+ mimeTypes: ['application/octet-stream'],
14
+ category: 'geometry'
15
+ } as const satisfies Format;
@@ -9,6 +9,7 @@ import {
9
9
  parseFlatGeobufInBatches,
10
10
  ParseFlatGeobufOptions
11
11
  } from './lib/parse-flatgeobuf';
12
+ import {FlatGeobufFormat} from './flatgeobuf-format';
12
13
 
13
14
  // __VERSION__ is injected by babel-plugin-version-inline
14
15
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -32,17 +33,12 @@ export type FlatGeobufLoaderOptions = LoaderOptions & {
32
33
 
33
34
  /** Load flatgeobuf on a worker */
34
35
  export const FlatGeobufWorkerLoader = {
36
+ ...FlatGeobufFormat,
37
+
35
38
  dataType: null as any,
36
39
  batchType: null as any,
37
-
38
- id: 'flatgeobuf',
39
- name: 'FlatGeobuf',
40
- module: 'flatgeobuf',
41
40
  version: VERSION,
42
41
  worker: true,
43
- extensions: ['fgb'],
44
- mimeTypes: ['application/octet-stream'],
45
- category: 'geometry',
46
42
  tests: [new Uint8Array(FGB_MAGIC_NUMBER).buffer],
47
43
  options: {
48
44
  flatgeobuf: {
@@ -4,64 +4,51 @@
4
4
 
5
5
  import {Schema, GeoJSONTable} from '@loaders.gl/schema';
6
6
  import type {
7
- VectorSourceProps,
7
+ DataSourceOptions,
8
8
  VectorSourceMetadata,
9
- GetFeaturesParameters,
10
- LoaderWithParser
9
+ GetFeaturesParameters
11
10
  } from '@loaders.gl/loader-utils';
12
- import {Source, VectorSource} from '@loaders.gl/loader-utils';
11
+ import {Source, DataSource, VectorSource} from '@loaders.gl/loader-utils';
13
12
 
14
13
  import {FlatGeobufLoader} from './flatgeobuf-loader';
14
+ import {FlatGeobufFormat} from './flatgeobuf-format';
15
+
16
+ export type FlatGeobufSourceOptions = DataSourceOptions & {
17
+ flatgeobuf?: {};
18
+ };
15
19
 
16
20
  /**
21
+ * FlatGeobufSource
22
+ * Incrementally load bounding boxes from a spatially indexed FlatGeobuf file
17
23
  * @ndeprecated This is a WIP, not fully implemented
18
- * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
19
24
  */
20
25
  export const FlatGeobufSource = {
21
- name: 'FlatGeobuf',
22
- id: 'flatgeobuf-server',
23
- module: 'wms',
26
+ ...FlatGeobufFormat,
24
27
  version: '0.0.0',
25
- extensions: [],
26
- mimeTypes: [],
27
- options: {
28
- url: undefined!,
29
- 'flatgeobuf-server': {
30
- /** Tabular loaders, normally the GeoJSONLoader */
31
- loaders: []
32
- }
33
- },
34
-
35
28
  type: 'flatgeobuf-server',
36
29
  fromUrl: true,
37
30
  fromBlob: false, // TODO check if supported by library?
38
31
 
39
- testURL: (url: string): boolean => url.toLowerCase().includes('FeatureServer'),
40
- createDataSource: (url, props: FlatGeobufVectorSourceProps): FlatGeobufVectorSource =>
41
- new FlatGeobufVectorSource(props)
42
- } as const satisfies Source<FlatGeobufVectorSource, FlatGeobufVectorSourceProps>;
32
+ defaultOptions: {
33
+ flatgeobuf: {}
34
+ },
43
35
 
44
- export type FlatGeobufVectorSourceProps = VectorSourceProps & {
45
- url: string;
46
- 'flatgeobuf-server'?: {
47
- loaders: LoaderWithParser[];
48
- };
49
- };
36
+ testURL: (url: string): boolean => url.toLowerCase().includes('FeatureServer'),
37
+ createDataSource: (url: string, options: FlatGeobufSourceOptions): FlatGeobufVectorSource =>
38
+ new FlatGeobufVectorSource(url, options)
39
+ } as const satisfies Source<FlatGeobufVectorSource>;
50
40
 
51
41
  /**
52
- * ArcGIS ImageServer
53
- * Note - exports a big API, that could be exposed here if there is a use case
54
- * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
42
+ * FlatGeobufVectorSource
55
43
  */
56
- export class FlatGeobufVectorSource extends VectorSource<FlatGeobufVectorSourceProps> {
57
- data: string;
58
- url: string;
44
+ export class FlatGeobufVectorSource
45
+ extends DataSource<string, FlatGeobufSourceOptions>
46
+ implements VectorSource
47
+ {
59
48
  protected formatSpecificMetadata: Promise<any> | null = null;
60
49
 
61
- constructor(props: FlatGeobufVectorSourceProps) {
62
- super(props);
63
- this.data = props.url;
64
- this.url = props.url;
50
+ constructor(data: string, options: FlatGeobufSourceOptions) {
51
+ super(data, options, FlatGeobufSource.defaultOptions);
65
52
  // this.formatSpecificMetadata = this._getFormatSpecificMetadata();
66
53
  }
67
54
 
@@ -93,7 +80,7 @@ export class FlatGeobufVectorSource extends VectorSource<FlatGeobufVectorSourceP
93
80
  // TODO - hack - done to avoid pulling in selectLoader from core
94
81
 
95
82
  const table = await FlatGeobufLoader.parse(arrayBuffer, {});
96
- // const loader = this.props['flatgeobuf-server']?.loaders?.[0];
83
+ // const loader = this.options['flatgeobuf-server']?.loaders?.[0];
97
84
  // const table = loader?.parse(arrayBuffer);
98
85
  return table as GeoJSONTable;
99
86
  }
package/src/index.ts CHANGED
@@ -2,5 +2,10 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ export {FlatGeobufFormat} from './flatgeobuf-format';
6
+
5
7
  export type {FlatGeobufLoaderOptions} from './flatgeobuf-loader';
6
8
  export {FlatGeobufLoader, FlatGeobufWorkerLoader} from './flatgeobuf-loader';
9
+
10
+ export type {FlatGeobufSourceOptions} from './flatgeobuf-source';
11
+ export {FlatGeobufSource as _FlatGeobufSource} from './flatgeobuf-source';
@@ -1,51 +0,0 @@
1
- import { Schema, GeoJSONTable } from '@loaders.gl/schema';
2
- import type { VectorSourceProps, VectorSourceMetadata, GetFeaturesParameters, LoaderWithParser } from '@loaders.gl/loader-utils';
3
- import { VectorSource } from '@loaders.gl/loader-utils';
4
- /**
5
- * @ndeprecated This is a WIP, not fully implemented
6
- * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
7
- */
8
- export declare const FlatGeobufSource: {
9
- readonly name: "FlatGeobuf";
10
- readonly id: "flatgeobuf-server";
11
- readonly module: "wms";
12
- readonly version: "0.0.0";
13
- readonly extensions: [];
14
- readonly mimeTypes: [];
15
- readonly options: {
16
- readonly url: never;
17
- readonly 'flatgeobuf-server': {
18
- /** Tabular loaders, normally the GeoJSONLoader */
19
- readonly loaders: [];
20
- };
21
- };
22
- readonly type: "flatgeobuf-server";
23
- readonly fromUrl: true;
24
- readonly fromBlob: false;
25
- readonly testURL: (url: string) => boolean;
26
- readonly createDataSource: (url: string | Blob, props: FlatGeobufVectorSourceProps) => FlatGeobufVectorSource;
27
- };
28
- export type FlatGeobufVectorSourceProps = VectorSourceProps & {
29
- url: string;
30
- 'flatgeobuf-server'?: {
31
- loaders: LoaderWithParser[];
32
- };
33
- };
34
- /**
35
- * ArcGIS ImageServer
36
- * Note - exports a big API, that could be exposed here if there is a use case
37
- * @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
38
- */
39
- export declare class FlatGeobufVectorSource extends VectorSource<FlatGeobufVectorSourceProps> {
40
- data: string;
41
- url: string;
42
- protected formatSpecificMetadata: Promise<any> | null;
43
- constructor(props: FlatGeobufVectorSourceProps);
44
- /** TODO - not yet clear if we can find schema information in the FeatureServer metadata or if we need to request a feature */
45
- getSchema(): Promise<Schema>;
46
- getMetadata(options: {
47
- formatSpecificMetadata: any;
48
- }): Promise<VectorSourceMetadata>;
49
- getFeatures(parameters: GetFeaturesParameters): Promise<GeoJSONTable>;
50
- }
51
- //# sourceMappingURL=floatgeobuf-source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"floatgeobuf-source.d.ts","sourceRoot":"","sources":["../src/floatgeobuf-source.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAS,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAI9D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;YAUvB,kDAAkD;;;;;;;4BASvC,MAAM,KAAG,OAAO;2DACA,2BAA2B,KAAG,sBAAsB;CAEL,CAAC;AAEjF,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,GAAG;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB,CAAC,EAAE;QACpB,OAAO,EAAE,gBAAgB,EAAE,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,YAAY,CAAC,2BAA2B,CAAC;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;gBAEjD,KAAK,EAAE,2BAA2B;IAO9C,8HAA8H;IACxH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAK5B,WAAW,CAAC,OAAO,EAAE;QAAC,sBAAsB,MAAA;KAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB7E,WAAW,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC;CAU5E"}