![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
wikigeocode
Advanced tools
Simple utility to geocode an administrative location using the wikimedia APIs.
This tiny module performs the geocode of an administrative location (town, city, county, state, country, etc) using the wikimedia APIs, returning the wikipedia page title and the lat, lon coordinates if available, caching the results for an hour. For example:
> const {fetchSearchGeo} = require('wikigeocode')
> fetchSearchGeo('bogota').then(x => console.log(x))
> { pageid: 211271,
ns: 0,
title: 'Bogotá',
coordinates:
[ { lat: 4.71111111,
lon: -74.07222222,
primary: '',
globe: 'earth' } ] }
The module only has an external node-fetch dependency to query the wikimedia APIs and Jest as dev dependency to run the tests.
You can install with [npm]:
$ npm install --save wikigeocode
The module provides two main functions: fetchGeo
to get the coordinates property from a wikipedia geographical entry and fetchExtract
to get the summary (extract) of that particular page:
> const {fetchGeo, fetchExtra} = require('wikigeocode')
> fetchGeo('dublin').then(x => console.log(x))
> { pageid: 8504,
ns: 0,
title: 'Dublin',
coordinates: [ { lat: 53.35, lon: -6.26666667, primary: '', globe: 'earth' } ] }
> fetchExtract('dublin').then(x => console.log(x))
>{ pageid: 8504,
ns: 0,
title: 'Dublin',
extract: 'Dublin (; Irish: Baile Átha Cliath [ˈbˠalʲə aːhə ˈclʲiə; ˌbʲlʲaː ˈclʲiə]) is the capital of, and largest city in, Ireland ... '}
The previous two functions require the exact wikipedia page title. If you don't know the exact entry, you can use fetchSearchGeo
and fetchSearchExtract
to get the closest match to your query:
> const {fetchSearchGeo, fetchSearchExtra} = require('wikigeocode')
> fetchSearchGeo('londonderry').then(x => console.log(x))
> { pageid: 9055,
ns: 0,
title: 'Derry',
coordinates: [ { lat: 54.9958, lon: -7.3074, primary: '', globe: 'earth' } ] }
> fetchSearchExtract('londonderry').then(x => console.log(x))
>{ pageid: 9055,
ns: 0,
title: 'Derry',
extract: 'Derry, officially Londonderry (), is the second-largest city in Northern Ireland and the fourth-largest city on the island of Ireland. ...'}
Copyright © 2019, Juan Convers. Released under the MIT License.
FAQs
Simple utility to geocode an administrative location using the wikimedia APIs.
We found that wikigeocode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.