1.0.0 • Published 6 years ago
fast-reverse-geocoder v1.0.0
fast-reverse-geocoder
A high-performance, offline reverse geocoder in JavaScript. The source of the data is Natural Earth 50m countries dataset. The key idea of algorithm is two-layers R-tree.
Installation
npm install fast-reverse-geocoderUsage
var rg = require('fast-reverse-geocoder');
console.log(rg.search(-122.08385, 37.38605));
//{ code: 'USA', name: 'United States of America' }API
rg.search(Longitude, Latitude)
Output:
| Attribute | type | Detail |
|---|---|---|
| code | string | ISO 3166-1 alpha-2 country code |
| name | string | country name |
Performance
Random 100k point
country-iso Benchmark took 11926.951654 milliseconds
country-reverse-geocoding Benchmark took 5683.125483 milliseconds
which-country Benchmark took 140.823448 milliseconds
fast-reverse-geocoder Benchmark took 120.940622 millisecondsDevelopment
Run performance tests:
npm testGenerate R-tree:
npm run build1.0.0
6 years ago