@geosdi/ngx-geocoding 1.2.1 → 2.0.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/README.md +40 -12
- package/fesm2022/geosdi-ngx-geocoding.mjs +324 -564
- package/fesm2022/geosdi-ngx-geocoding.mjs.map +1 -1
- package/package.json +3 -4
- package/types/geosdi-ngx-geocoding.d.ts +167 -175
package/README.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# General information
|
|
1
|
+
# @geosdi/ngx-geocoding
|
|
4
2
|
|
|
5
3
|
Address search for Angular, from one or more sources tried **in order**.
|
|
6
4
|
|
|
@@ -17,11 +15,10 @@ that does not.
|
|
|
17
15
|
|
|
18
16
|
`npm i @geosdi/ngx-geocoding --save`
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
Peer dependencies:
|
|
21
19
|
|
|
22
|
-
"@angular/common": ">=
|
|
23
|
-
"@angular/core": ">=
|
|
24
|
-
"typescript": ">=5.0.0",
|
|
20
|
+
"@angular/common": ">=22.0.0",
|
|
21
|
+
"@angular/core": ">=22.0.0",
|
|
25
22
|
"rxjs": ">=7.8.0"
|
|
26
23
|
|
|
27
24
|
Nominatim is called through `HttpClient`, so the application must provide it —
|
|
@@ -103,10 +100,12 @@ Two things live outside this library.
|
|
|
103
100
|
two copies of it in the same page;
|
|
104
101
|
- **`libraries=places`** — without it only the third step of the cascade
|
|
105
102
|
(`Geocoder`) can answer;
|
|
106
|
-
- **`language`** decides the language of the suggestions
|
|
107
|
-
|
|
103
|
+
- **`language`** decides the language of the suggestions: the library passes no
|
|
104
|
+
language of its own to the SDK, so the one in the script tag is used;
|
|
108
105
|
- **`defer` is fine**: the library waits for the SDK up to 10 s, polling every
|
|
109
|
-
100 ms, so a search typed right after startup does not get lost.
|
|
106
|
+
100 ms, so a search typed right after startup does not get lost. Without
|
|
107
|
+
`libraries=places` the wait happens twice, once per Places step, so the first
|
|
108
|
+
search reaches the `Geocoder` only after about 20 s.
|
|
110
109
|
|
|
111
110
|
**2. The Google Cloud project**, where the key must have:
|
|
112
111
|
|
|
@@ -178,6 +177,10 @@ export class SearchComponent {
|
|
|
178
177
|
}
|
|
179
178
|
});
|
|
180
179
|
}
|
|
180
|
+
|
|
181
|
+
private moveMap(lat: number, lon: number): void {
|
|
182
|
+
// the application's own: for example map.setView([lat, lon], 16)
|
|
183
|
+
}
|
|
181
184
|
}
|
|
182
185
|
```
|
|
183
186
|
|
|
@@ -208,13 +211,16 @@ search" are two different things, and a search bar has to tell them apart.
|
|
|
208
211
|
| `subjectLocation` | subject to notify location |
|
|
209
212
|
| `subjectRemove` | subject to notify remove location |
|
|
210
213
|
|
|
214
|
+
Only `subjectNoResults` is emitted by the library. `subjectLocation` and `subjectRemove` are
|
|
215
|
+
channels for the application: nothing in the library calls `next` on them.
|
|
216
|
+
|
|
211
217
|
## Troubleshooting
|
|
212
218
|
|
|
213
219
|
Every fallback is logged with `console.warn`, prefixed `[ngx-geocoding]`.
|
|
214
220
|
|
|
215
|
-
| what
|
|
221
|
+
| what you see | what it means |
|
|
216
222
|
| ------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
217
|
-
| `SDK Maps senza la libreria 'places'` | `libraries=places` missing from the script tag, or no SDK in the page
|
|
223
|
+
| `SDK Maps senza la libreria 'places'` | `libraries=places` missing from the script tag, or no SDK in the page; ~20 s wait |
|
|
218
224
|
| `SDK Maps senza il Geocoder` | no SDK in the page at all |
|
|
219
225
|
| `REQUEST_DENIED` | product not enabled on the Cloud project, or referrer outside the key restrictions |
|
|
220
226
|
| `OVER_QUERY_LIMIT` | quota or billing on the Google project |
|
|
@@ -223,3 +229,25 @@ Every fallback is logged with `console.warn`, prefixed `[ngx-geocoding]`.
|
|
|
223
229
|
|
|
224
230
|
A source that refused is not asked again until the page is reloaded, so a fix on
|
|
225
231
|
the Cloud console needs a reload to be seen.
|
|
232
|
+
|
|
233
|
+
**Any error counts as a refusal, including a transient one.** A request that fails
|
|
234
|
+
because the network dropped for a moment, or a `429` from the public Nominatim
|
|
235
|
+
(easy to get with search-as-you-type), switches that source off for the session
|
|
236
|
+
just like a `REQUEST_DENIED` does. With `sources: ["nominatim"]` — the default —
|
|
237
|
+
every following search then fails with `Nessuna sorgente di geocoding disponibile`
|
|
238
|
+
until the page is reloaded. Debounce the input, and keep more than one source
|
|
239
|
+
where you can.
|
|
240
|
+
|
|
241
|
+
## Changes in 2.0.0
|
|
242
|
+
|
|
243
|
+
- **A major version** because the peer dependencies now ask for Angular 22:
|
|
244
|
+
an application on an older Angular can no longer install it. The API is
|
|
245
|
+
unchanged unless a point below says otherwise.
|
|
246
|
+
- `typescript` is no longer a peer dependency: nothing in the package
|
|
247
|
+
imports it.
|
|
248
|
+
- **The Angular peer dependencies are `>=22.0.0`**: the library is compiled and tested with
|
|
249
|
+
Angular 22 only, so it no longer claims to install on older versions.
|
|
250
|
+
- Compiled with Angular 22. The peer dependencies were already correct and are unchanged.
|
|
251
|
+
- This README: the title of the package, which events the library emits, and what a transient
|
|
252
|
+
error does to a source.
|
|
253
|
+
- The code is unchanged.
|