File: fib.R

package info (click to toggle)
r-cran-sp 1%3A2.2-0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,856 kB
  • sloc: ansic: 1,091; sh: 14; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
xy = expand.grid(x = seq(5,355,by=10),y=seq(-85,85,by=10))
xyp = SpatialPoints(xy, CRS("+proj=longlat"))
gridded(xyp)=T
gridparameters(xyp)
xyf = spsample(xyp, 1000, type="Fibonacci")
plot(xyf, axes=TRUE)
if (require(rgdal)) {
	xy = expand.grid(x = seq(-85,85,by=10),y=seq(-85,85,by=10))
	xyp = SpatialPoints(xy, CRS("+proj=longlat"))
	gridded(xyp) = TRUE
	tocrs = CRS("+proj=ortho +lat_0=0 +lon_0=0 +x0=0 +y0=0")
	plot(spTransform(xyp, tocrs), pch=16,cex=.7)
	xyf = spsample(xyp, 1000, type="Fibonacci")
	plot(spTransform(xyf, tocrs), pch=16,cex=.7)
	dim(coordinates(xyf))
}