You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
978 B
JavaScript
34 lines
978 B
JavaScript
"use strict";
|
|
import fetch from 'node-fetch';
|
|
|
|
async function main() {
|
|
|
|
let lat = 37.769518;
|
|
let lon = -122.412015;
|
|
|
|
// Area area to search around position for query
|
|
let range = 5 / 1000;
|
|
// Quantity of streetside positions to query for.
|
|
// We only are interested in the one closest to the latitude and longitude
|
|
// so 1 will be fine.
|
|
const count = 1;
|
|
|
|
const formattedURL =
|
|
`https://t.ssl.ak.tiles.virtualearth.net/tiles/cmd/StreetSideBubbleMetaData`
|
|
+ `?count=${count}`
|
|
+ `&north=${lat + range}&south=${lat - range}`
|
|
+ `&east=${lon + range}&west=${lon - range}`;
|
|
|
|
// Send query
|
|
const resp = await fetch(formattedURL);
|
|
if (resp.status === 200) {
|
|
const text = await resp.text();
|
|
const parsed = JSON.parse(text);
|
|
// Print id to standard output
|
|
console.log(parsed[1]?.id);
|
|
|
|
} else {
|
|
console.log("Could not get ID", " Status: ", resp.status);
|
|
}
|
|
}
|
|
main(); |