2017-11-12 5 views
0

위도, 긴 및 방위각이 어떤 도움이 필요하십니까과 내가 만들고 lat에 따라 R의 공간 객체를 플롯하려고 , long & azimuth를 R의 공간 객체를 플롯. 방위각은 주어진 위도에서의 각도 분리입니다. 객체가 파란색으로 가득 아래 그림과 같이 예상 출력 :만들기와 ..

enter image description here

입력 데이터 : 이미 시도 무엇

df <- data.frame(Latitude = c(32.897, 32.897, 32.897, 32.811, 32.811, 32.811), 
       Longitude = c(-97.04, -97.04, -97.04, -97.12, -97.12, -97.12), 
       Azimuth = c(0, 120, 240, 60, 200, 240), 
       Site = c("A", "A", "A", "B", "B", "B"), 
       Sector = c(1,2,3,1,2,3), 
       stringsAsFactors = F) 
+0

? 이 질문은 일반적으로 광범위하고 StackOverflow의 많은 기존 게시물에서 답변되었습니다. https://stackoverflow.com/questions/29736577/how-to-convert-data-frame-to-spatial-coordinates –

답변

0
#Convert df into a spatial object: 
library(sp) 
coordinates(df)<-~Longitude+Latitude 

#Simple plot: 
plot(df, col="Blue") 

#Plot with icons: 
plot(df, col="Blue", pch=24) 
plot(df, col="Blue", pch=25, add=TRUE) 

#Plot on a map: (You need the associated projection) 
proj4string(df) = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0") 

library(mapview) 
mapview(df) 
관련 문제