Displaying 9 results from an estimated 9 matches for "lon2".
Did you mean:
lon
2018 May 20
1
How to average values from grid cells with coordinates
...xlim=c(97.5,108.5),ylim=c(27.5,38.5),
xlab="Longitude",ylab="Latitude")
abline(h=27.5)
abline(h=lat+0.5)
abline(v=97.5)
abline(v=lon+0.5)
text(blackcells$lon,blackcells$lat,pop)
# the red cells will be centered on the corners of 4 black cells
lat2<-rep(seq(28.5,34.5,by=2),4)
lon2<-rep(seq(99.5,105.5,by=2),each=4)
redcells<-data.frame(lat=lat2,lon=lon2,value=NA)
display the red cells
rect(lon2-1,lat2-1,lon2+1,lat2+1,border="red",lwd=2)
nblackcells<-dim(blackcells)[1]
nredcells<-dim(redcells)[1]
for(redcell in 1:nredcells) {
close4<-rep(NA,4)
closen...
2018 May 22
0
How to average values from grid cells with coordinates
...lab="Longitude",ylab="Latitude")
> abline(h=27.5)
> abline(h=lat+0.5)
> abline(v=97.5)
> abline(v=lon+0.5)
> text(blackcells$lon,blackcells$lat,pop)
> # the red cells will be centered on the corners of 4 black cells
> lat2<-rep(seq(28.5,34.5,by=2),4)
> lon2<-rep(seq(99.5,105.5,by=2),each=4)
> redcells<-data.frame(lat=lat2,lon=lon2,value=NA)
> display the red cells
> rect(lon2-1,lat2-1,lon2+1,lat2+1,border="red",lwd=2)
> nblackcells<-dim(blackcells)[1]
> nredcells<-dim(redcells)[1]
> for(redcell in 1:nredcells) {...
2011 Jan 20
1
Generating time progressing line for Google Earth
...unction (degree) {
radian = degree * (pi/180.0)
return(radian)
}
#radians to degrees
Degrees <- function (radian) {
degree = radian * (180.0/pi)
return(degree)
}
# Calculates the distance between two points using the
# Spherical Law of Cosines
gcd.slc <- function(lon1, lat1, lon2, lat2) {
R = 6371.0 # Earth mean radius [km]
lon1 = Radians(lon1)
lat1 = Radians(lat1)
lon2 = Radians(lon2)
lat2 = Radians(lat2)
d = acos(sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2) *
cos(lon2-lon1)) * R
return(d) # Distance in km
}
########...
2010 Jul 23
1
Midpoint between coordinates
Dear R users,
I need to find the coordinates for the point (midpoint) located half
way between two pairs of coordinates (lon1,lat1 and lon2,lat2)
assuming a straight line between them. What would be the best way? I
tried to find an answer in the help archives but without success. I
would greatly appreciate any help.
df<- data.frame(lon1=c(-4.568,-4.3980), lat1=c(59.235,56.369),
lon2=c(-5.123,-4.698), lat2=c(60.258,59.197) )
Thanki...
2010 Jan 05
3
R matching lat/lon pairs from two datasets?
...Example Datasets:
> data2
V1 V2 V3
1 -123.76 47.82 8
2 -123.75 47.82 11
> data[1:2]
V1 V2
1 47.82 -123.76
2 47.82 -123.75
3 47.82 -123.74
4 47.82 -123.73
#Subset of current R code :
lat <- data$V1
lon <- data$V2
yrs <- c(1,2,5,10,25,50,100,200,500,1000)
lon2 <- data2$V1
lat2 <- data2$V2
ppt2 <- data2$V3
for(i in 1:length(lat2)) {
loc <- match(lat2[i],lat)
loc2 <- match(lon2[i], lon)
print(loc); print(loc2)
#Need to test to make sure loc equals loc2
freq_ppt <-
c(data[i,4],data[i,6],data[i,8],...
2011 Apr 12
1
How to set the dimension of a matrix correctly?
...ct[pvalxx] <- 0 pptpred <- kc$predict }else{ pptpred <- 0*(1:pdim[1]) }}
newpptpred <- matrix(pptpred, nrow=62, ncol=165) # need to fit the lat/lon frame
plat <- seq(37.5,42,by=0.07273)plon <- seq(-105.5,-93.5,by=0.07273)
lat2 <- which((plat> 37)&(plat< 42))lon2 <- which((plon> -106)&(plon< -93))
newpptpred <- tpptpred[lat2,pon2]
nLevel <- 60
quartz()filled.contour(plon,plat,t(newpredppt),col=rainbow(nLevel),plot.axes={axis(1);axis(2)})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pre...
2007 Oct 30
2
calculate spatial distance
Hi,
I have a set of locations defined by longitude and latitude (in degrees),
and want to calculate the spatial (or geographic) distance among all
locations.
I did not find such a function in the spatial-related packages. (I *cannot*
use 'dist', as I have geographic, not cartesian coordinates).
thanks!
Robert
Robert Ptacnik
Norwegian Institute for Water Research (NIVA)
Gaustadall?en 21
2009 Jul 31
0
Trouble with R proxy
...rk. I have been
searching for the answer but my raw coding ability is not at the same level
as the solutions I am getting.
I have checked my environment and the proxy settings are in line with what I
expected:
> Sys.getenv("http_proxy")
http_proxy
"http://proxy-lon2.macbank"
> Sys.getenv("USERNAME")
USERNAME
"epieters"
I then use a quantmod function, getSymols("GOOG"). I am very close to
getting a result, because I am promted with a input box for a username and
password. Unfortunately I get the following error once I...
2009 Nov 15
1
R crashing
Hello,
This is what I am trying to do: I wrote a little function that takes
addresses (coordinates) as input, and returns the road distance between
every two points using Google Maps. Catch is, there are 2000 addresses, so I
have to get around 2x10^6 addresses. On my first go, this is what I did:
#########################################
getRoadDist = function(X,complete=F){ # X must be a