@nextgis/geocoder 1.18.15 → 1.18.18

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/lib/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import CancelablePromise from '@nextgis/cancelable-promise';
9
9
  import type { FeatureItem } from '@nextgis/ngw-connector';
10
10
  import type { FetchNgwItemsOptions } from '@nextgis/ngw-kit';
11
11
  import { GeoJsonObject } from 'geojson';
12
+ import { LngLatArray } from '@nextgis/utils';
12
13
  import { LngLatBoundsArray } from '@nextgis/utils';
13
14
  import NgwConnector from '@nextgis/ngw-connector';
14
15
  import type { NgwConnectorOptions } from '@nextgis/ngw-connector';
@@ -26,18 +27,27 @@ declare abstract class BaseGeocoder<O extends Record<string, any> = Record<strin
26
27
  * Search method to retrieve geocoding results.
27
28
  *
28
29
  * @abstract
29
- * @param {string} query - The search string to geocode.
30
- * @yields {AsyncGenerator<SearchItem>} - An async generator that yields search results.
30
+ * @param query - The search string to geocode.
31
+ * @yields An async generator that yields search results.
31
32
  */
32
33
  abstract search(query: string): AsyncGenerator<SearchItem>;
33
34
  /**
34
35
  * Method to retrieve detailed result for a specific search item.
35
36
  *
36
37
  * @abstract
37
- * @param {SearchItem} item - The search item to get detailed result for.
38
- * @returns {CancelablePromise<any>} - A promise that resolves to the detailed result.
38
+ * @param item - The search item to get detailed result for.
39
+ * @returns A promise that resolves to the detailed result.
39
40
  */
40
41
  abstract result(item: SearchItem): CancelablePromise<any>;
42
+ /**
43
+ * Method for reverse geocoding.
44
+ * Takes coordinates and returns the corresponding address or location information.
45
+ *
46
+ * @abstract
47
+ * @param coordinates - The longitude and latitude values.
48
+ * @returns An async generator that yields reverse geocoding results.
49
+ */
50
+ abstract reverse(coordinates: LngLatArray): AsyncGenerator<SearchItem>;
41
51
  /**
42
52
  * Optional method to abort any ongoing geocoding requests.
43
53
  *
@@ -88,6 +98,14 @@ export declare class Geocoder extends BaseGeocoder<GeocoderOptions> {
88
98
  abort(): void;
89
99
  search(query: string): AsyncGenerator<SearchItem, void, unknown>;
90
100
  result(item: SearchItem): CancelablePromise<any>;
101
+ reverse(coordinates: LngLatArray): AsyncGenerator<SearchItem, void, unknown>;
102
+ /**
103
+ * Returns the first reverse geocoding result for given coordinates from any provider.
104
+ *
105
+ * @param coordinates - The longitude and latitude values.
106
+ * @returns A promise that resolves to the first reverse geocoding result, or undefined if no results are found.
107
+ */
108
+ reverseGeocodeFirstResult(coordinates: LngLatArray): Promise<SearchItem | undefined>;
91
109
  }
92
110
 
93
111
  /**
@@ -109,6 +127,7 @@ export declare class NgwProvider extends BaseProvider<NgwProviderOptions> {
109
127
  abort(): void;
110
128
  search(query: string): AsyncGenerator<NgwSearchItem, void, unknown>;
111
129
  result(item: NgwSearchItem): CancelablePromise<ResultItem>;
130
+ reverse(coordinates: LngLatArray): AsyncGenerator<SearchItem, void, unknown>;
112
131
  private _makeSignal;
113
132
  private _items;
114
133
  }
@@ -146,6 +165,7 @@ export declare class NominatimProvider extends BaseProvider {
146
165
  abort(): void;
147
166
  search(val: string): AsyncGenerator<SearchItem, void, unknown>;
148
167
  result(model: SearchItem): CancelablePromise<ResultItem>;
168
+ reverse(coordinates: LngLatArray): AsyncGenerator<SearchItem, void, unknown>;
149
169
  }
150
170
 
151
171
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextgis/geocoder",
3
- "version": "1.18.15",
3
+ "version": "1.18.18",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "lib/geocoder.esm-bundler.js",
@@ -53,5 +53,5 @@
53
53
  "bugs": {
54
54
  "url": "https://github.com/nextgis/nextgis_frontend/issues"
55
55
  },
56
- "gitHead": "10fc096eaf42c9191dcdb7fb2bfec77a315285a8"
56
+ "gitHead": "383fb908139c79f1265a69fc9b48fef82028076c"
57
57
  }