@datagica/parse-locations
v0.0.8
Published
location parser
Downloads
30
Readme
@datagica/parse-locations
Extract locations from a document. Takes some times for the first call to load the city database.
Based on @datagica/parse-cities
which is a bit fat module, the last version is too large to be on NPM so I used a git+ssh dependency link.
Installation
$ npm install --save @datagica/parse-locations
Usage
import parseLocations from "@datagica/parse-locations";
parseLocations("Pierre Dupont. 12345\. Saint-léger-du-malzieu en France.").then(..).catch(..)
// will output:
[
{
"ngram": "Saint-léger-du-malzieu en France",
"value": {
"id": "fr-saint-léger-du-malzieu",
"countryCode": "FR",
"country": "France",
"label": {
"en": "Saint-léger-du-malzieu, France"
},
"aliases": ["Saint-léger-du-malzieu France"],
"location": [44.8881, 3.3094]
},
"score": 1,
"position": {
"substring": {
"begin": 33,
"end": 65
},
"fullstring": {
"begin": 33,
"end": 65
}
}
}
]
// pretty cool right?