@capgo/nativegeocoder 0.1.10 → 0.1.13
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/README.md
CHANGED
|
@@ -85,8 +85,8 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
|
|
|
85
85
|
|
|
86
86
|
| Prop | Type |
|
|
87
87
|
| --------------------------- | --------------------- |
|
|
88
|
-
| **`latitude`** | <code>
|
|
89
|
-
| **`longitude`** | <code>
|
|
88
|
+
| **`latitude`** | <code>number</code> |
|
|
89
|
+
| **`longitude`** | <code>number</code> |
|
|
90
90
|
| **`countryCode`** | <code>string</code> |
|
|
91
91
|
| **`postalCode`** | <code>string</code> |
|
|
92
92
|
| **`administrativeArea`** | <code>string</code> |
|
|
@@ -101,24 +101,16 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
|
|
|
101
101
|
|
|
102
102
|
#### reverseOptions
|
|
103
103
|
|
|
104
|
-
| Prop
|
|
105
|
-
|
|
|
106
|
-
| **`latitude`**
|
|
107
|
-
| **`longitude`**
|
|
108
|
-
| **`useLocale`** | <code>boolean</code> |
|
|
109
|
-
| **`defaultLocale`** | <code>string</code> |
|
|
110
|
-
| **`maxResults`** | <code>number</code> |
|
|
111
|
-
| **`apiKey`** | <code>string</code> |
|
|
104
|
+
| Prop | Type |
|
|
105
|
+
| --------------- | ------------------- |
|
|
106
|
+
| **`latitude`** | <code>number</code> |
|
|
107
|
+
| **`longitude`** | <code>number</code> |
|
|
112
108
|
|
|
113
109
|
|
|
114
110
|
#### ForwardOptions
|
|
115
111
|
|
|
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> |
|
|
112
|
+
| Prop | Type |
|
|
113
|
+
| ------------------- | ------------------- |
|
|
114
|
+
| **`addressString`** | <code>string</code> |
|
|
123
115
|
|
|
124
116
|
</docgen-api>
|
|
@@ -58,8 +58,8 @@ public class NativeGeocoder {
|
|
|
58
58
|
|
|
59
59
|
// https://developer.android.com/reference/android/location/Address.html
|
|
60
60
|
JSONObject placemark = new JSONObject();
|
|
61
|
-
placemark.put("latitude", !String.valueOf(address.getLatitude()).isEmpty() ? address.getLatitude() :
|
|
62
|
-
placemark.put("longitude", !String.valueOf(address.getLongitude()).isEmpty() ? address.getLongitude() :
|
|
61
|
+
placemark.put("latitude", !String.valueOf(address.getLatitude()).isEmpty() ? address.getLatitude() : 0);
|
|
62
|
+
placemark.put("longitude", !String.valueOf(address.getLongitude()).isEmpty() ? address.getLongitude() : 0);
|
|
63
63
|
placemark.put("countryCode", address.getCountryCode() != null ? address.getCountryCode() : "");
|
|
64
64
|
placemark.put("countryName", address.getCountryName() != null ? address.getCountryName() : "");
|
|
65
65
|
placemark.put("postalCode", address.getPostalCode() != null ? address.getPostalCode() : "");
|
|
@@ -126,8 +126,8 @@ public class NativeGeocoder {
|
|
|
126
126
|
if (!latitude.isEmpty() && !longitude.isEmpty()) {
|
|
127
127
|
// https://developer.android.com/reference/android/location/Address.html
|
|
128
128
|
JSObject placemark = new JSObject();
|
|
129
|
-
placemark.put("latitude",
|
|
130
|
-
placemark.put("longitude",
|
|
129
|
+
placemark.put("latitude", address.getLatitude());
|
|
130
|
+
placemark.put("longitude", address.getLongitude());
|
|
131
131
|
placemark.put("countryCode", address.getCountryCode() != null ? address.getCountryCode() : "");
|
|
132
132
|
placemark.put("countryName", address.getCountryName() != null ? address.getCountryName() : "");
|
|
133
133
|
placemark.put("postalCode", address.getPostalCode() != null ? address.getPostalCode() : "");
|
package/dist/docs.json
CHANGED
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"tags": [],
|
|
60
60
|
"docs": "",
|
|
61
61
|
"complexTypes": [],
|
|
62
|
-
"type": "
|
|
62
|
+
"type": "number"
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"name": "longitude",
|
|
66
66
|
"tags": [],
|
|
67
67
|
"docs": "",
|
|
68
68
|
"complexTypes": [],
|
|
69
|
-
"type": "
|
|
69
|
+
"type": "number"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"name": "countryCode",
|
|
@@ -160,34 +160,6 @@
|
|
|
160
160
|
"docs": "",
|
|
161
161
|
"complexTypes": [],
|
|
162
162
|
"type": "number"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"name": "useLocale",
|
|
166
|
-
"tags": [],
|
|
167
|
-
"docs": "",
|
|
168
|
-
"complexTypes": [],
|
|
169
|
-
"type": "boolean | undefined"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"name": "defaultLocale",
|
|
173
|
-
"tags": [],
|
|
174
|
-
"docs": "",
|
|
175
|
-
"complexTypes": [],
|
|
176
|
-
"type": "string | undefined"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"name": "maxResults",
|
|
180
|
-
"tags": [],
|
|
181
|
-
"docs": "",
|
|
182
|
-
"complexTypes": [],
|
|
183
|
-
"type": "number | undefined"
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"name": "apiKey",
|
|
187
|
-
"tags": [],
|
|
188
|
-
"docs": "",
|
|
189
|
-
"complexTypes": [],
|
|
190
|
-
"type": "string | undefined"
|
|
191
163
|
}
|
|
192
164
|
]
|
|
193
165
|
},
|
|
@@ -204,34 +176,6 @@
|
|
|
204
176
|
"docs": "",
|
|
205
177
|
"complexTypes": [],
|
|
206
178
|
"type": "string"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"name": "useLocale",
|
|
210
|
-
"tags": [],
|
|
211
|
-
"docs": "",
|
|
212
|
-
"complexTypes": [],
|
|
213
|
-
"type": "boolean | undefined"
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"name": "defaultLocale",
|
|
217
|
-
"tags": [],
|
|
218
|
-
"docs": "",
|
|
219
|
-
"complexTypes": [],
|
|
220
|
-
"type": "string | undefined"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"name": "maxResults",
|
|
224
|
-
"tags": [],
|
|
225
|
-
"docs": "",
|
|
226
|
-
"complexTypes": [],
|
|
227
|
-
"type": "number | undefined"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"name": "apiKey",
|
|
231
|
-
"tags": [],
|
|
232
|
-
"docs": "",
|
|
233
|
-
"complexTypes": [],
|
|
234
|
-
"type": "string | undefined"
|
|
235
179
|
}
|
|
236
180
|
]
|
|
237
181
|
}
|
|
@@ -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;
|
|
@@ -12,20 +12,18 @@ export interface Adress {
|
|
|
12
12
|
areasOfInterest: string[];
|
|
13
13
|
formatted_address: string;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
16
|
-
addressString: string;
|
|
15
|
+
export interface baseOption {
|
|
17
16
|
useLocale?: boolean;
|
|
18
17
|
defaultLocale?: string;
|
|
19
18
|
maxResults?: number;
|
|
20
19
|
apiKey?: string;
|
|
21
20
|
}
|
|
22
|
-
export interface
|
|
21
|
+
export interface ForwardOptions extends baseOption {
|
|
22
|
+
addressString: string;
|
|
23
|
+
}
|
|
24
|
+
export interface reverseOptions extends baseOption {
|
|
23
25
|
latitude: number;
|
|
24
26
|
longitude: number;
|
|
25
|
-
useLocale?: boolean;
|
|
26
|
-
defaultLocale?: string;
|
|
27
|
-
maxResults?: number;
|
|
28
|
-
apiKey?: string;
|
|
29
27
|
}
|
|
30
28
|
export interface NativeGeocoderPlugin {
|
|
31
29
|
reverseGeocode(options: reverseOptions): Promise<{
|
|
@@ -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 baseOption {\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 ForwardOptions extends baseOption {\n /*\n * address is a string of the address to be geocoded.\n */\n addressString:\tstring\n}\nexport interface reverseOptions extends baseOption {\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}\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"]}
|