0

I have a set of coordinates that I want to turn into an angle and do some Anova analysis. I used maptools trackAzimuth function to do it, but I keep losing one or two points. I assume it calculates angles between two coordinates. But I want 1 point (angle) on 1 latitude and longitude, for example at [-80.222, 30.555 to 45]. Since my longitude is in North America, it is in a negative value, do we have to convert into positive before converting it into angle? Please enlighten me on this. Following is my data;

Longitude          Latitude
-104.952           39.71478
-104.952           39.7149
-104.54            39.7148
-104.955           39.70441
-104.966           39.7175

My codes:

setwd("C:/Users/data")
install.packages("maptools")
library(maptools)
data <- read.table("data.csv", header = T, sep = ",")
dfr<-data.frame(data[3:4])
angle<-data.frame(trackAzimuth(as.matrix(dfr)))

My results is: Angle -81.001 -95.57075 -175.254 -32.628 Here, I lost 1 latitude and longitude. And my angles are negative, I want positive angles on this. How do I do it? Please help.

Thanks

r2evans
  • 141,215
  • 6
  • 77
  • 149
  • What is your expected output? While I don't use `maptools`, my guess is that this is giving you the tracks between 1-2, 2-3, 3-4, and 4-5. – r2evans Mar 17 '20 at 22:09
  • My expected output is 5 different angles at five latitude and longitude in my example data. I am reading a thread that said tan(y/x) gives an angle where x and y are latitude and longitude, but i am not sure if that is the right way. – Erik holder Mar 17 '20 at 22:39
  • What is your *exact actual* expected output. I inferred that 4 was wrong so 5 made sense. Do you have "truth" data to show what you should actually expect from these numbers? – r2evans Mar 17 '20 at 22:42
  • @r2evans, No, i do not have truth data. I am looking for a single number that represents the latitude and longitude, i believe angle is the one. But do not how to convert it. – Erik holder Mar 17 '20 at 23:45
  • From an "information" point of view, I don't think you can adequately reduce two numbers down to one and preserve the location that is suggested by the coordinates. What do you expect to extract from this number? Bearing from "0N 0E" or some other point? Those coordinates are all in or near Denver, CO, do you mean bearing from a point central or near them? (If from 0,0, then I think you'll find very low variance for an ANOVA or any particular analysis.) – r2evans Mar 17 '20 at 23:57

0 Answers0