@loaders.gl/flatgeobuf 4.3.1 → 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.
@@ -206,6 +206,16 @@
206
206
  return await parser(data, { ...options }, context, loader);
207
207
  }
208
208
 
209
+ // src/flatgeobuf-format.ts
210
+ var FlatGeobufFormat = {
211
+ id: "flatgeobuf",
212
+ name: "FlatGeobuf",
213
+ module: "flatgeobuf",
214
+ extensions: ["fgb"],
215
+ mimeTypes: ["application/octet-stream"],
216
+ category: "geometry"
217
+ };
218
+
209
219
  // ../../node_modules/proj4/lib/global.js
210
220
  function global_default(defs2) {
211
221
  defs2("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
@@ -5559,7 +5569,7 @@
5559
5569
  }
5560
5570
  };
5561
5571
 
5562
- // ../gis/src/lib/binary-features/transform.ts
5572
+ // ../gis/src/lib/binary-geometry-api/transform-coordinates.ts
5563
5573
  function transformGeoJsonCoords(features, fn) {
5564
5574
  for (const feature of features) {
5565
5575
  feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);
@@ -5578,209 +5588,6 @@
5578
5588
  return Array.isArray(array) && Number.isFinite(array[0]) && Number.isFinite(array[1]);
5579
5589
  }
5580
5590
 
5581
- // src/lib/binary-geometries.ts
5582
- function fgbToBinaryGeometry(geometry, type) {
5583
- if (geometry === null) {
5584
- return null;
5585
- }
5586
- switch (type) {
5587
- case GeometryType.Point:
5588
- case GeometryType.MultiPoint:
5589
- return parsePoint(geometry);
5590
- case GeometryType.LineString:
5591
- case GeometryType.MultiLineString:
5592
- return parseLines(geometry);
5593
- case GeometryType.Polygon:
5594
- return parsePolygons(geometry);
5595
- case GeometryType.MultiPolygon:
5596
- return parseMultiPolygons(geometry);
5597
- default:
5598
- throw new Error(`Unimplemented geometry type: ${type}`);
5599
- }
5600
- }
5601
- function parsePoint(geometry) {
5602
- const xy = geometry.xyArray();
5603
- const z = geometry.zArray();
5604
- const positions = blitArrays(xy, z);
5605
- return { positions };
5606
- }
5607
- function parseLines(geometry) {
5608
- const xy = geometry.xyArray();
5609
- const z = geometry.zArray();
5610
- const positions = blitArrays(xy, z);
5611
- const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5612
- ends.unshift(0);
5613
- const pathIndices = { value: new Uint16Array(ends), size: 1 };
5614
- return {
5615
- positions,
5616
- pathIndices
5617
- };
5618
- }
5619
- function parsePolygons(geometry) {
5620
- const xy = geometry.xyArray();
5621
- const z = geometry.zArray();
5622
- const positions = blitArrays(xy, z);
5623
- const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5624
- ends.unshift(0);
5625
- const primitivePolygonIndices = { value: new Uint16Array(ends), size: 1 };
5626
- const polygonIndices = { value: new Uint16Array([0, xy.length / 2]), size: 1 };
5627
- return {
5628
- positions,
5629
- primitivePolygonIndices,
5630
- polygonIndices
5631
- };
5632
- }
5633
- function parseMultiPolygons(geometry) {
5634
- const parsedParts = [];
5635
- let nPositions = 0;
5636
- let nPrimitivePolygonIndices = 1;
5637
- let nPolygonIndices = 1;
5638
- for (let i = 0; i < geometry.partsLength(); i++) {
5639
- const part = geometry.parts(i);
5640
- const polygon = parsePolygons(part);
5641
- nPositions += polygon.positions.value.length;
5642
- nPrimitivePolygonIndices += polygon.primitivePolygonIndices.value.length - 1;
5643
- nPolygonIndices += polygon.polygonIndices.value.length - 1;
5644
- parsedParts.push(polygon);
5645
- }
5646
- const concatPositions = new Float64Array(nPositions);
5647
- const concatPrimitivePolygonIndices = new Uint32Array(nPrimitivePolygonIndices);
5648
- const concatPolygonIndices = new Uint32Array(nPolygonIndices);
5649
- let positionCounter = 0;
5650
- let primitivePolygonIndicesCounter = 1;
5651
- let polygonIndicesCounter = 1;
5652
- const positionSize = parsedParts[0].positions.size;
5653
- for (const parsedPart of parsedParts) {
5654
- concatPositions.set(parsedPart.positions.value, positionCounter * positionSize);
5655
- concatPrimitivePolygonIndices.set(
5656
- // eslint-disable-next-line
5657
- parsedPart.primitivePolygonIndices.value.subarray(1).map((x) => x + positionCounter),
5658
- primitivePolygonIndicesCounter
5659
- );
5660
- concatPolygonIndices.set(
5661
- // eslint-disable-next-line
5662
- parsedPart.polygonIndices.value.subarray(1).map((x) => x + positionCounter),
5663
- polygonIndicesCounter
5664
- );
5665
- positionCounter += parsedPart.positions.value.length / positionSize;
5666
- primitivePolygonIndicesCounter += parsedPart.primitivePolygonIndices.value.length - 1;
5667
- polygonIndicesCounter += parsedPart.polygonIndices.value.length - 1;
5668
- }
5669
- return {
5670
- positions: { value: concatPositions, size: positionSize },
5671
- primitivePolygonIndices: { value: concatPrimitivePolygonIndices, size: 1 },
5672
- polygonIndices: { value: concatPolygonIndices, size: 1 }
5673
- };
5674
- }
5675
- function blitArrays(xy, z) {
5676
- if (!z) {
5677
- return { value: xy, size: 2 };
5678
- }
5679
- if (z.length * 2 !== xy.length) {
5680
- throw new Error("Z array must be half XY array's length");
5681
- }
5682
- const totalLength = xy.length + z.length;
5683
- const xyz = new Float64Array(totalLength);
5684
- for (let i = 0; i < xy.length / 2; i++) {
5685
- xyz[i * 3 + 0] = xy[i * 2 + 0];
5686
- xyz[i * 3 + 1] = xy[i * 2 + 1];
5687
- xyz[i * 3 + 2] = z[i];
5688
- }
5689
- return { value: xyz, size: 3 };
5690
- }
5691
-
5692
- // src/lib/get-schema-from-fgb-header.ts
5693
- function getSchemaFromFGBHeader(fgbHeader) {
5694
- const metadata = {
5695
- title: fgbHeader.title || "",
5696
- description: fgbHeader.description || "",
5697
- crs: JSON.stringify(fgbHeader.crs) || "",
5698
- metadata: fgbHeader.metadata || "",
5699
- geometryType: String(fgbHeader.geometryType),
5700
- indexNodeSize: String(fgbHeader.indexNodeSize),
5701
- featureCount: String(fgbHeader.featuresCount),
5702
- bounds: fgbHeader.envelope?.join(",") || ""
5703
- };
5704
- const fields = fgbHeader.columns?.map((column) => getFieldFromFGBColumn(column)) || [];
5705
- return { metadata, fields };
5706
- }
5707
- function getFieldFromFGBColumn(fgbColumn) {
5708
- const metadata = {
5709
- title: fgbColumn.title || "",
5710
- description: fgbColumn.description || "",
5711
- width: String(fgbColumn.width),
5712
- precision: String(fgbColumn.precision),
5713
- scale: String(fgbColumn.scale),
5714
- unique: String(fgbColumn.unique),
5715
- primary_key: String(fgbColumn.primary_key)
5716
- };
5717
- return {
5718
- name: fgbColumn.name,
5719
- type: getTypeFromFGBType(fgbColumn.type),
5720
- nullable: fgbColumn.nullable,
5721
- metadata
5722
- };
5723
- }
5724
- function getTypeFromFGBType(fgbType) {
5725
- switch (fgbType) {
5726
- case 0 /* Byte */:
5727
- return "int8";
5728
- case 1 /* UByte */:
5729
- return "uint8";
5730
- case 2 /* Bool */:
5731
- return "bool";
5732
- case 3 /* Short */:
5733
- return "int16";
5734
- case 4 /* UShort */:
5735
- return "uint16";
5736
- case 5 /* Int */:
5737
- return "int32";
5738
- case 6 /* UInt */:
5739
- return "uint32";
5740
- case 7 /* Long */:
5741
- return "int64";
5742
- case 8 /* ULong */:
5743
- return "uint64";
5744
- case 9 /* Float */:
5745
- return "float32";
5746
- case 10 /* Double */:
5747
- return "float64";
5748
- case 11 /* String */:
5749
- return "utf8";
5750
- case 12 /* Json */:
5751
- return "null";
5752
- case 13 /* DateTime */:
5753
- return "date-millisecond";
5754
- case 14 /* Binary */:
5755
- return "binary";
5756
- default:
5757
- return "null";
5758
- }
5759
- }
5760
-
5761
- // src/flatgeobuf/3.27.2/flat-geobuf/geometry-type.ts
5762
- var GeometryType2 = /* @__PURE__ */ ((GeometryType3) => {
5763
- GeometryType3[GeometryType3["Unknown"] = 0] = "Unknown";
5764
- GeometryType3[GeometryType3["Point"] = 1] = "Point";
5765
- GeometryType3[GeometryType3["LineString"] = 2] = "LineString";
5766
- GeometryType3[GeometryType3["Polygon"] = 3] = "Polygon";
5767
- GeometryType3[GeometryType3["MultiPoint"] = 4] = "MultiPoint";
5768
- GeometryType3[GeometryType3["MultiLineString"] = 5] = "MultiLineString";
5769
- GeometryType3[GeometryType3["MultiPolygon"] = 6] = "MultiPolygon";
5770
- GeometryType3[GeometryType3["GeometryCollection"] = 7] = "GeometryCollection";
5771
- GeometryType3[GeometryType3["CircularString"] = 8] = "CircularString";
5772
- GeometryType3[GeometryType3["CompoundCurve"] = 9] = "CompoundCurve";
5773
- GeometryType3[GeometryType3["CurvePolygon"] = 10] = "CurvePolygon";
5774
- GeometryType3[GeometryType3["MultiCurve"] = 11] = "MultiCurve";
5775
- GeometryType3[GeometryType3["MultiSurface"] = 12] = "MultiSurface";
5776
- GeometryType3[GeometryType3["Curve"] = 13] = "Curve";
5777
- GeometryType3[GeometryType3["Surface"] = 14] = "Surface";
5778
- GeometryType3[GeometryType3["PolyhedralSurface"] = 15] = "PolyhedralSurface";
5779
- GeometryType3[GeometryType3["TIN"] = 16] = "TIN";
5780
- GeometryType3[GeometryType3["Triangle"] = 17] = "Triangle";
5781
- return GeometryType3;
5782
- })(GeometryType2 || {});
5783
-
5784
5591
  // ../../node_modules/flatbuffers/mjs/constants.js
5785
5592
  var SIZEOF_INT = 4;
5786
5593
  var FILE_IDENTIFIER_LENGTH = 4;
@@ -6043,6 +5850,209 @@
6043
5850
  }
6044
5851
  };
6045
5852
 
5853
+ // src/lib/binary-geometries.ts
5854
+ function fgbToBinaryGeometry(geometry, type) {
5855
+ if (geometry === null) {
5856
+ return null;
5857
+ }
5858
+ switch (type) {
5859
+ case GeometryType.Point:
5860
+ case GeometryType.MultiPoint:
5861
+ return parsePoint(geometry);
5862
+ case GeometryType.LineString:
5863
+ case GeometryType.MultiLineString:
5864
+ return parseLines(geometry);
5865
+ case GeometryType.Polygon:
5866
+ return parsePolygons(geometry);
5867
+ case GeometryType.MultiPolygon:
5868
+ return parseMultiPolygons(geometry);
5869
+ default:
5870
+ throw new Error(`Unimplemented geometry type: ${type}`);
5871
+ }
5872
+ }
5873
+ function parsePoint(geometry) {
5874
+ const xy = geometry.xyArray();
5875
+ const z = geometry.zArray();
5876
+ const positions = blitArrays(xy, z);
5877
+ return { positions };
5878
+ }
5879
+ function parseLines(geometry) {
5880
+ const xy = geometry.xyArray();
5881
+ const z = geometry.zArray();
5882
+ const positions = blitArrays(xy, z);
5883
+ const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5884
+ ends.unshift(0);
5885
+ const pathIndices = { value: new Uint16Array(ends), size: 1 };
5886
+ return {
5887
+ positions,
5888
+ pathIndices
5889
+ };
5890
+ }
5891
+ function parsePolygons(geometry) {
5892
+ const xy = geometry.xyArray();
5893
+ const z = geometry.zArray();
5894
+ const positions = blitArrays(xy, z);
5895
+ const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5896
+ ends.unshift(0);
5897
+ const primitivePolygonIndices = { value: new Uint16Array(ends), size: 1 };
5898
+ const polygonIndices = { value: new Uint16Array([0, xy.length / 2]), size: 1 };
5899
+ return {
5900
+ positions,
5901
+ primitivePolygonIndices,
5902
+ polygonIndices
5903
+ };
5904
+ }
5905
+ function parseMultiPolygons(geometry) {
5906
+ const parsedParts = [];
5907
+ let nPositions = 0;
5908
+ let nPrimitivePolygonIndices = 1;
5909
+ let nPolygonIndices = 1;
5910
+ for (let i = 0; i < geometry.partsLength(); i++) {
5911
+ const part = geometry.parts(i);
5912
+ const polygon = parsePolygons(part);
5913
+ nPositions += polygon.positions.value.length;
5914
+ nPrimitivePolygonIndices += polygon.primitivePolygonIndices.value.length - 1;
5915
+ nPolygonIndices += polygon.polygonIndices.value.length - 1;
5916
+ parsedParts.push(polygon);
5917
+ }
5918
+ const concatPositions = new Float64Array(nPositions);
5919
+ const concatPrimitivePolygonIndices = new Uint32Array(nPrimitivePolygonIndices);
5920
+ const concatPolygonIndices = new Uint32Array(nPolygonIndices);
5921
+ let positionCounter = 0;
5922
+ let primitivePolygonIndicesCounter = 1;
5923
+ let polygonIndicesCounter = 1;
5924
+ const positionSize = parsedParts[0].positions.size;
5925
+ for (const parsedPart of parsedParts) {
5926
+ concatPositions.set(parsedPart.positions.value, positionCounter * positionSize);
5927
+ concatPrimitivePolygonIndices.set(
5928
+ // eslint-disable-next-line
5929
+ parsedPart.primitivePolygonIndices.value.subarray(1).map((x) => x + positionCounter),
5930
+ primitivePolygonIndicesCounter
5931
+ );
5932
+ concatPolygonIndices.set(
5933
+ // eslint-disable-next-line
5934
+ parsedPart.polygonIndices.value.subarray(1).map((x) => x + positionCounter),
5935
+ polygonIndicesCounter
5936
+ );
5937
+ positionCounter += parsedPart.positions.value.length / positionSize;
5938
+ primitivePolygonIndicesCounter += parsedPart.primitivePolygonIndices.value.length - 1;
5939
+ polygonIndicesCounter += parsedPart.polygonIndices.value.length - 1;
5940
+ }
5941
+ return {
5942
+ positions: { value: concatPositions, size: positionSize },
5943
+ primitivePolygonIndices: { value: concatPrimitivePolygonIndices, size: 1 },
5944
+ polygonIndices: { value: concatPolygonIndices, size: 1 }
5945
+ };
5946
+ }
5947
+ function blitArrays(xy, z) {
5948
+ if (!z) {
5949
+ return { value: xy, size: 2 };
5950
+ }
5951
+ if (z.length * 2 !== xy.length) {
5952
+ throw new Error("Z array must be half XY array's length");
5953
+ }
5954
+ const totalLength = xy.length + z.length;
5955
+ const xyz = new Float64Array(totalLength);
5956
+ for (let i = 0; i < xy.length / 2; i++) {
5957
+ xyz[i * 3 + 0] = xy[i * 2 + 0];
5958
+ xyz[i * 3 + 1] = xy[i * 2 + 1];
5959
+ xyz[i * 3 + 2] = z[i];
5960
+ }
5961
+ return { value: xyz, size: 3 };
5962
+ }
5963
+
5964
+ // src/lib/get-schema-from-fgb-header.ts
5965
+ function getSchemaFromFGBHeader(fgbHeader) {
5966
+ const metadata = {
5967
+ title: fgbHeader.title || "",
5968
+ description: fgbHeader.description || "",
5969
+ crs: JSON.stringify(fgbHeader.crs) || "",
5970
+ metadata: fgbHeader.metadata || "",
5971
+ geometryType: String(fgbHeader.geometryType),
5972
+ indexNodeSize: String(fgbHeader.indexNodeSize),
5973
+ featureCount: String(fgbHeader.featuresCount),
5974
+ bounds: fgbHeader.envelope?.join(",") || ""
5975
+ };
5976
+ const fields = fgbHeader.columns?.map((column) => getFieldFromFGBColumn(column)) || [];
5977
+ return { metadata, fields };
5978
+ }
5979
+ function getFieldFromFGBColumn(fgbColumn) {
5980
+ const metadata = {
5981
+ title: fgbColumn.title || "",
5982
+ description: fgbColumn.description || "",
5983
+ width: String(fgbColumn.width),
5984
+ precision: String(fgbColumn.precision),
5985
+ scale: String(fgbColumn.scale),
5986
+ unique: String(fgbColumn.unique),
5987
+ primary_key: String(fgbColumn.primary_key)
5988
+ };
5989
+ return {
5990
+ name: fgbColumn.name,
5991
+ type: getTypeFromFGBType(fgbColumn.type),
5992
+ nullable: fgbColumn.nullable,
5993
+ metadata
5994
+ };
5995
+ }
5996
+ function getTypeFromFGBType(fgbType) {
5997
+ switch (fgbType) {
5998
+ case 0 /* Byte */:
5999
+ return "int8";
6000
+ case 1 /* UByte */:
6001
+ return "uint8";
6002
+ case 2 /* Bool */:
6003
+ return "bool";
6004
+ case 3 /* Short */:
6005
+ return "int16";
6006
+ case 4 /* UShort */:
6007
+ return "uint16";
6008
+ case 5 /* Int */:
6009
+ return "int32";
6010
+ case 6 /* UInt */:
6011
+ return "uint32";
6012
+ case 7 /* Long */:
6013
+ return "int64";
6014
+ case 8 /* ULong */:
6015
+ return "uint64";
6016
+ case 9 /* Float */:
6017
+ return "float32";
6018
+ case 10 /* Double */:
6019
+ return "float64";
6020
+ case 11 /* String */:
6021
+ return "utf8";
6022
+ case 12 /* Json */:
6023
+ return "null";
6024
+ case 13 /* DateTime */:
6025
+ return "date-millisecond";
6026
+ case 14 /* Binary */:
6027
+ return "binary";
6028
+ default:
6029
+ return "null";
6030
+ }
6031
+ }
6032
+
6033
+ // src/flatgeobuf/3.27.2/flat-geobuf/geometry-type.ts
6034
+ var GeometryType2 = /* @__PURE__ */ ((GeometryType3) => {
6035
+ GeometryType3[GeometryType3["Unknown"] = 0] = "Unknown";
6036
+ GeometryType3[GeometryType3["Point"] = 1] = "Point";
6037
+ GeometryType3[GeometryType3["LineString"] = 2] = "LineString";
6038
+ GeometryType3[GeometryType3["Polygon"] = 3] = "Polygon";
6039
+ GeometryType3[GeometryType3["MultiPoint"] = 4] = "MultiPoint";
6040
+ GeometryType3[GeometryType3["MultiLineString"] = 5] = "MultiLineString";
6041
+ GeometryType3[GeometryType3["MultiPolygon"] = 6] = "MultiPolygon";
6042
+ GeometryType3[GeometryType3["GeometryCollection"] = 7] = "GeometryCollection";
6043
+ GeometryType3[GeometryType3["CircularString"] = 8] = "CircularString";
6044
+ GeometryType3[GeometryType3["CompoundCurve"] = 9] = "CompoundCurve";
6045
+ GeometryType3[GeometryType3["CurvePolygon"] = 10] = "CurvePolygon";
6046
+ GeometryType3[GeometryType3["MultiCurve"] = 11] = "MultiCurve";
6047
+ GeometryType3[GeometryType3["MultiSurface"] = 12] = "MultiSurface";
6048
+ GeometryType3[GeometryType3["Curve"] = 13] = "Curve";
6049
+ GeometryType3[GeometryType3["Surface"] = 14] = "Surface";
6050
+ GeometryType3[GeometryType3["PolyhedralSurface"] = 15] = "PolyhedralSurface";
6051
+ GeometryType3[GeometryType3["TIN"] = 16] = "TIN";
6052
+ GeometryType3[GeometryType3["Triangle"] = 17] = "Triangle";
6053
+ return GeometryType3;
6054
+ })(GeometryType2 || {});
6055
+
6046
6056
  // src/flatgeobuf/3.27.2/flat-geobuf/geometry.ts
6047
6057
  var Geometry = class {
6048
6058
  bb = null;
@@ -8826,19 +8836,14 @@
8826
8836
  }
8827
8837
 
8828
8838
  // src/flatgeobuf-loader.ts
8829
- var VERSION = true ? "4.3.0" : "latest";
8839
+ var VERSION = true ? "4.4.0-alpha.0" : "latest";
8830
8840
  var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
8831
8841
  var FlatGeobufWorkerLoader = {
8842
+ ...FlatGeobufFormat,
8832
8843
  dataType: null,
8833
8844
  batchType: null,
8834
- id: "flatgeobuf",
8835
- name: "FlatGeobuf",
8836
- module: "flatgeobuf",
8837
8845
  version: VERSION,
8838
8846
  worker: true,
8839
- extensions: ["fgb"],
8840
- mimeTypes: ["application/octet-stream"],
8841
- category: "geometry",
8842
8847
  tests: [new Uint8Array(FGB_MAGIC_NUMBER).buffer],
8843
8848
  options: {
8844
8849
  flatgeobuf: {
package/dist/index.cjs CHANGED
@@ -35,11 +35,23 @@ var __publicField = (obj, key, value) => {
35
35
  // dist/index.js
36
36
  var dist_exports = {};
37
37
  __export(dist_exports, {
38
+ FlatGeobufFormat: () => FlatGeobufFormat,
38
39
  FlatGeobufLoader: () => FlatGeobufLoader,
39
- FlatGeobufWorkerLoader: () => FlatGeobufWorkerLoader
40
+ FlatGeobufWorkerLoader: () => FlatGeobufWorkerLoader,
41
+ _FlatGeobufSource: () => FlatGeobufSource
40
42
  });
41
43
  module.exports = __toCommonJS(dist_exports);
42
44
 
45
+ // dist/flatgeobuf-format.js
46
+ var FlatGeobufFormat = {
47
+ id: "flatgeobuf",
48
+ name: "FlatGeobuf",
49
+ module: "flatgeobuf",
50
+ extensions: ["fgb"],
51
+ mimeTypes: ["application/octet-stream"],
52
+ category: "geometry"
53
+ };
54
+
43
55
  // dist/lib/parse-flatgeobuf.js
44
56
  var import_proj4 = require("@math.gl/proj4");
45
57
  var import_gis = require("@loaders.gl/gis");
@@ -1847,19 +1859,14 @@ function binaryFromFeature(feature, header) {
1847
1859
  }
1848
1860
 
1849
1861
  // dist/flatgeobuf-loader.js
1850
- var VERSION = true ? "4.3.0" : "latest";
1862
+ var VERSION = true ? "4.4.0-alpha.0" : "latest";
1851
1863
  var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
1852
1864
  var FlatGeobufWorkerLoader = {
1865
+ ...FlatGeobufFormat,
1853
1866
  dataType: null,
1854
1867
  batchType: null,
1855
- id: "flatgeobuf",
1856
- name: "FlatGeobuf",
1857
- module: "flatgeobuf",
1858
1868
  version: VERSION,
1859
1869
  worker: true,
1860
- extensions: ["fgb"],
1861
- mimeTypes: ["application/octet-stream"],
1862
- category: "geometry",
1863
1870
  tests: [new Uint8Array(FGB_MAGIC_NUMBER).buffer],
1864
1871
  options: {
1865
1872
  flatgeobuf: {
@@ -1898,4 +1905,44 @@ function getOptions(options) {
1898
1905
  reproject: ((_d = options == null ? void 0 : options.gis) == null ? void 0 : _d.reproject) || false
1899
1906
  };
1900
1907
  }
1908
+
1909
+ // dist/flatgeobuf-source.js
1910
+ var import_loader_utils = require("@loaders.gl/loader-utils");
1911
+ var FlatGeobufSource = {
1912
+ ...FlatGeobufFormat,
1913
+ version: "0.0.0",
1914
+ type: "flatgeobuf-server",
1915
+ fromUrl: true,
1916
+ fromBlob: false,
1917
+ // TODO check if supported by library?
1918
+ defaultOptions: {
1919
+ flatgeobuf: {}
1920
+ },
1921
+ testURL: (url) => url.toLowerCase().includes("FeatureServer"),
1922
+ createDataSource: (url, options) => new FlatGeobufVectorSource(url, options)
1923
+ };
1924
+ var FlatGeobufVectorSource = class extends import_loader_utils.DataSource {
1925
+ formatSpecificMetadata = null;
1926
+ constructor(data, options) {
1927
+ super(data, options, FlatGeobufSource.defaultOptions);
1928
+ }
1929
+ /** TODO - not yet clear if we can find schema information in the FeatureServer metadata or if we need to request a feature */
1930
+ async getSchema() {
1931
+ await this.getMetadata({ formatSpecificMetadata: true });
1932
+ return { metadata: {}, fields: [] };
1933
+ }
1934
+ async getMetadata(options) {
1935
+ if (!this.formatSpecificMetadata) {
1936
+ }
1937
+ if (options.formatSpecificMetadata) {
1938
+ }
1939
+ return {};
1940
+ }
1941
+ async getFeatures(parameters) {
1942
+ const response = await this.fetch(this.url);
1943
+ const arrayBuffer = await response.arrayBuffer();
1944
+ const table = await FlatGeobufLoader.parse(arrayBuffer, {});
1945
+ return table;
1946
+ }
1947
+ };
1901
1948
  //# sourceMappingURL=index.cjs.map