@loaders.gl/ogc 5.0.0-beta.4 → 5.0.0-beta.6

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.
@@ -4,7 +4,7 @@
4
4
  import { CSWCapabilitiesFormat } from "./wms-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
7
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
8
8
  /** Preloads the parser-bearing CSW capabilities loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWCapabilitiesLoaderWithParser } = await import("./csw-capabilities-loader-with-parser.js");
@@ -4,7 +4,7 @@
4
4
  import { CSWDomainFormat } from "./wms-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
7
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
8
8
  /** Preloads the parser-bearing CSW domain loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWDomainLoaderWithParser } = await import("./csw-domain-loader-with-parser.js");
@@ -4,7 +4,7 @@
4
4
  import { CSWRecordsFormat } from "./wms-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
7
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
8
8
  /** Preloads the parser-bearing CSW records loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWRecordsLoaderWithParser } = await import("./csw-records-loader-with-parser.js");
@@ -8,7 +8,7 @@ import { CSWDomainLoaderWithParser } from "./csw-domain-loader-with-parser.js";
8
8
  import { WMSErrorLoaderWithParser } from "./wms-error-loader-with-parser.js";
9
9
  // __VERSION__ is injected by babel-plugin-version-inline
10
10
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
11
- const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
11
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
12
12
  export const CSWSourceLoader = {
13
13
  dataType: null,
14
14
  batchType: null,
@@ -4,7 +4,7 @@
4
4
  import { GMLFormat } from "./wms-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "5.0.0-beta.4" !== 'undefined' ? "5.0.0-beta.4" : 'latest';
7
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
8
8
  /** Preloads the parser-bearing GML loader implementation. */
9
9
  async function preload() {
10
10
  const { GMLLoaderWithParser } = await import('@loaders.gl/ogc/gml-loader');
@@ -1865,7 +1865,7 @@ var init_csw_capabilities_loader = __esm({
1865
1865
  "dist/wms/csw-capabilities-loader.js"() {
1866
1866
  "use strict";
1867
1867
  init_wms_format();
1868
- VERSION2 = true ? "5.0.0-beta.4" : "latest";
1868
+ VERSION2 = true ? "5.0.0-beta.6" : "latest";
1869
1869
  CSWCapabilitiesLoader = {
1870
1870
  ...CSWCapabilitiesFormat,
1871
1871
  dataType: null,
@@ -1953,7 +1953,7 @@ var init_csw_domain_loader = __esm({
1953
1953
  "dist/wms/csw-domain-loader.js"() {
1954
1954
  "use strict";
1955
1955
  init_wms_format();
1956
- VERSION3 = true ? "5.0.0-beta.4" : "latest";
1956
+ VERSION3 = true ? "5.0.0-beta.6" : "latest";
1957
1957
  CSWDomainLoader = {
1958
1958
  ...CSWDomainFormat,
1959
1959
  dataType: null,
@@ -2084,7 +2084,7 @@ var init_csw_records_loader = __esm({
2084
2084
  "dist/wms/csw-records-loader.js"() {
2085
2085
  "use strict";
2086
2086
  init_wms_format();
2087
- VERSION4 = true ? "5.0.0-beta.4" : "latest";
2087
+ VERSION4 = true ? "5.0.0-beta.6" : "latest";
2088
2088
  CSWRecordsLoader = {
2089
2089
  ...CSWRecordsFormat,
2090
2090
  dataType: null,
@@ -2171,7 +2171,7 @@ var init_wms_error_loader = __esm({
2171
2171
  "dist/wms/wms-error-loader.js"() {
2172
2172
  "use strict";
2173
2173
  init_wms_format();
2174
- VERSION5 = true ? "5.0.0-beta.4" : "latest";
2174
+ VERSION5 = true ? "5.0.0-beta.6" : "latest";
2175
2175
  WMSErrorLoader = {
2176
2176
  ...WMSErrorFormat,
2177
2177
  dataType: null,
@@ -2494,7 +2494,7 @@ var init_wms_capabilities_loader = __esm({
2494
2494
  "dist/wms/wms-capabilities-loader.js"() {
2495
2495
  "use strict";
2496
2496
  init_wms_format();
2497
- VERSION6 = true ? "5.0.0-beta.4" : "latest";
2497
+ VERSION6 = true ? "5.0.0-beta.6" : "latest";
2498
2498
  WMSCapabilitiesLoader = {
2499
2499
  ...WMSCapabilitiesFormat,
2500
2500
  dataType: null,
@@ -2995,7 +2995,7 @@ var init_wfs_capabilities_loader = __esm({
2995
2995
  "dist/wms/wfs-capabilities-loader.js"() {
2996
2996
  "use strict";
2997
2997
  init_wms_format();
2998
- VERSION7 = true ? "5.0.0-beta.4" : "latest";
2998
+ VERSION7 = true ? "5.0.0-beta.6" : "latest";
2999
2999
  WFSCapabilitiesLoader = {
3000
3000
  ...WFSCapabilitiesFormat,
3001
3001
  dataType: null,
@@ -3032,7 +3032,7 @@ var init_gml_loader_types = __esm({
3032
3032
  "dist/wms/gml-loader-types.js"() {
3033
3033
  "use strict";
3034
3034
  init_wms_format();
3035
- VERSION8 = true ? "5.0.0-beta.4" : "latest";
3035
+ VERSION8 = true ? "5.0.0-beta.6" : "latest";
3036
3036
  GMLLoader = {
3037
3037
  ...GMLFormat,
3038
3038
  dataType: null,
@@ -3480,7 +3480,7 @@ function getSourceLoaderOptions(options) {
3480
3480
  if (options == null ? void 0 : options.core) {
3481
3481
  loadOptions.core = { ...options.core };
3482
3482
  const parserCore = loadOptions.core;
3483
- for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
3483
+ for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
3484
3484
  delete parserCore[key];
3485
3485
  }
3486
3486
  if (Object.keys(parserCore).length === 0) {
@@ -3515,6 +3515,44 @@ function unavailableCoreApiMethod(methodName) {
3515
3515
  );
3516
3516
  };
3517
3517
  }
3518
+ function getDataSourceName(data, options) {
3519
+ var _a2, _b, _c;
3520
+ const explicitName = (_a2 = options.core) == null ? void 0 : _a2.name;
3521
+ if (explicitName !== void 0) {
3522
+ if (typeof explicitName !== "string" || !explicitName.trim())
3523
+ throw new Error("Data source name must be a non-empty string.");
3524
+ return explicitName;
3525
+ }
3526
+ if (data && typeof data === "object") {
3527
+ const named = data;
3528
+ if (typeof named.name === "string" && named.name.trim())
3529
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
3530
+ const metadata2 = (_b = named.schema) == null ? void 0 : _b.metadata;
3531
+ const embeddedName = metadata2 instanceof Map ? metadata2.get("name") : metadata2 == null ? void 0 : metadata2.name;
3532
+ if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
3533
+ }
3534
+ if (typeof data === "string") {
3535
+ try {
3536
+ const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
3537
+ if (!["data:", "blob:"].includes(url.protocol)) {
3538
+ let basename = url.pathname.split("/").filter(Boolean).pop();
3539
+ if (basename) {
3540
+ try {
3541
+ basename = decodeURIComponent(basename);
3542
+ } catch {
3543
+ }
3544
+ return removeFileExtension(basename);
3545
+ }
3546
+ }
3547
+ } catch {
3548
+ }
3549
+ }
3550
+ return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
3551
+ }
3552
+ function removeFileExtension(name) {
3553
+ const extension = name.lastIndexOf(".");
3554
+ return extension > 0 ? name.slice(0, extension) : name;
3555
+ }
3518
3556
  var UNAVAILABLE_CORE_API, DataSource;
3519
3557
  var init_data_source = __esm({
3520
3558
  "../core/src/loader-utils/lib/sources/data-source.ts"() {
@@ -3546,6 +3584,8 @@ var init_data_source = __esm({
3546
3584
  options;
3547
3585
  data;
3548
3586
  url;
3587
+ /** Stable query-visible name, resolved without fetching source data. */
3588
+ name;
3549
3589
  /** Shared parser options derived from the source options, excluding source-only core controls. */
3550
3590
  loadOptions;
3551
3591
  /** A resolved fetch function extracted from the shared core options. */
@@ -3562,6 +3602,7 @@ var init_data_source = __esm({
3562
3602
  );
3563
3603
  this.data = data;
3564
3604
  this.url = typeof data === "string" ? resolvePath(data) : "";
3605
+ this.name = getDataSourceName(data, this.options);
3565
3606
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
3566
3607
  this.loadOptions = loadOptions;
3567
3608
  const fetch2 = getFetchFunction(loadOptions);
@@ -3570,6 +3611,9 @@ var init_data_source = __esm({
3570
3611
  this.fetch = fetch2;
3571
3612
  }
3572
3613
  setProps(options) {
3614
+ var _a2;
3615
+ if (((_a2 = options.core) == null ? void 0 : _a2.name) !== void 0 && options.core.name !== this.name)
3616
+ throw new Error("Data source names are fixed at creation.");
3573
3617
  const mergedOptions = mergeOptions(this.options, options);
3574
3618
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
3575
3619
  this.options = mergedOptions;
@@ -5200,7 +5244,7 @@ function convertGeometryToWKT(geometry, options) {
5200
5244
  if (geometry.geometries.length === 0) return "GEOMETRYCOLLECTION EMPTY";
5201
5245
  return `GEOMETRYCOLLECTION (${geometry.geometries.map((child) => convertGeometryToWKT(child)).join(", ")})`;
5202
5246
  }
5203
- return (0, import_geospatial2.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
5247
+ return (0, import_wkb.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
5204
5248
  }
5205
5249
  function normalizeGeometryDimension(geometry, dimension) {
5206
5250
  if (geometry.type === "GeometryCollection") {
@@ -5259,11 +5303,11 @@ function getFirstCoordinate(geometry) {
5259
5303
  function getDimensionSize(dimension) {
5260
5304
  return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
5261
5305
  }
5262
- var import_geospatial2;
5306
+ var import_wkb;
5263
5307
  var init_geometry_to_wkt = __esm({
5264
5308
  "../core/src/arrow-geometry/geometry-to-wkt.ts"() {
5265
5309
  "use strict";
5266
- import_geospatial2 = require("@math.gl/geospatial");
5310
+ import_wkb = require("@math.gl/arrow/wkb");
5267
5311
  }
5268
5312
  });
5269
5313
 
@@ -5277,7 +5321,7 @@ function convertGeometryToWKB(input, options = {}) {
5277
5321
  }
5278
5322
  function encodeGeometry(geometry, dimension) {
5279
5323
  if (geometry.type !== "GeometryCollection") {
5280
- return (0, import_geospatial3.writeWKB)(geometry, dimension);
5324
+ return (0, import_wkb2.writeWKB)(geometry, dimension);
5281
5325
  }
5282
5326
  const children = geometry.geometries.map(
5283
5327
  (child) => encodeGeometry(
@@ -5285,13 +5329,13 @@ function encodeGeometry(geometry, dimension) {
5285
5329
  child.__geoarrowDimension ?? dimension
5286
5330
  )
5287
5331
  );
5288
- const headerBuilder = new import_geospatial3.WKBBuilder({ mode: "measure", dimension });
5332
+ const headerBuilder = new import_wkb2.WKBBuilder({ mode: "measure", dimension });
5289
5333
  headerBuilder.beginGeometry("GeometryCollection", children.length);
5290
5334
  const headerLength = headerBuilder.finishGeometry();
5291
5335
  const bytes = new Uint8Array(
5292
5336
  headerLength + children.reduce((total, child) => total + child.length, 0)
5293
5337
  );
5294
- const writer = new import_geospatial3.WKBBuilder({ mode: "write", target: bytes, dimension });
5338
+ const writer = new import_wkb2.WKBBuilder({ mode: "write", target: bytes, dimension });
5295
5339
  writer.beginGeometry("GeometryCollection", children.length);
5296
5340
  let byteOffset = writer.finishGeometry();
5297
5341
  for (const child of children) {
@@ -5300,11 +5344,11 @@ function encodeGeometry(geometry, dimension) {
5300
5344
  }
5301
5345
  return bytes;
5302
5346
  }
5303
- var import_geospatial3;
5347
+ var import_wkb2;
5304
5348
  var init_geometry_codecs = __esm({
5305
5349
  "../core/src/arrow-geometry/geometry-codecs.ts"() {
5306
5350
  "use strict";
5307
- import_geospatial3 = require("@math.gl/geospatial");
5351
+ import_wkb2 = require("@math.gl/arrow/wkb");
5308
5352
  init_geometry_to_wkt();
5309
5353
  }
5310
5354
  });
@@ -7817,7 +7861,7 @@ init_csw_capabilities_loader_with_parser();
7817
7861
  init_csw_records_loader_with_parser();
7818
7862
  init_csw_domain_loader_with_parser();
7819
7863
  init_wms_error_loader_with_parser();
7820
- var VERSION10 = true ? "5.0.0-beta.4" : "latest";
7864
+ var VERSION10 = true ? "5.0.0-beta.6" : "latest";
7821
7865
  var CSWSourceLoader = {
7822
7866
  dataType: null,
7823
7867
  batchType: null,