@spurreiter/geocoder
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@spurreiter/geocoder", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Node geocoding library, google maps, bing maps, mapquest, mapbox, here maps, arcgis, nominatim, ...", | ||
@@ -19,3 +19,5 @@ "keywords": [ | ||
"pelias", | ||
"teleport" | ||
"pickpoint-api", | ||
"teleport", | ||
"yandex-api" | ||
], | ||
@@ -22,0 +24,0 @@ "repository": { |
# geocoder | ||
This project is derived on [node-geocoder](https://github.com/nchaulet/node-geocoder) with focus on modern code with esm modules. | ||
This project is derived from [node-geocoder](https://github.com/nchaulet/node-geocoder) with focus on modern code with esm modules. | ||
@@ -32,5 +32,8 @@ Features: | ||
| [OpenCageGeocoder](https://opencagedata.com/) | ✅ | ✅ | ❌ | | | ||
| [OpendataFranceGeocoder](https://geo.api.gouv.fr/adresse) | ✅ | ✅ | ❌ | France only | | ||
| [OsmGeocoder](https://nominatim.org/release-docs/develop/) | ✅ | ✅ | ❌ | Searches nominatim.org | | ||
| [PeliasGeocoder](https://github.com/pelias/documentation/blob/master/README.md) | ✅ | ✅ | ❌ | Local or [Geocode.earth](https://geocode.earth/docs) | | ||
| [PickpointGeocoder](https://pickpoint.io/api-reference) | ✅ | ✅ | ❌ | | | ||
| [TeleportGeocoder](https://developers.teleport.org/api/resources/) | ✅ | ✅ | ❌ | Searches only by city names, no addresses | | ||
| [YandexGeocoder](https://yandex.com/dev/maps/geocoder/) | ✅ | ✅ | ❌ | | | ||
@@ -37,0 +40,0 @@ ## usage |
@@ -11,3 +11,3 @@ import { AbstractGeocoder, GeocoderResult, ForwardQuery, ReverseQuery } from './geocoder/index'; | ||
* status codes which shall be excluded from breaking the connection | ||
* @default [400, 404] | ||
* @default [400, 404, 422] | ||
*/ | ||
@@ -14,0 +14,0 @@ excludeStatusCode?: number[]; |
@@ -13,3 +13,3 @@ function CircuitBreakerError (provider = '') { | ||
this.timeout = timeout || 60000 | ||
this.excludeStatusCode = excludeStatusCode || [400, 404] | ||
this.excludeStatusCode = excludeStatusCode || [400, 404, 422] | ||
this.offlineUntil = 0 | ||
@@ -49,3 +49,3 @@ this.name = geocoder.name | ||
} catch (err) { | ||
this._turnOff(err.response?.status) | ||
this._turnOff(err.response?.status || err.status) | ||
throw err | ||
@@ -52,0 +52,0 @@ } |
import net from 'net' | ||
import { URL, URLSearchParams } from 'url' | ||
const wrapError400 = err => { | ||
err.status = 400 | ||
return err | ||
} | ||
/** | ||
@@ -74,6 +79,6 @@ * @typedef {object} ForwardQuery | ||
if (isIPv4 && !this.supportIPv4) { | ||
throw new Error(`${this.constructor.name} does not support geocoding IPv4`) | ||
throw wrapError400(new Error(`${this.constructor.name} does not support geocoding IPv4`)) | ||
} | ||
if (isIPv6 && !this.supportIPv6) { | ||
throw new Error(`${this.constructor.name} does not support geocoding IPv6`) | ||
throw wrapError400(new Error(`${this.constructor.name} does not support geocoding IPv6`)) | ||
} | ||
@@ -80,0 +85,0 @@ |
@@ -15,2 +15,4 @@ export * from "./abstract.js"; | ||
export * from "./pelias.js"; | ||
export * from "./pickpoint.js"; | ||
export * from "./teleport.js"; | ||
export * from "./yandex.js"; |
@@ -13,4 +13,7 @@ export * from './abstract.js' | ||
export * from './opencage.js' | ||
export * from './opendatafrance.js' | ||
export * from './osm.js' | ||
export * from './pelias.js' | ||
export * from './pickpoint.js' | ||
export * from './teleport.js' | ||
export * from './yandex.js' |
@@ -5,2 +5,3 @@ export * from "./adapter.js"; | ||
export * from "./circuitbreaker.js"; | ||
export * from "./formatter/index.js"; | ||
export * from "./geocoder/index.js"; |
@@ -5,2 +5,3 @@ export * from './adapter.js' | ||
export * from './circuitbreaker.js' | ||
export * from './formatter/index.js' | ||
export * from './geocoder/index.js' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
207679
89
6804
150