0.0.0 • Published 6 years ago

wikipedia-location-search v0.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

wikipedia-location-search

Search for wikipedia articles based on given geolocation using this API. Work in progress.

npm version Build Status Greenkeeper badge dependency status dev dependency status license chat on gitter

Installation

npm install wikipedia-location-search

Usage

The module returns a Promise that will resolve in a list of locations:

const articles = require('wikipedia-location-search')

articles(coordinates, opt)

The defaults for opt look like this:

{
    language: 'en', // wiki language code
    maxDistance: 10000, // max. distance to the coordinates in meters
    maxResults: 10 // max. number of results returned
}
articles({latitude: 37.786952, longitude: -122.399523}, {language: 'de'})
.then(console.log)

would give you something like this:

[
    {
        "id": 39927,
        "title": "Wikimedia_Foundation",
        "coordinates": {
            "longitude": -122.39957,
            "latitude": 37.78687
        },
        "distance": 10
    },
    {
        "id": 1365097,
        "title": "Cartoon_Art_Museum",
        "coordinates": {
            "longitude": -122.40098480194,
            "latitude": 37.787328048611
        },
        "distance": 135.1
    },
    {
        "id": 904290,
        "title": "San_Francisco_Museum_of_Modern_Art",
        "coordinates": {
            "longitude": -122.40083333333,
            "latitude": 37.785833333333
        },
        "distance": 169.5
    }
    // … 7 more
]

Contributing

If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.