Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-geocoder

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-geocoder - npm Package Compare versions

Comparing version 3.6.0 to 3.6.2

12

CHANGELOG.md

@@ -185,1 +185,13 @@ # Changelog

* Teleport Geocoder
## 3.6.0
* Support search object for mapquest geocoder
## 3.6.1
* Fix opencage callback error
* Fix opencage confidence

50

lib/geocoder/opencagegeocoder.js
var util = require('util'),
AbstractGeocoder = require('./abstractgeocoder');
// http://geocoder.opencagedata.com/api.html#confidence
var ConfidenceInKM = {
10: 0.25,
9: 0.5,
8: 1,
7: 5,
6: 7.5,
5: 10,
4: 15,
3: 20,
2: 25,
1: Number.POSITIVE_INFINITY,
0: Number.NaN
};
/**

@@ -18,2 +33,3 @@ * Constructor

this._endpoint = 'http://api.opencagedata.com/geocode/v1/json';
this._ConfidenceInKM = ConfidenceInKM; // In case we need to support v1/v2 and this changes
};

@@ -23,28 +39,2 @@

var openCageRequestConfidence = {
0.9: 10, // < .25km
0.8: 8, // < 1km
0.7: 7, // < 5km
0.6: 5, // < 10km
0.5: 4, // < 15km
0.4: 2, // < 25km
0.3: 1, // > 25km
0.2: 1, // > 25km
0.1: 1, // > 25km
0: 0 // NA
};
var openCageResultConfidence = {
10: 0.9, // < .25km
9: 0.8, // < .5km
8: 0.8, // < 1km
7: 0.7, // < 5km
6: 0.6, // < 7.5km
5: 0.6, // < 10km
4: 0.5, // < 15km
3: 0.4, // < 15km
2: 0.4, // < 25km
1: 0.3, // > 25km
0: 0 // NA
};
/**

@@ -75,3 +65,3 @@ * Geocode

if (value.minConfidence) {
params.min_confidence = openCageRequestConfidence[value.minConfidence] || value.minConfidence;
params.min_confidence = value.minConfidence;
}

@@ -107,2 +97,3 @@ params.q = value.address;

OpenCageGeocoder.prototype._formatResult = function (result) {
var confidence = result.confidence || 0;
return {

@@ -120,3 +111,4 @@ 'latitude': result.geometry.lat,

'extra': {
confidence: openCageResultConfidence[result.confidence] || 0
confidence: confidence,
confidenceKM: this._ConfidenceInKM[result.confidence] || Number.NaN
}

@@ -142,3 +134,3 @@ };

if (err) {
throw err;
callback(err);
} else {

@@ -145,0 +137,0 @@ var results = [];

{
"name": "node-geocoder",
"version": "3.6.0",
"version": "3.6.2",
"description": "Node Geocoder, node geocoding library, supports google maps, mapquest, open street map, tom tom, promise",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc