Include route=foot in trails

This commit is contained in:
Pieter Vander Vennet 2022-01-25 18:20:15 +01:00
parent b61c0a1180
commit 791c6c4f55
5 changed files with 34 additions and 8 deletions

View file

@ -376,9 +376,29 @@ async function main(args: string[]) {
const lat1 = Number(args[5])
const lon1 = Number(args[6])
if(isNaN(lat0)){
throw "The first number (a latitude) is not a valid number"
}
if(isNaN(lon0)){
throw "The second number (a longitude) is not a valid number"
}
if(isNaN(lat1)){
throw "The third number (a latitude) is not a valid number"
}
if(isNaN(lon1)){
throw "The first number (a longitude) is not a valid number"
}
const tileRange = Tiles.TileRangeBetween(zoomlevel, lat0, lon0, lat1, lon1)
if(isNaN(tileRange.total)){
throw "Something has gone wrong: tilerange is NAN"
}
if (tileRange.total === 0) {
console.log("Tilerange has zero tiles - this is probably an error")
return
@ -440,8 +460,9 @@ async function main(args: string[]) {
let args = [...process.argv]
args.splice(0, 2)
try {
main(args).catch(e => console.error("Error building cache:", e));
main(args)
.then(() => console.log("All done!"))
.catch(e => console.error("Error building cache:", e));
} catch (e) {
console.error("Error building cache:", e)
}
console.log("All done!")
}