Project

General

Profile

Download (900 Bytes) Statistics
| Branch: | Revision:
1 4ef959c2 Adam M. Wilson
### script to return bounding box for a list of tiles
2
3
## import commandline arguments
4
library(getopt)
5
## get options
6
opta <- getopt(matrix(c(
7
                        'tile', 't', 1, 'character'
8
                        ), ncol=4, byrow=TRUE))
9
if(is.null(opta$tile)) stop("Please provide a list of tiles.  For example, -t \"h11v08,h12v09\"")
10
11
tiles=sub(" ","",tolower(do.call(c,strsplit(opta$tile,split=","))))
12
13
### get tile boundaries
14
tb=read.table("http://landweb.nascom.nasa.gov/developers/sn_tiles/sn_bound_10deg.txt",skip=6,nrows=648,header=T)
15
tb$tile=paste("h",sprintf("%02d",tb$ih),"v",sprintf("%02d",tb$iv),sep="")
16
17
18
## get minmax for all tiles
19
tb2=tb[tb$tile%in%tiles,]
20
21
print(tb2)
22
23
## print summary
24
print(paste("Getting bounding box for tiles: ",paste(tb2$tile,collapse=", ")))
25
print(paste("lon[",min(tb2$lon_min),",",max(tb2$lon_max),"]  lat[",min(tb2$lat_min),",",max(tb2$lat_max),"]"))
26