That's a handy little script to have, and learn from. Geonames.org also hosts web services for finding the elevation, nearby populated places, nearby Wikipedia entries, some reverse geocoding, and a few more. (http://www.geonames.org/export/web-services.html) Thanks for posting the script!
- John Barry Rowlingson wrote: > 2008/9/25 John Callahan <[EMAIL PROTECTED]>: > >> If there's not a function within R for this, maybe there's a way to use the >> web services from Geonames.org and parse the results. Maybe this could be >> done within R, or in a separate script called by R. I haven't used R enough >> to know if this is possible. >> >> http://ws.geonames.org/timezone?lat=47.01&lng=10.2&style=full >> > > Oh well, in that case it is trivial... > > getTZ <- function(lat,long){ > > url=paste("http://ws.geonames.org/timezone?lat=",lat,"&lng=",long,"&style=full",sep="") > u=url(url,open="r") > text=readLines(u) > tz = text[grep("timezoneId",text)] > tz = sub("<timezoneId>","",tz) > tz = sub("</timezoneId>","",tz) > return(tz) > } > > note how I avoid parsing XML.... > > Barry > [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo