0

How can I calculate (estimate) miles/kilometers using the Euclidean TSP with latitudes and longitudes with the TSP library in R?

The follow results in a tour length of 0.2122963 in latitude / longitude This article explains how to convert latitude to miles, so I was thinking that there might already be a quick way to do this in R that I haven't learned yet. https://sciencing.com/convert-degrees-latitude-miles-5744407.html

I thought to ask the experts here. Thanks for your input.

library(TSP)
lat <- c(45.626,
         45.590,
         45.540,
         45.536,
         45.533)
long <- c(-122.997,
          -123.013,
          -122.970,
          -122.966,
          -122.965)
demand <- c(1:5)
best_route <- data.frame(x = long, y = lat, row.names = demand )
etsp <- ETSP(best_route)
tour <- solve_TSP(etsp)
tour
windyvation
  • 497
  • 3
  • 13

0 Answers0