@honua/react 0.1.1-beta.0 → 0.1.4-beta.0
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/contract/discovery.d.ts +34 -0
- package/contract/discovery.d.ts.map +1 -1
- package/contract/index.d.ts +7 -5
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +3 -2
- package/contract/pmtiles.d.ts +10 -1
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +10 -2
- package/contract/protocol-module.d.ts +84 -9
- package/contract/protocol-module.d.ts.map +1 -1
- package/contract/query-filter-fes.d.ts +18 -0
- package/contract/query-filter-fes.d.ts.map +1 -0
- package/contract/query-filter-fes.js +122 -0
- package/contract/query-filter.d.ts +300 -0
- package/contract/query-filter.d.ts.map +1 -0
- package/contract/query-filter.js +883 -0
- package/contract/schema.d.ts +12 -0
- package/contract/schema.d.ts.map +1 -1
- package/contract/schema.js +34 -0
- package/contract/source-capability-support.d.ts.map +1 -1
- package/contract/source-capability-support.js +15 -3
- package/contract/source.d.ts +45 -25
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +719 -479
- package/contract/types.d.ts +87 -18
- package/contract/types.d.ts.map +1 -1
- package/contract/widget-source.d.ts.map +1 -1
- package/core/client.d.ts +45 -21
- package/core/client.d.ts.map +1 -1
- package/core/client.js +224 -46
- package/core/error-classifications.d.ts +6 -0
- package/core/error-classifications.d.ts.map +1 -1
- package/core/error-classifications.js +6 -0
- package/core/error-code-registry.d.ts +6 -0
- package/core/error-code-registry.d.ts.map +1 -1
- package/core/error-code-registry.js +6 -0
- package/core/error-envelope.js +2 -0
- package/core/errors.d.ts +1 -1
- package/core/errors.js +1 -1
- package/core/geoparquet-sql.d.ts +68 -4
- package/core/geoparquet-sql.d.ts.map +1 -1
- package/core/geoparquet-sql.js +325 -8
- package/core/odata-write-codec.d.ts.map +1 -1
- package/core/odata-write-codec.js +0 -1
- package/core/odata.d.ts +6 -0
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +6 -1
- package/core/ogc-processes.d.ts +182 -25
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +602 -30
- package/core/process-runner.d.ts +8 -1
- package/core/process-runner.d.ts.map +1 -1
- package/core/process-runner.js +1 -0
- package/core/protocol-transport.d.ts +2 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/stac.d.ts +31 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +136 -19
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +273 -68
- package/core/types.d.ts +123 -9
- package/core/types.d.ts.map +1 -1
- package/core/wfs-axis-order.d.ts +18 -0
- package/core/wfs-axis-order.d.ts.map +1 -0
- package/core/wfs-axis-order.js +108 -0
- package/core/wfs-capabilities.d.ts +65 -24
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +237 -27
- package/core/wfs-filter.d.ts +26 -3
- package/core/wfs-filter.d.ts.map +1 -1
- package/core/wfs-filter.js +48 -53
- package/core/wfs-protocol-error.d.ts +12 -0
- package/core/wfs-protocol-error.d.ts.map +1 -0
- package/core/wfs-protocol-error.js +13 -0
- package/core/wfs.d.ts +53 -1
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +251 -29
- package/core/wms-feature-info.d.ts +92 -0
- package/core/wms-feature-info.d.ts.map +1 -0
- package/core/wms-feature-info.js +285 -0
- package/core/wms.d.ts +9 -0
- package/core/wms.d.ts.map +1 -1
- package/core/wms.js +17 -5
- package/esri-compat/event-bus.d.ts +20 -0
- package/esri-compat/event-bus.d.ts.map +1 -1
- package/esri-compat/feature-filter.d.ts +46 -1
- package/esri-compat/feature-filter.d.ts.map +1 -1
- package/esri-compat/feature-filter.js +49 -0
- package/esri-compat/geojson-layer.d.ts +4 -2
- package/esri-compat/geojson-layer.d.ts.map +1 -1
- package/esri-compat/geojson-layer.js +4 -2
- package/esri-compat/identity-manager.js +2 -2
- package/esri-compat/imagery-layer.d.ts +2 -1
- package/esri-compat/imagery-layer.d.ts.map +1 -1
- package/esri-compat/imagery-layer.js +2 -1
- package/esri-compat/layer-list.d.ts +8 -1
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +11 -4
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +1 -1
- package/esri-compat/locator.d.ts +297 -0
- package/esri-compat/locator.d.ts.map +1 -0
- package/esri-compat/locator.js +579 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -1
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +1 -1
- package/esri-compat/scene-view.d.ts.map +1 -1
- package/esri-compat/time-slider.d.ts +29 -0
- package/esri-compat/time-slider.d.ts.map +1 -1
- package/esri-compat/time-slider.js +117 -0
- package/esri-compat/wfs-layer.d.ts +2 -1
- package/esri-compat/wfs-layer.d.ts.map +1 -1
- package/esri-compat/wfs-layer.js +2 -1
- package/esri-compat/widget-host.d.ts +42 -6
- package/esri-compat/widget-host.d.ts.map +1 -1
- package/esri-compat/widget-host.js +99 -10
- package/generated-app/projection.d.ts.map +1 -1
- package/generated-app/runtime.d.ts.map +1 -1
- package/map/data-to-map-bridge.d.ts +1 -1
- package/map/data-to-map-bridge.d.ts.map +1 -1
- package/map/data-to-map-bridge.js +1 -2
- package/map/honua-map.d.ts.map +1 -1
- package/map/honua-map.js +1 -1
- package/map/index.d.ts +2 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +2 -0
- package/map/realtime-reconciliation-adapter.d.ts +98 -0
- package/map/realtime-reconciliation-adapter.d.ts.map +1 -0
- package/map/realtime-reconciliation-adapter.js +84 -0
- package/map/temporal-playback.d.ts +25 -0
- package/map/temporal-playback.d.ts.map +1 -1
- package/map/temporal-playback.js +29 -1
- package/package.json +4 -3
- package/query-planner/canonical-filter.d.ts +30 -0
- package/query-planner/canonical-filter.d.ts.map +1 -0
- package/query-planner/canonical-filter.js +30 -0
- package/query-planner/columnar-plan.d.ts +63 -0
- package/query-planner/columnar-plan.d.ts.map +1 -0
- package/query-planner/columnar-plan.js +94 -0
- package/query-planner/diagnostics.d.ts +3 -3
- package/query-planner/diagnostics.d.ts.map +1 -1
- package/query-planner/diagnostics.js +17 -4
- package/query-planner/duckdb.d.ts.map +1 -1
- package/query-planner/duckdb.js +16 -2
- package/query-planner/execution-context.d.ts.map +1 -1
- package/query-planner/execution-context.js +3 -1
- package/query-planner/executor.d.ts.map +1 -1
- package/query-planner/executor.js +7 -1
- package/query-planner/geoservices.d.ts.map +1 -1
- package/query-planner/geoservices.js +24 -5
- package/query-planner/grpc.d.ts.map +1 -1
- package/query-planner/grpc.js +29 -5
- package/query-planner/index.d.ts +20 -5
- package/query-planner/index.d.ts.map +1 -1
- package/query-planner/index.js +16 -3
- package/query-planner/ir.d.ts +6 -1
- package/query-planner/ir.d.ts.map +1 -1
- package/query-planner/ir.js +63 -1
- package/query-planner/odata-protocol-module.d.ts +54 -0
- package/query-planner/odata-protocol-module.d.ts.map +1 -0
- package/query-planner/odata-protocol-module.js +199 -0
- package/query-planner/odata-v1.d.ts +23 -0
- package/query-planner/odata-v1.d.ts.map +1 -0
- package/query-planner/odata-v1.js +202 -0
- package/query-planner/odata.d.ts +0 -3
- package/query-planner/odata.d.ts.map +1 -1
- package/query-planner/odata.js +0 -143
- package/query-planner/ogc-features.d.ts.map +1 -1
- package/query-planner/ogc-features.js +23 -1
- package/query-planner/planner.d.ts +2 -2
- package/query-planner/planner.d.ts.map +1 -1
- package/query-planner/planner.js +146 -27
- package/query-planner/representation.d.ts +59 -0
- package/query-planner/representation.d.ts.map +1 -0
- package/query-planner/representation.js +140 -0
- package/query-planner/types.d.ts +153 -3
- package/query-planner/types.d.ts.map +1 -1
- package/query-planner/wfs-protocol-module.d.ts +57 -0
- package/query-planner/wfs-protocol-module.d.ts.map +1 -0
- package/query-planner/wfs-protocol-module.js +731 -0
- package/query-planner/wfs-v1.d.ts +41 -0
- package/query-planner/wfs-v1.d.ts.map +1 -0
- package/query-planner/wfs-v1.js +366 -0
- package/query-planner/wfs.d.ts +1 -3
- package/query-planner/wfs.d.ts.map +1 -1
- package/query-planner/wfs.js +1 -70
- package/react/honua-map.d.ts +3 -1
- package/react/honua-map.d.ts.map +1 -1
- package/react/honua-map.js +11 -1
- package/react/hooks.d.ts +1 -1
- package/react/hooks.js +1 -1
- package/react/selection.d.ts.map +1 -1
- package/react/selection.js +0 -0
- package/react/use-mounted-source.d.ts +1 -1
- package/react/use-mounted-source.js +1 -1
- package/realtime/checkpoint-store.d.ts +206 -0
- package/realtime/checkpoint-store.d.ts.map +1 -0
- package/realtime/checkpoint-store.js +504 -0
- package/realtime/contract.d.ts +142 -0
- package/realtime/contract.d.ts.map +1 -0
- package/realtime/contract.js +154 -0
- package/realtime/exploration.d.ts +16 -0
- package/realtime/exploration.d.ts.map +1 -0
- package/realtime/exploration.js +32 -0
- package/realtime/honua-server.d.ts +131 -0
- package/realtime/honua-server.d.ts.map +1 -0
- package/realtime/honua-server.js +302 -0
- package/realtime/index.d.ts +39 -0
- package/realtime/index.d.ts.map +1 -0
- package/realtime/index.js +26 -0
- package/realtime/odata-delta.d.ts +114 -0
- package/realtime/odata-delta.d.ts.map +1 -0
- package/realtime/odata-delta.js +483 -0
- package/realtime/projections.d.ts +30 -0
- package/realtime/projections.d.ts.map +1 -0
- package/realtime/projections.js +51 -0
- package/realtime/reconciliation.d.ts +245 -0
- package/realtime/reconciliation.d.ts.map +1 -0
- package/realtime/reconciliation.js +377 -0
- package/realtime/reducer.d.ts +14 -0
- package/realtime/reducer.d.ts.map +1 -0
- package/realtime/reducer.js +351 -0
- package/realtime/resumable-transport.d.ts +111 -0
- package/realtime/resumable-transport.d.ts.map +1 -0
- package/realtime/resumable-transport.js +406 -0
- package/realtime/resumable.d.ts +104 -0
- package/realtime/resumable.d.ts.map +1 -0
- package/realtime/resumable.js +632 -0
- package/realtime/sse.d.ts +23 -0
- package/realtime/sse.d.ts.map +1 -0
- package/realtime/sse.js +147 -0
- package/realtime/store.d.ts +18 -0
- package/realtime/store.d.ts.map +1 -0
- package/realtime/store.js +63 -0
- package/realtime/types.d.ts +190 -0
- package/realtime/types.d.ts.map +1 -0
- package/realtime/types.js +10 -0
- package/realtime/websocket.d.ts +60 -0
- package/realtime/websocket.d.ts.map +1 -0
- package/realtime/websocket.js +157 -0
- package/realtime/wire.d.ts +28 -0
- package/realtime/wire.d.ts.map +1 -0
- package/realtime/wire.js +73 -0
- package/runtime/index.d.ts +6 -2
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +3 -1
- package/runtime/load-package.d.ts +24 -0
- package/runtime/load-package.d.ts.map +1 -1
- package/runtime/load-package.js +45 -1
- package/runtime/maplibre-renderer.d.ts +11 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -1
- package/runtime/maplibre-renderer.js +32 -7
- package/runtime/offline-region-protocol.d.ts +73 -0
- package/runtime/offline-region-protocol.d.ts.map +1 -0
- package/runtime/offline-region-protocol.js +63 -0
- package/runtime/offline-region-style.d.ts +78 -0
- package/runtime/offline-region-style.d.ts.map +1 -0
- package/runtime/offline-region-style.js +147 -0
- package/runtime/pmtiles-protocol.d.ts +7 -8
- package/runtime/pmtiles-protocol.d.ts.map +1 -1
- package/runtime/pmtiles-protocol.js +19 -66
- package/runtime/protocol-registry.d.ts +55 -0
- package/runtime/protocol-registry.d.ts.map +1 -0
- package/runtime/protocol-registry.js +103 -0
- package/runtime/runtime.d.ts +2 -0
- package/runtime/runtime.d.ts.map +1 -1
- package/runtime/runtime.js +6 -1
- package/studio/index.d.ts +24 -7
- package/studio/index.d.ts.map +1 -1
- package/studio/index.js +21 -7
- package/studio/lifecycle-client.d.ts +164 -0
- package/studio/lifecycle-client.d.ts.map +1 -0
- package/studio/lifecycle-client.js +299 -0
- package/studio/lifecycle-errors.d.ts +91 -0
- package/studio/lifecycle-errors.d.ts.map +1 -0
- package/studio/lifecycle-errors.js +77 -0
- package/studio/lifecycle-types.d.ts +321 -0
- package/studio/lifecycle-types.d.ts.map +1 -0
- package/studio/lifecycle-types.js +22 -0
- package/webmap/convert-label.js +0 -1
- package/webmap/convert-symbol.d.ts.map +1 -1
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArcGIS `Locator` / `@arcgis/core/rest/locator` compatibility, backed entirely
|
|
3
|
+
* by the provider-pluggable geocoding contract in `src/geocoding/`.
|
|
4
|
+
*
|
|
5
|
+
* There is no Honua server dependency: the caller supplies a
|
|
6
|
+
* {@link GeocodingProvider} (Nominatim / Photon / Pelias / Honua) once and the
|
|
7
|
+
* shim projects ArcGIS-shaped parameters onto it and ArcGIS-shaped candidates
|
|
8
|
+
* back out.
|
|
9
|
+
*
|
|
10
|
+
* Capability honesty is inherited from the geocoding layer rather than faked:
|
|
11
|
+
* a provider that does not declare `suggest` (Nominatim) makes
|
|
12
|
+
* {@link LocatorCompat.suggestLocations} throw `HonuaCapabilityNotSupportedError`
|
|
13
|
+
* under the default `"strict"` policy, and makes the derived search source omit
|
|
14
|
+
* its `suggest` hook entirely so the Search widget simply does not offer
|
|
15
|
+
* typeahead. ArcGIS locator parameters the provider contract cannot express
|
|
16
|
+
* (`searchExtent`, proximity `location`, `categories`, `magicKey`,
|
|
17
|
+
* `locationType`) are rejected the same way instead of being silently dropped.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import { HonuaCapabilityNotSupportedError } from "../core/errors.js";
|
|
22
|
+
import { assertGeocodingCapability, supportsGeocodingCapability, } from "../geocoding/provider.js";
|
|
23
|
+
import { CompatEventBus, safeInvokeCompatListener } from "./event-bus.js";
|
|
24
|
+
const DEFAULT_MAX_LOCATIONS = 6;
|
|
25
|
+
const DEFAULT_SEARCH_SOURCE_MAX_RESULTS = 6;
|
|
26
|
+
const DEFAULT_SEARCH_SOURCE_MAX_SUGGESTIONS = 6;
|
|
27
|
+
const DEFAULT_EXTENT_PADDING_DEGREES = 0.01;
|
|
28
|
+
const WGS84_WKID = 4326;
|
|
29
|
+
const WEB_MERCATOR_WKIDS = new Set([3857, 102100, 102113, 900913]);
|
|
30
|
+
const WEB_MERCATOR_HALF_CIRCUMFERENCE = 20037508.342789244;
|
|
31
|
+
/**
|
|
32
|
+
* Drop-in replacement for ArcGIS `esri/tasks/Locator` /
|
|
33
|
+
* `@arcgis/core/rest/locator`, executed against a caller-configured
|
|
34
|
+
* {@link GeocodingProvider}.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { LocatorCompat } from "@honua/sdk-js/esri-compat";
|
|
39
|
+
* import { photonGeocodingProvider } from "@honua/sdk-js/geocoding";
|
|
40
|
+
*
|
|
41
|
+
* const locator = new LocatorCompat({
|
|
42
|
+
* provider: photonGeocodingProvider({ baseUrl: "https://photon.example.org" }),
|
|
43
|
+
* });
|
|
44
|
+
* const candidates = await locator.addressToLocations({
|
|
45
|
+
* address: { SingleLine: "1 Honolulu Pl, HI" },
|
|
46
|
+
* maxLocations: 5,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export class LocatorCompat {
|
|
51
|
+
url;
|
|
52
|
+
/**
|
|
53
|
+
* Geocoding provider every operation runs against. Mutable so a migrated app
|
|
54
|
+
* can attach one after construction (`locator.provider = photonGeocodingProvider(...)`),
|
|
55
|
+
* which is the single assisted step the codemod cannot perform for you.
|
|
56
|
+
*/
|
|
57
|
+
provider;
|
|
58
|
+
apiKey;
|
|
59
|
+
requestOptions;
|
|
60
|
+
capabilityPolicy;
|
|
61
|
+
eventBus;
|
|
62
|
+
maxLocations;
|
|
63
|
+
extentPaddingDegrees;
|
|
64
|
+
loaded;
|
|
65
|
+
loadStatus;
|
|
66
|
+
watchListeners;
|
|
67
|
+
constructor(options = {}) {
|
|
68
|
+
const resolved = typeof options === "string" ? { url: options } : options;
|
|
69
|
+
this.url = resolved.url;
|
|
70
|
+
this.provider = resolved.provider;
|
|
71
|
+
this.apiKey = resolved.apiKey;
|
|
72
|
+
this.requestOptions = resolved.requestOptions ? { ...resolved.requestOptions } : undefined;
|
|
73
|
+
this.capabilityPolicy = resolved.capabilityPolicy ?? "strict";
|
|
74
|
+
this.eventBus = resolved.eventBus ?? new CompatEventBus();
|
|
75
|
+
this.maxLocations = normalizeLimit(resolved.maxLocations, DEFAULT_MAX_LOCATIONS);
|
|
76
|
+
this.extentPaddingDegrees =
|
|
77
|
+
typeof resolved.extentPaddingDegrees === "number" &&
|
|
78
|
+
Number.isFinite(resolved.extentPaddingDegrees) &&
|
|
79
|
+
resolved.extentPaddingDegrees > 0
|
|
80
|
+
? resolved.extentPaddingDegrees
|
|
81
|
+
: DEFAULT_EXTENT_PADDING_DEGREES;
|
|
82
|
+
this.loaded = false;
|
|
83
|
+
this.loadStatus = "not-loaded";
|
|
84
|
+
this.watchListeners = new Map();
|
|
85
|
+
}
|
|
86
|
+
/** `true` when the configured provider declares the `suggest` capability. */
|
|
87
|
+
get supportsSuggest() {
|
|
88
|
+
return this.provider !== undefined && supportsGeocodingCapability(this.provider, "suggest");
|
|
89
|
+
}
|
|
90
|
+
async load() {
|
|
91
|
+
if (this.loaded) {
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
this.loadStatus = "loading";
|
|
95
|
+
this.notifyWatchers("loadStatus", this.loadStatus);
|
|
96
|
+
this.eventBus.emit("locator.loading", { url: this.url }, this);
|
|
97
|
+
this.loaded = true;
|
|
98
|
+
this.notifyWatchers("loaded", this.loaded);
|
|
99
|
+
this.loadStatus = "loaded";
|
|
100
|
+
this.notifyWatchers("loadStatus", this.loadStatus);
|
|
101
|
+
this.eventBus.emit("locator.loaded", { url: this.url, provider: this.provider?.id }, this);
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
async when(callback) {
|
|
105
|
+
const locator = await this.load();
|
|
106
|
+
if (callback) {
|
|
107
|
+
callback(locator);
|
|
108
|
+
}
|
|
109
|
+
return locator;
|
|
110
|
+
}
|
|
111
|
+
watch(propertyName, listener) {
|
|
112
|
+
let listeners = this.watchListeners.get(propertyName);
|
|
113
|
+
if (!listeners) {
|
|
114
|
+
listeners = new Set();
|
|
115
|
+
this.watchListeners.set(propertyName, listeners);
|
|
116
|
+
}
|
|
117
|
+
listeners.add(listener);
|
|
118
|
+
return {
|
|
119
|
+
remove: () => {
|
|
120
|
+
listeners?.delete(listener);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** Forward-geocode a single address into ArcGIS-shaped candidates. */
|
|
125
|
+
async addressToLocations(params = {}) {
|
|
126
|
+
const provider = this.requireProvider("addressToLocations");
|
|
127
|
+
this.rejectUnsupportedParams(provider, params, ["categories", "location", "searchExtent"]);
|
|
128
|
+
if (typeof params.magicKey === "string" && params.magicKey !== "") {
|
|
129
|
+
this.rejectUnsupportedCapability(provider, "addressToLocations.magicKey");
|
|
130
|
+
}
|
|
131
|
+
const query = readSingleLineAddress(params.address);
|
|
132
|
+
const wkid = resolveOutWkid(params.outSpatialReference, provider);
|
|
133
|
+
const limit = normalizeLimit(params.maxLocations, this.maxLocations);
|
|
134
|
+
this.eventBus.emit("locator.address-to-locations-started", { address: query, maxLocations: limit }, this);
|
|
135
|
+
if (query === "") {
|
|
136
|
+
this.eventBus.emit("locator.address-to-locations-completed", { address: query, candidateCount: 0 }, this);
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
if (!assertGeocodingCapability(provider, "geocode", this.capabilityPolicy)) {
|
|
141
|
+
this.eventBus.emit("locator.address-to-locations-completed", { address: query, candidateCount: 0 }, this);
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
const matches = await provider.geocode(query, { limit, countryCodes: params.countryCode });
|
|
145
|
+
const candidates = matches
|
|
146
|
+
.slice(0, limit)
|
|
147
|
+
.map((match) => this.toCandidate(match, wkid, params.outFields, provider));
|
|
148
|
+
this.eventBus.emit("locator.address-to-locations-completed", { address: query, candidateCount: candidates.length }, this);
|
|
149
|
+
return candidates;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
this.eventBus.emit("locator.address-to-locations-error", { address: query, error }, this);
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Client-side batch geocode. ArcGIS `addressesToLocations` posts one batch to
|
|
158
|
+
* a locator; the provider contract has no batch endpoint, so each address is
|
|
159
|
+
* geocoded individually and the best candidate is returned with `ResultID`
|
|
160
|
+
* carried through from `OBJECTID`.
|
|
161
|
+
*/
|
|
162
|
+
async addressesToLocations(params = {}) {
|
|
163
|
+
const provider = this.requireProvider("addressesToLocations");
|
|
164
|
+
this.rejectUnsupportedParams(provider, params, ["categories", "searchExtent"]);
|
|
165
|
+
const addresses = params.addresses ?? [];
|
|
166
|
+
this.eventBus.emit("locator.addresses-to-locations-started", { addressCount: addresses.length }, this);
|
|
167
|
+
try {
|
|
168
|
+
const resolved = await Promise.all(addresses.map(async (address, index) => {
|
|
169
|
+
const candidates = await this.addressToLocations({
|
|
170
|
+
address,
|
|
171
|
+
countryCode: params.countryCode,
|
|
172
|
+
outFields: params.outFields,
|
|
173
|
+
outSpatialReference: params.outSpatialReference,
|
|
174
|
+
maxLocations: 1,
|
|
175
|
+
});
|
|
176
|
+
const best = candidates[0];
|
|
177
|
+
if (!best) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
const resultId = readObjectId(address) ?? index + 1;
|
|
181
|
+
const withResultId = {
|
|
182
|
+
...best,
|
|
183
|
+
attributes: { ...best.attributes, ResultID: String(resultId) },
|
|
184
|
+
};
|
|
185
|
+
return withResultId;
|
|
186
|
+
}));
|
|
187
|
+
const candidates = resolved.filter((candidate) => Boolean(candidate));
|
|
188
|
+
this.eventBus.emit("locator.addresses-to-locations-completed", { addressCount: addresses.length, candidateCount: candidates.length }, this);
|
|
189
|
+
return candidates;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
this.eventBus.emit("locator.addresses-to-locations-error", { addressCount: addresses.length, error }, this);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Reverse-geocode a point. Mirrors ArcGIS by rejecting when the provider
|
|
198
|
+
* finds no address rather than resolving to `null`.
|
|
199
|
+
*/
|
|
200
|
+
async locationToAddress(params = {}) {
|
|
201
|
+
const provider = this.requireProvider("locationToAddress");
|
|
202
|
+
this.rejectUnsupportedParams(provider, params, ["locationType", "locationSearchRadius"]);
|
|
203
|
+
const point = readLngLat(params.location);
|
|
204
|
+
if (!point) {
|
|
205
|
+
throw new Error("LocatorCompat.locationToAddress requires a location with numeric x/y or longitude/latitude.");
|
|
206
|
+
}
|
|
207
|
+
const wkid = resolveOutWkid(params.outSpatialReference, provider);
|
|
208
|
+
const [longitude, latitude] = point;
|
|
209
|
+
this.eventBus.emit("locator.location-to-address-started", { longitude, latitude }, this);
|
|
210
|
+
try {
|
|
211
|
+
if (!assertGeocodingCapability(provider, "reverse", this.capabilityPolicy)) {
|
|
212
|
+
throw new Error(`LocatorCompat.locationToAddress: provider "${provider.id}" does not support reverse geocoding.`);
|
|
213
|
+
}
|
|
214
|
+
const match = await provider.reverse(latitude, longitude);
|
|
215
|
+
if (!match) {
|
|
216
|
+
throw new Error(`No address found for location ${longitude}, ${latitude}.`);
|
|
217
|
+
}
|
|
218
|
+
const candidate = this.toCandidate(toGeocodeMatch(match), wkid, params.outFields, provider);
|
|
219
|
+
this.eventBus.emit("locator.location-to-address-completed", { address: candidate.address }, this);
|
|
220
|
+
return candidate;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
this.eventBus.emit("locator.location-to-address-error", { longitude, latitude, error }, this);
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Typeahead suggestions. Providers without the `suggest` capability throw
|
|
229
|
+
* `HonuaCapabilityNotSupportedError` under `"strict"` and resolve to `[]`
|
|
230
|
+
* under `"degraded"` — the miss is never faked with a forward geocode.
|
|
231
|
+
*/
|
|
232
|
+
async suggestLocations(params = {}) {
|
|
233
|
+
const provider = this.requireProvider("suggestLocations");
|
|
234
|
+
this.rejectUnsupportedParams(provider, params, ["categories", "location", "searchExtent"]);
|
|
235
|
+
const text = typeof params.text === "string" ? params.text.trim() : "";
|
|
236
|
+
const limit = normalizeLimit(params.maxSuggestions, this.maxLocations);
|
|
237
|
+
this.eventBus.emit("locator.suggest-locations-started", { text, maxSuggestions: limit }, this);
|
|
238
|
+
try {
|
|
239
|
+
if (!assertGeocodingCapability(provider, "suggest", this.capabilityPolicy)) {
|
|
240
|
+
this.eventBus.emit("locator.suggest-locations-completed", { text, suggestionCount: 0 }, this);
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
if (text === "") {
|
|
244
|
+
this.eventBus.emit("locator.suggest-locations-completed", { text, suggestionCount: 0 }, this);
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
const suggestions = await provider.suggest(text, { limit, countryCodes: params.countryCode });
|
|
248
|
+
const projected = suggestions.slice(0, limit).map((suggestion) => ({
|
|
249
|
+
text: suggestion.text,
|
|
250
|
+
magicKey: "",
|
|
251
|
+
isCollection: false,
|
|
252
|
+
provenance: suggestion.provenance,
|
|
253
|
+
}));
|
|
254
|
+
this.eventBus.emit("locator.suggest-locations-completed", { text, suggestionCount: projected.length }, this);
|
|
255
|
+
return projected;
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
this.eventBus.emit("locator.suggest-locations-error", { text, error }, this);
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Project this locator as a `SearchCompat` source — the honua-maplibre
|
|
264
|
+
* replacement for the ArcGIS `LocatorSearchSource` Search backend.
|
|
265
|
+
*/
|
|
266
|
+
toSearchSource(options = {}) {
|
|
267
|
+
return new LocatorSearchSourceCompat({ ...options, locator: this });
|
|
268
|
+
}
|
|
269
|
+
destroy() {
|
|
270
|
+
this.watchListeners.clear();
|
|
271
|
+
}
|
|
272
|
+
requireProvider(operation) {
|
|
273
|
+
if (!this.provider) {
|
|
274
|
+
const migratedUrl = this.url ? `; the migrated ArcGIS locator URL was ${this.url}` : "";
|
|
275
|
+
throw new Error([
|
|
276
|
+
`LocatorCompat.${operation} requires a geocoding provider.`,
|
|
277
|
+
'Set `locator.provider` or construct it with `new LocatorCompat({ provider })` using a provider from "@honua/sdk-js/geocoding"',
|
|
278
|
+
`(nominatimGeocodingProvider, photonGeocodingProvider, peliasGeocodingProvider, honuaGeocodingProvider)${migratedUrl}.`,
|
|
279
|
+
].join(" "));
|
|
280
|
+
}
|
|
281
|
+
return this.provider;
|
|
282
|
+
}
|
|
283
|
+
rejectUnsupportedParams(provider, params, keys) {
|
|
284
|
+
const record = params;
|
|
285
|
+
for (const key of keys) {
|
|
286
|
+
const value = record[key];
|
|
287
|
+
if (value === undefined || value === null) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
this.rejectUnsupportedCapability(provider, `locator.${key}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
rejectUnsupportedCapability(provider, capability) {
|
|
297
|
+
if (this.capabilityPolicy === "strict") {
|
|
298
|
+
throw new HonuaCapabilityNotSupportedError(capability, provider.id, this.url);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
toCandidate(match, wkid, outFields, provider) {
|
|
302
|
+
const [x, y] = projectLngLat(match.longitude, match.latitude, wkid, provider, this.url);
|
|
303
|
+
return {
|
|
304
|
+
address: match.address,
|
|
305
|
+
attributes: selectOutFields(match.attributes, outFields),
|
|
306
|
+
location: {
|
|
307
|
+
x,
|
|
308
|
+
y,
|
|
309
|
+
longitude: match.longitude,
|
|
310
|
+
latitude: match.latitude,
|
|
311
|
+
spatialReference: { wkid },
|
|
312
|
+
},
|
|
313
|
+
extent: this.resolveExtent(match, wkid, provider),
|
|
314
|
+
score: typeof match.score === "number" && Number.isFinite(match.score) ? match.score : 0,
|
|
315
|
+
provenance: match.provenance,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Prefer the ArcGIS locator display extent when the provider surfaces
|
|
320
|
+
* `Xmin`/`Ymin`/`Xmax`/`Ymax` attributes; otherwise derive a square box around
|
|
321
|
+
* the candidate point so `view.goTo(candidate.extent)` still behaves.
|
|
322
|
+
*/
|
|
323
|
+
resolveExtent(match, wkid, provider) {
|
|
324
|
+
const reported = readAttributeExtent(match.attributes);
|
|
325
|
+
const [xmin, ymin, xmax, ymax] = reported ?? [
|
|
326
|
+
match.longitude - this.extentPaddingDegrees,
|
|
327
|
+
match.latitude - this.extentPaddingDegrees,
|
|
328
|
+
match.longitude + this.extentPaddingDegrees,
|
|
329
|
+
match.latitude + this.extentPaddingDegrees,
|
|
330
|
+
];
|
|
331
|
+
const [projectedMinX, projectedMinY] = projectLngLat(xmin, ymin, wkid, provider, this.url);
|
|
332
|
+
const [projectedMaxX, projectedMaxY] = projectLngLat(xmax, ymax, wkid, provider, this.url);
|
|
333
|
+
return {
|
|
334
|
+
xmin: projectedMinX,
|
|
335
|
+
ymin: projectedMinY,
|
|
336
|
+
xmax: projectedMaxX,
|
|
337
|
+
ymax: projectedMaxY,
|
|
338
|
+
spatialReference: { wkid },
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
notifyWatchers(propertyName, value) {
|
|
342
|
+
const listeners = this.watchListeners.get(propertyName);
|
|
343
|
+
if (!listeners) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
for (const listener of listeners) {
|
|
347
|
+
safeInvokeCompatListener(listener, value);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Drop-in replacement for the ArcGIS `LocatorSearchSource` Search-widget
|
|
353
|
+
* backend. `suggest` is only defined when the underlying provider declares the
|
|
354
|
+
* `suggest` capability, so `SearchCompat` skips typeahead for providers that
|
|
355
|
+
* do not have it rather than throwing on every keystroke.
|
|
356
|
+
*/
|
|
357
|
+
export class LocatorSearchSourceCompat {
|
|
358
|
+
locator;
|
|
359
|
+
name;
|
|
360
|
+
placeholder;
|
|
361
|
+
maxResults;
|
|
362
|
+
maxSuggestions;
|
|
363
|
+
countryCode;
|
|
364
|
+
outFields;
|
|
365
|
+
/**
|
|
366
|
+
* Present only while the configured provider declares the `suggest`
|
|
367
|
+
* capability. `SearchCompat` gates typeahead on `typeof source.suggest ===
|
|
368
|
+
* "function"`, so a provider without it (Nominatim) simply contributes no
|
|
369
|
+
* suggestions instead of throwing on every keystroke. Evaluated per access so
|
|
370
|
+
* a late-attached `locator.provider` is honored.
|
|
371
|
+
*/
|
|
372
|
+
get suggest() {
|
|
373
|
+
return this.locator.supportsSuggest ? this.suggestFromLocator : undefined;
|
|
374
|
+
}
|
|
375
|
+
suggestFromLocator;
|
|
376
|
+
constructor(options = {}) {
|
|
377
|
+
this.locator =
|
|
378
|
+
options.locator ??
|
|
379
|
+
new LocatorCompat({
|
|
380
|
+
url: options.url,
|
|
381
|
+
provider: options.provider,
|
|
382
|
+
capabilityPolicy: options.capabilityPolicy,
|
|
383
|
+
});
|
|
384
|
+
this.name = options.name ?? this.locator.provider?.id ?? "Locator";
|
|
385
|
+
this.placeholder = options.placeholder ?? "Find address or place";
|
|
386
|
+
this.maxResults = normalizeLimit(options.maxResults, DEFAULT_SEARCH_SOURCE_MAX_RESULTS);
|
|
387
|
+
this.maxSuggestions = normalizeLimit(options.maxSuggestions, DEFAULT_SEARCH_SOURCE_MAX_SUGGESTIONS);
|
|
388
|
+
this.countryCode = options.countryCode;
|
|
389
|
+
this.outFields = options.outFields;
|
|
390
|
+
this.suggestFromLocator = async ({ searchTerm }) => {
|
|
391
|
+
const suggestions = await this.locator.suggestLocations({
|
|
392
|
+
text: searchTerm,
|
|
393
|
+
countryCode: this.countryCode,
|
|
394
|
+
maxSuggestions: this.maxSuggestions,
|
|
395
|
+
});
|
|
396
|
+
return suggestions.map((suggestion) => ({
|
|
397
|
+
text: suggestion.text,
|
|
398
|
+
key: suggestion.magicKey,
|
|
399
|
+
source: this,
|
|
400
|
+
}));
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
async search({ searchTerm }) {
|
|
404
|
+
const candidates = await this.locator.addressToLocations({
|
|
405
|
+
address: { SingleLine: searchTerm },
|
|
406
|
+
countryCode: this.countryCode,
|
|
407
|
+
maxLocations: this.maxResults,
|
|
408
|
+
outFields: this.outFields,
|
|
409
|
+
});
|
|
410
|
+
return candidates.map((candidate) => ({
|
|
411
|
+
name: candidate.address,
|
|
412
|
+
feature: {
|
|
413
|
+
attributes: candidate.attributes,
|
|
414
|
+
geometry: candidate.location,
|
|
415
|
+
},
|
|
416
|
+
location: { x: candidate.location.x, y: candidate.location.y },
|
|
417
|
+
extent: {
|
|
418
|
+
xmin: candidate.extent.xmin,
|
|
419
|
+
ymin: candidate.extent.ymin,
|
|
420
|
+
xmax: candidate.extent.xmax,
|
|
421
|
+
ymax: candidate.extent.ymax,
|
|
422
|
+
spatialReference: { ...candidate.extent.spatialReference },
|
|
423
|
+
},
|
|
424
|
+
source: this,
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* `@arcgis/core/rest/locator` module form of
|
|
430
|
+
* {@link LocatorCompat.addressToLocations}. The first argument is a configured
|
|
431
|
+
* {@link LocatorCompat} (or its options) rather than an ArcGIS locator URL,
|
|
432
|
+
* because the shim geocodes through a provider instead of a GeocodeServer.
|
|
433
|
+
*/
|
|
434
|
+
export function locatorAddressToLocations(locator, params) {
|
|
435
|
+
return resolveLocator(locator).addressToLocations(params);
|
|
436
|
+
}
|
|
437
|
+
/** `@arcgis/core/rest/locator` module form of {@link LocatorCompat.addressesToLocations}. */
|
|
438
|
+
export function locatorAddressesToLocations(locator, params) {
|
|
439
|
+
return resolveLocator(locator).addressesToLocations(params);
|
|
440
|
+
}
|
|
441
|
+
/** `@arcgis/core/rest/locator` module form of {@link LocatorCompat.locationToAddress}. */
|
|
442
|
+
export function locatorLocationToAddress(locator, params) {
|
|
443
|
+
return resolveLocator(locator).locationToAddress(params);
|
|
444
|
+
}
|
|
445
|
+
/** `@arcgis/core/rest/locator` module form of {@link LocatorCompat.suggestLocations}. */
|
|
446
|
+
export function locatorSuggestLocations(locator, params) {
|
|
447
|
+
return resolveLocator(locator).suggestLocations(params);
|
|
448
|
+
}
|
|
449
|
+
function resolveLocator(locator) {
|
|
450
|
+
return locator instanceof LocatorCompat ? locator : new LocatorCompat(locator);
|
|
451
|
+
}
|
|
452
|
+
function normalizeLimit(value, fallback) {
|
|
453
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
454
|
+
return fallback;
|
|
455
|
+
}
|
|
456
|
+
const normalized = Math.floor(value);
|
|
457
|
+
return normalized > 0 ? normalized : fallback;
|
|
458
|
+
}
|
|
459
|
+
function readSingleLineAddress(address) {
|
|
460
|
+
if (typeof address === "string") {
|
|
461
|
+
return address.trim();
|
|
462
|
+
}
|
|
463
|
+
if (!address || typeof address !== "object") {
|
|
464
|
+
return "";
|
|
465
|
+
}
|
|
466
|
+
const singleLine = address.SingleLine ?? address.singleLine;
|
|
467
|
+
if (typeof singleLine === "string" && singleLine.trim() !== "") {
|
|
468
|
+
return singleLine.trim();
|
|
469
|
+
}
|
|
470
|
+
// Multi-field input: join the ArcGIS field order into the single-line form
|
|
471
|
+
// every provider accepts.
|
|
472
|
+
const parts = [];
|
|
473
|
+
for (const key of ["Address", "address", "City", "Region", "Postal", "CountryCode"]) {
|
|
474
|
+
const value = address[key];
|
|
475
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
476
|
+
parts.push(value.trim());
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return parts.join(", ");
|
|
480
|
+
}
|
|
481
|
+
function readObjectId(address) {
|
|
482
|
+
const objectId = address.OBJECTID ?? address.objectId;
|
|
483
|
+
return typeof objectId === "number" && Number.isFinite(objectId) ? objectId : undefined;
|
|
484
|
+
}
|
|
485
|
+
function readLngLat(location) {
|
|
486
|
+
if (Array.isArray(location) && location.length >= 2) {
|
|
487
|
+
const [x, y] = location;
|
|
488
|
+
return typeof x === "number" && typeof y === "number" ? [x, y] : undefined;
|
|
489
|
+
}
|
|
490
|
+
if (!location || typeof location !== "object") {
|
|
491
|
+
return undefined;
|
|
492
|
+
}
|
|
493
|
+
const point = location;
|
|
494
|
+
const longitude = typeof point.longitude === "number" ? point.longitude : point.x;
|
|
495
|
+
const latitude = typeof point.latitude === "number" ? point.latitude : point.y;
|
|
496
|
+
if (typeof longitude !== "number" || typeof latitude !== "number") {
|
|
497
|
+
return undefined;
|
|
498
|
+
}
|
|
499
|
+
return [longitude, latitude];
|
|
500
|
+
}
|
|
501
|
+
function resolveOutWkid(outSpatialReference, provider) {
|
|
502
|
+
if (outSpatialReference === undefined || outSpatialReference === null) {
|
|
503
|
+
return WGS84_WKID;
|
|
504
|
+
}
|
|
505
|
+
const wkid = typeof outSpatialReference === "number"
|
|
506
|
+
? outSpatialReference
|
|
507
|
+
: (outSpatialReference.wkid ?? outSpatialReference.latestWkid);
|
|
508
|
+
if (typeof wkid !== "number" || !Number.isFinite(wkid)) {
|
|
509
|
+
return WGS84_WKID;
|
|
510
|
+
}
|
|
511
|
+
if (wkid === WGS84_WKID || WEB_MERCATOR_WKIDS.has(wkid)) {
|
|
512
|
+
return wkid;
|
|
513
|
+
}
|
|
514
|
+
throw new HonuaCapabilityNotSupportedError(`locator.outSpatialReference:${wkid}`, provider.id);
|
|
515
|
+
}
|
|
516
|
+
function projectLngLat(longitude, latitude, wkid, provider, sourceId) {
|
|
517
|
+
if (wkid === WGS84_WKID) {
|
|
518
|
+
return [longitude, latitude];
|
|
519
|
+
}
|
|
520
|
+
if (!WEB_MERCATOR_WKIDS.has(wkid)) {
|
|
521
|
+
throw new HonuaCapabilityNotSupportedError(`locator.outSpatialReference:${wkid}`, provider.id, sourceId);
|
|
522
|
+
}
|
|
523
|
+
const clampedLatitude = Math.max(Math.min(latitude, 89.99999), -89.99999);
|
|
524
|
+
const x = (longitude * WEB_MERCATOR_HALF_CIRCUMFERENCE) / 180;
|
|
525
|
+
const y = (Math.log(Math.tan(((90 + clampedLatitude) * Math.PI) / 360)) / (Math.PI / 180)) *
|
|
526
|
+
(WEB_MERCATOR_HALF_CIRCUMFERENCE / 180);
|
|
527
|
+
return [x, y];
|
|
528
|
+
}
|
|
529
|
+
function selectOutFields(attributes, outFields) {
|
|
530
|
+
if (outFields === undefined) {
|
|
531
|
+
return { ...attributes };
|
|
532
|
+
}
|
|
533
|
+
const requested = (typeof outFields === "string" ? outFields.split(",") : outFields)
|
|
534
|
+
.map((field) => field.trim())
|
|
535
|
+
.filter((field) => field !== "");
|
|
536
|
+
if (requested.length === 0 || requested.includes("*")) {
|
|
537
|
+
return { ...attributes };
|
|
538
|
+
}
|
|
539
|
+
const wanted = new Set(requested.map((field) => field.toLowerCase()));
|
|
540
|
+
const selected = {};
|
|
541
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
542
|
+
if (wanted.has(key.toLowerCase())) {
|
|
543
|
+
selected[key] = value;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return selected;
|
|
547
|
+
}
|
|
548
|
+
function readAttributeExtent(attributes) {
|
|
549
|
+
const lookup = new Map();
|
|
550
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
551
|
+
lookup.set(key.toLowerCase(), value);
|
|
552
|
+
}
|
|
553
|
+
const xmin = readNumericAttribute(lookup, "xmin");
|
|
554
|
+
const ymin = readNumericAttribute(lookup, "ymin");
|
|
555
|
+
const xmax = readNumericAttribute(lookup, "xmax");
|
|
556
|
+
const ymax = readNumericAttribute(lookup, "ymax");
|
|
557
|
+
if (xmin === undefined || ymin === undefined || xmax === undefined || ymax === undefined) {
|
|
558
|
+
return undefined;
|
|
559
|
+
}
|
|
560
|
+
return [Math.min(xmin, xmax), Math.min(ymin, ymax), Math.max(xmin, xmax), Math.max(ymin, ymax)];
|
|
561
|
+
}
|
|
562
|
+
function readNumericAttribute(lookup, key) {
|
|
563
|
+
const raw = lookup.get(key);
|
|
564
|
+
if (raw === null || raw === undefined || raw.trim() === "") {
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
const parsed = Number(raw);
|
|
568
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
569
|
+
}
|
|
570
|
+
function toGeocodeMatch(match) {
|
|
571
|
+
return {
|
|
572
|
+
address: match.address,
|
|
573
|
+
latitude: match.latitude,
|
|
574
|
+
longitude: match.longitude,
|
|
575
|
+
score: 100,
|
|
576
|
+
attributes: match.attributes,
|
|
577
|
+
provenance: match.provenance,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-image-layer.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/map-image-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"map-image-layer.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/map-image-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAmD,MAAM,gBAAgB,CAAC;AAGjG,MAAM,WAAW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