@capgo/nativegeocoder 0.1.12 → 0.1.15
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/LICENSE +21 -0
- package/README.md +28 -17
- package/dist/docs.json +47 -17
- package/dist/esm/definitions.d.ts +50 -2
- package/dist/esm/definitions.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Capgo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -54,12 +54,16 @@ This API requires the following permissions be added to your `AndroidManifest.xm
|
|
|
54
54
|
reverseGeocode(options: reverseOptions) => Promise<{ addresses: Adress[]; }>
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Convert latitude and longitude to an address
|
|
58
|
+
|
|
57
59
|
| Param | Type |
|
|
58
60
|
| ------------- | --------------------------------------------------------- |
|
|
59
61
|
| **`options`** | <code><a href="#reverseoptions">reverseOptions</a></code> |
|
|
60
62
|
|
|
61
63
|
**Returns:** <code>Promise<{ addresses: Adress[]; }></code>
|
|
62
64
|
|
|
65
|
+
**Since:** 0.0.1
|
|
66
|
+
|
|
63
67
|
--------------------
|
|
64
68
|
|
|
65
69
|
|
|
@@ -69,12 +73,16 @@ reverseGeocode(options: reverseOptions) => Promise<{ addresses: Adress[]; }>
|
|
|
69
73
|
forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
|
|
70
74
|
```
|
|
71
75
|
|
|
76
|
+
Convert an address to latitude and longitude
|
|
77
|
+
|
|
72
78
|
| Param | Type |
|
|
73
79
|
| ------------- | --------------------------------------------------------- |
|
|
74
80
|
| **`options`** | <code><a href="#forwardoptions">ForwardOptions</a></code> |
|
|
75
81
|
|
|
76
82
|
**Returns:** <code>Promise<{ addresses: Adress[]; }></code>
|
|
77
83
|
|
|
84
|
+
**Since:** 0.0.1
|
|
85
|
+
|
|
78
86
|
--------------------
|
|
79
87
|
|
|
80
88
|
|
|
@@ -85,8 +93,8 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
|
|
|
85
93
|
|
|
86
94
|
| Prop | Type |
|
|
87
95
|
| --------------------------- | --------------------- |
|
|
88
|
-
| **`latitude`** | <code>
|
|
89
|
-
| **`longitude`** | <code>
|
|
96
|
+
| **`latitude`** | <code>number</code> |
|
|
97
|
+
| **`longitude`** | <code>number</code> |
|
|
90
98
|
| **`countryCode`** | <code>string</code> |
|
|
91
99
|
| **`postalCode`** | <code>string</code> |
|
|
92
100
|
| **`administrativeArea`** | <code>string</code> |
|
|
@@ -101,24 +109,27 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
|
|
|
101
109
|
|
|
102
110
|
#### reverseOptions
|
|
103
111
|
|
|
104
|
-
| Prop | Type |
|
|
105
|
-
| ------------------- | -------------------- |
|
|
106
|
-
| **`latitude`** | <code>number</code> |
|
|
107
|
-
| **`longitude`** | <code>number</code> |
|
|
108
|
-
| **`useLocale`** | <code>boolean</code> |
|
|
109
|
-
| **`defaultLocale`** | <code>string</code> |
|
|
110
|
-
| **`maxResults`** | <code>number</code> |
|
|
111
|
-
| **`apiKey`** | <code>string</code> |
|
|
112
|
+
| Prop | Type | Description |
|
|
113
|
+
| ------------------- | -------------------- | ------------------------------------------------------------------------ |
|
|
114
|
+
| **`latitude`** | <code>number</code> | latitude is a number representing the latitude of the location. |
|
|
115
|
+
| **`longitude`** | <code>number</code> | longitude is a number representing the longitude of the location. |
|
|
116
|
+
| **`useLocale`** | <code>boolean</code> | Localise the results to the given locale. |
|
|
117
|
+
| **`defaultLocale`** | <code>string</code> | locale is a string in the format of language_country, for example en_US. |
|
|
118
|
+
| **`maxResults`** | <code>number</code> | Max number of results to return. |
|
|
119
|
+
| **`apiKey`** | <code>string</code> | Only used for web platform to use google api |
|
|
112
120
|
|
|
113
121
|
|
|
114
122
|
#### ForwardOptions
|
|
115
123
|
|
|
116
|
-
| Prop | Type |
|
|
117
|
-
| ------------------- | -------------------- |
|
|
118
|
-
| **`addressString`** | <code>string</code> |
|
|
119
|
-
| **`useLocale`** | <code>boolean</code> |
|
|
120
|
-
| **`defaultLocale`** | <code>string</code> |
|
|
121
|
-
| **`maxResults`** | <code>number</code> |
|
|
122
|
-
| **`apiKey`** | <code>string</code> |
|
|
124
|
+
| Prop | Type | Description |
|
|
125
|
+
| ------------------- | -------------------- | ------------------------------------------------------------------------ |
|
|
126
|
+
| **`addressString`** | <code>string</code> | address is a string of the address to be geocoded. |
|
|
127
|
+
| **`useLocale`** | <code>boolean</code> | Localise the results to the given locale. |
|
|
128
|
+
| **`defaultLocale`** | <code>string</code> | locale is a string in the format of language_country, for example en_US. |
|
|
129
|
+
| **`maxResults`** | <code>number</code> | Max number of results to return. |
|
|
130
|
+
| **`apiKey`** | <code>string</code> | Only used for web platform to use google api |
|
|
123
131
|
|
|
124
132
|
</docgen-api>
|
|
133
|
+
|
|
134
|
+
## Thanks
|
|
135
|
+
To [@sebastianbaar](https://github.com/sebastianbaar) and his work on [cordova-plugin-nativegeocoder](https://github.com/sebastianbaar/cordova-plugin-nativegeocoder) what he made was very inspiring
|
package/dist/docs.json
CHANGED
|
@@ -16,8 +16,25 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"returns": "Promise<{ addresses: Adress[]; }>",
|
|
19
|
-
"tags": [
|
|
20
|
-
|
|
19
|
+
"tags": [
|
|
20
|
+
{
|
|
21
|
+
"name": "param",
|
|
22
|
+
"text": "id The bundle id to delete (note, this is the bundle id, NOT the version name)"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "returns",
|
|
26
|
+
"text": "an Promise with the list of addresses according to maxResults"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "throws",
|
|
30
|
+
"text": "An error if the something went wrong"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "since",
|
|
34
|
+
"text": "0.0.1"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"docs": "Convert latitude and longitude to an address",
|
|
21
38
|
"complexTypes": [
|
|
22
39
|
"Adress",
|
|
23
40
|
"reverseOptions"
|
|
@@ -35,8 +52,21 @@
|
|
|
35
52
|
}
|
|
36
53
|
],
|
|
37
54
|
"returns": "Promise<{ addresses: Adress[]; }>",
|
|
38
|
-
"tags": [
|
|
39
|
-
|
|
55
|
+
"tags": [
|
|
56
|
+
{
|
|
57
|
+
"name": "returns",
|
|
58
|
+
"text": "an Promise with the list of addresses according to maxResults"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "throws",
|
|
62
|
+
"text": "An error if the something went wrong"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "since",
|
|
66
|
+
"text": "0.0.1"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"docs": "Convert an address to latitude and longitude",
|
|
40
70
|
"complexTypes": [
|
|
41
71
|
"Adress",
|
|
42
72
|
"ForwardOptions"
|
|
@@ -59,14 +89,14 @@
|
|
|
59
89
|
"tags": [],
|
|
60
90
|
"docs": "",
|
|
61
91
|
"complexTypes": [],
|
|
62
|
-
"type": "
|
|
92
|
+
"type": "number"
|
|
63
93
|
},
|
|
64
94
|
{
|
|
65
95
|
"name": "longitude",
|
|
66
96
|
"tags": [],
|
|
67
97
|
"docs": "",
|
|
68
98
|
"complexTypes": [],
|
|
69
|
-
"type": "
|
|
99
|
+
"type": "number"
|
|
70
100
|
},
|
|
71
101
|
{
|
|
72
102
|
"name": "countryCode",
|
|
@@ -150,42 +180,42 @@
|
|
|
150
180
|
{
|
|
151
181
|
"name": "latitude",
|
|
152
182
|
"tags": [],
|
|
153
|
-
"docs": "",
|
|
183
|
+
"docs": "latitude is a number representing the latitude of the location.",
|
|
154
184
|
"complexTypes": [],
|
|
155
185
|
"type": "number"
|
|
156
186
|
},
|
|
157
187
|
{
|
|
158
188
|
"name": "longitude",
|
|
159
189
|
"tags": [],
|
|
160
|
-
"docs": "",
|
|
190
|
+
"docs": "longitude is a number representing the longitude of the location.",
|
|
161
191
|
"complexTypes": [],
|
|
162
192
|
"type": "number"
|
|
163
193
|
},
|
|
164
194
|
{
|
|
165
195
|
"name": "useLocale",
|
|
166
196
|
"tags": [],
|
|
167
|
-
"docs": "",
|
|
197
|
+
"docs": "Localise the results to the given locale.",
|
|
168
198
|
"complexTypes": [],
|
|
169
199
|
"type": "boolean | undefined"
|
|
170
200
|
},
|
|
171
201
|
{
|
|
172
202
|
"name": "defaultLocale",
|
|
173
203
|
"tags": [],
|
|
174
|
-
"docs": "",
|
|
204
|
+
"docs": "locale is a string in the format of language_country, for example en_US.",
|
|
175
205
|
"complexTypes": [],
|
|
176
206
|
"type": "string | undefined"
|
|
177
207
|
},
|
|
178
208
|
{
|
|
179
209
|
"name": "maxResults",
|
|
180
210
|
"tags": [],
|
|
181
|
-
"docs": "",
|
|
211
|
+
"docs": "Max number of results to return.",
|
|
182
212
|
"complexTypes": [],
|
|
183
213
|
"type": "number | undefined"
|
|
184
214
|
},
|
|
185
215
|
{
|
|
186
216
|
"name": "apiKey",
|
|
187
217
|
"tags": [],
|
|
188
|
-
"docs": "",
|
|
218
|
+
"docs": "Only used for web platform to use google api",
|
|
189
219
|
"complexTypes": [],
|
|
190
220
|
"type": "string | undefined"
|
|
191
221
|
}
|
|
@@ -201,35 +231,35 @@
|
|
|
201
231
|
{
|
|
202
232
|
"name": "addressString",
|
|
203
233
|
"tags": [],
|
|
204
|
-
"docs": "",
|
|
234
|
+
"docs": "address is a string of the address to be geocoded.",
|
|
205
235
|
"complexTypes": [],
|
|
206
236
|
"type": "string"
|
|
207
237
|
},
|
|
208
238
|
{
|
|
209
239
|
"name": "useLocale",
|
|
210
240
|
"tags": [],
|
|
211
|
-
"docs": "",
|
|
241
|
+
"docs": "Localise the results to the given locale.",
|
|
212
242
|
"complexTypes": [],
|
|
213
243
|
"type": "boolean | undefined"
|
|
214
244
|
},
|
|
215
245
|
{
|
|
216
246
|
"name": "defaultLocale",
|
|
217
247
|
"tags": [],
|
|
218
|
-
"docs": "",
|
|
248
|
+
"docs": "locale is a string in the format of language_country, for example en_US.",
|
|
219
249
|
"complexTypes": [],
|
|
220
250
|
"type": "string | undefined"
|
|
221
251
|
},
|
|
222
252
|
{
|
|
223
253
|
"name": "maxResults",
|
|
224
254
|
"tags": [],
|
|
225
|
-
"docs": "",
|
|
255
|
+
"docs": "Max number of results to return.",
|
|
226
256
|
"complexTypes": [],
|
|
227
257
|
"type": "number | undefined"
|
|
228
258
|
},
|
|
229
259
|
{
|
|
230
260
|
"name": "apiKey",
|
|
231
261
|
"tags": [],
|
|
232
|
-
"docs": "",
|
|
262
|
+
"docs": "Only used for web platform to use google api",
|
|
233
263
|
"complexTypes": [],
|
|
234
264
|
"type": "string | undefined"
|
|
235
265
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface Adress {
|
|
2
|
-
latitude:
|
|
3
|
-
longitude:
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
4
|
countryCode: string;
|
|
5
5
|
postalCode: string;
|
|
6
6
|
administrativeArea: string;
|
|
@@ -13,24 +13,72 @@ export interface Adress {
|
|
|
13
13
|
formatted_address: string;
|
|
14
14
|
}
|
|
15
15
|
export interface ForwardOptions {
|
|
16
|
+
/**
|
|
17
|
+
* address is a string of the address to be geocoded.
|
|
18
|
+
*/
|
|
16
19
|
addressString: string;
|
|
20
|
+
/**
|
|
21
|
+
* Localise the results to the given locale.
|
|
22
|
+
*/
|
|
17
23
|
useLocale?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* locale is a string in the format of language_country, for example en_US.
|
|
26
|
+
*/
|
|
18
27
|
defaultLocale?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Max number of results to return.
|
|
30
|
+
*/
|
|
19
31
|
maxResults?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Only used for web platform to use google api
|
|
34
|
+
*/
|
|
20
35
|
apiKey?: string;
|
|
21
36
|
}
|
|
22
37
|
export interface reverseOptions {
|
|
38
|
+
/**
|
|
39
|
+
* latitude is a number representing the latitude of the location.
|
|
40
|
+
*/
|
|
23
41
|
latitude: number;
|
|
42
|
+
/**
|
|
43
|
+
* longitude is a number representing the longitude of the location.
|
|
44
|
+
*/
|
|
24
45
|
longitude: number;
|
|
46
|
+
/**
|
|
47
|
+
* Localise the results to the given locale.
|
|
48
|
+
*/
|
|
25
49
|
useLocale?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* locale is a string in the format of language_country, for example en_US.
|
|
52
|
+
*/
|
|
26
53
|
defaultLocale?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Max number of results to return.
|
|
56
|
+
*/
|
|
27
57
|
maxResults?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Only used for web platform to use google api
|
|
60
|
+
*/
|
|
28
61
|
apiKey?: string;
|
|
29
62
|
}
|
|
30
63
|
export interface NativeGeocoderPlugin {
|
|
64
|
+
/**
|
|
65
|
+
* Convert latitude and longitude to an address
|
|
66
|
+
*
|
|
67
|
+
* @param id The bundle id to delete (note, this is the bundle id, NOT the version name)
|
|
68
|
+
* @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults
|
|
69
|
+
* @throws An error if the something went wrong
|
|
70
|
+
* @since 0.0.1
|
|
71
|
+
*/
|
|
31
72
|
reverseGeocode(options: reverseOptions): Promise<{
|
|
32
73
|
addresses: Adress[];
|
|
33
74
|
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Convert an address to latitude and longitude
|
|
77
|
+
*
|
|
78
|
+
* @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults
|
|
79
|
+
* @throws An error if the something went wrong
|
|
80
|
+
* @since 0.0.1
|
|
81
|
+
*/
|
|
34
82
|
forwardGeocode(options: ForwardOptions): Promise<{
|
|
35
83
|
addresses: Adress[];
|
|
36
84
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Adress {\n latitude:\
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Adress {\n latitude:\tnumber\n longitude:\tnumber\n countryCode:\tstring\n postalCode:\tstring\n administrativeArea:\tstring\n subAdministrativeArea:\tstring\n locality:\tstring\n subLocality:\tstring\n thoroughfare:\tstring\n subThoroughfare:\tstring\n areasOfInterest:\tstring[]\n formatted_address: string\n}\n\nexport interface ForwardOptions {\n /**\n * address is a string of the address to be geocoded.\n */\n addressString:\tstring\n /**\n * Localise the results to the given locale.\n */\n useLocale?:\tboolean\n /**\n * locale is a string in the format of language_country, for example en_US.\n */\n defaultLocale?:\tstring\n /**\n * Max number of results to return.\n */\n maxResults?:\tnumber\n /**\n * Only used for web platform to use google api\n */\n apiKey?:\tstring\n}\nexport interface reverseOptions {\n /**\n * latitude is a number representing the latitude of the location.\n */\n latitude:\tnumber\n /**\n * longitude is a number representing the longitude of the location.\n */\n longitude:\tnumber\n /**\n * Localise the results to the given locale.\n */\n useLocale?:\tboolean\n /**\n * locale is a string in the format of language_country, for example en_US.\n */\n defaultLocale?:\tstring\n /**\n * Max number of results to return.\n */\n maxResults?:\tnumber\n /**\n * Only used for web platform to use google api\n */\n apiKey?:\tstring\n}\nexport interface NativeGeocoderPlugin {\n /**\n * Convert latitude and longitude to an address\n *\n * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n reverseGeocode(options: reverseOptions): Promise<{ addresses:\tAdress[] }>;\n /**\n * Convert an address to latitude and longitude\n *\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n forwardGeocode(options: ForwardOptions): Promise<{ addresses:\tAdress[] }>;\n}\n"]}
|