Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const geolib = require('geolib');
- var spots = {
- "Brandenburg Gate, Berlin": {latitude: 52.516272, longitude: 13.377722},
- "Dortmund U-Tower": {latitude: 51.515, longitude: 7.453619},
- "London Eye": {latitude: 51.503333, longitude: -0.119722},
- "Kremlin, Moscow": {latitude: 55.751667, longitude: 37.617778},
- "Eiffel Tower, Paris": {latitude: 48.8583, longitude: 2.2945},
- "Riksdag building, Stockholm": {latitude: 59.3275, longitude: 18.0675},
- "Royal Palace, Oslo": {latitude: 59.916911, longitude: 10.727567}
- }
- // in this case set offset to 1 otherwise the nearest point will always be your reference point
- console.log(geolib.findNearest(spots['Dortmund U-Tower'], spots, 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement