Socket
Socket
Sign inDemoInstall

@spurreiter/geocoder

Package Overview
Dependencies
35
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

lib/geocoder/geolite2.cjs

2

package.json
{
"name": "@spurreiter/geocoder",
"version": "1.2.1",
"version": "1.3.0",
"description": "Node geocoding library, google maps, bing maps, mapquest, mapbox, here maps, arcgis, nominatim, ...",

@@ -5,0 +5,0 @@ "keywords": [

@@ -16,7 +16,8 @@ # geocoder

- extensive test-suite with examples for getting started
- GeoJSON, GPX formatters
## supported providers
| Provider | forward | reverse | ip | Notes |
| -------- | ------- | ------- | -- | ----- |
| Provider | forward | reverse | ip | Notes |
| -------- | :-----: | :-----: | :--: | ----- |
| [ArcGisGeocoder](https://developers.arcgis.com/documentation/mapping-apis-and-services/search/) | ✅ | ✅ | ❌ | |

@@ -29,3 +30,3 @@ | [BingMapsGeocoder](https://docs.microsoft.com/en-us/bingmaps/rest-services/locations) | ✅ | ✅ | ❌ | results are in English only |

| [LocationIqGeocoder](https://locationiq.com/docs) | ✅ | ✅ | ❌ | |
| [LocalGeoip2Geocoder](https://dev.maxmind.com/geoip/geoip2/geolite2/) | ❌ | ❌ | ✅ | Local geoip2 provider. Output as of [@maxmind/geoip2-node](https://www.npmjs.com/package/@maxmind/geoip2-node) |
| [GeoLite2Geocoder](https://dev.maxmind.com/geoip/geoip2/geolite2/) | ❌ | ❌ | ✅ | Local GeoLite2 provider or MaxMind API. Output as of [@maxmind/geoip2-node](https://www.npmjs.com/package/@maxmind/geoip2-node) |
| [MapBoxGeocoder](https://docs.mapbox.com/) | ✅ | ✅ | ❌ | |

@@ -79,3 +80,3 @@ | [MapQuestGeocoder](https://developer.mapquest.com/documentation/geocoding-api) | ✅ | ✅ | ❌ | open-data and licensed versions are supported |

```js
const results = await geocoder.reverse({ lat: 40.714232,lng: -73.9612889 })
const results = await geocoder.reverse({ lat: 40.714232, lng: -73.9612889 })
// [

@@ -146,2 +147,45 @@ // {

## formatters
Formatters allow to format the geocoder result object to various formats like geoJson or gpx.
### geoJsonFormatter
The output of the GeoJSON formatter is according to [RFC-7946](https://datatracker.ietf.org/doc/html/rfc7946) and [geocodejson-spec](https://github.com/geocoders/geocodejson-spec).
```js
import { geoJsonFormatter } from '@spurreiter/geocoder'
const query = '135 pilkington avenue, birmingham'
const results = await geocoder.forward(query)
const geoJson = geoJsonFormatter(results, {query})
// {
// type: 'FeatureCollection',
// geocoding: {
// version: '0.1.0',
// license: null,
// attribution: null,
// query: '135 pilkington avenue, birmingham'
// },
// features: [{...}, ...]
// }
```
### gpxFormatter
```js
import { gpxFormatter } from '@spurreiter/geocoder'
const query = '135 pilkington avenue, birmingham'
const results = await geocoder.forward(query)
const gpx = gpxFormatter(results)
// <?xml version="1.0" encoding="UTF-8"?>
// <gpx version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
// <wpt lat="52.5487921" lon="-1.8164308339635031"><name>135, Pilkington Avenue, Maney, Sutton Coldfield, Wylde Green, Birmingham, West Midlands Combined Authority, West Midlands, England, B72 1LH, United Kingdom</name></wpt>
// </gpx>
```
## contributing

@@ -148,0 +192,0 @@

@@ -8,3 +8,3 @@ export * from "./abstract";

export * from "./ipstack";
export * from "./localgeoip2";
export * from "./geolite2";
export * from "./locationiq";

@@ -11,0 +11,0 @@ export * from "./mapbox";

@@ -8,3 +8,3 @@ export * from './abstract.js'

export * from './ipstack.js'
export * from './localgeoip2.js'
export * from './geolite2.js'
export * from './locationiq.js'

@@ -11,0 +11,0 @@ export * from './mapbox.js'

@@ -0,3 +1,4 @@

export * from "./camelCase";
export * from "./httperror";
export * from "./isocode";
export * from "./toUpperCase";

@@ -0,3 +1,4 @@

export * from './camelCase.js'
export * from './httperror.js'
export * from './isocode.js'
export * from './toUpperCase.js'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc