Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking to download the bathymetry of the Northwest Atlantic ocean as a txt file or any other file format that I can easily upload and use in R.

I once used the Global topography - Scripps Institution of Oceanography but it looks like I'm running into an error message this time...?

I have been looking at other websites, but I'm having a hard time to locate a new site where I could download a xyz file of my area of interest.

I would appreciate any recommendations. Thank you very much in advance,

share|improve this question
    
What exactly is the error message? (A quick check shows that page is returning a fixed-field ASCII file, which is straightforward to read in R.) –  whuber Apr 23 '12 at 20:05

1 Answer 1

up vote 5 down vote accepted

Upon requesting "topography" for longitudes between -30 and -24 degrees and latitudes between 54 and 60 degrees, I noticed the file contained three columns, for longitude, latitude, and elevation, apparently in an XYZ ASCII output arrangement (totaling 239,704 lines). After the page was saved in ASCII text format, it could be read and processed in R:

x <- read.table("f:/temp/bathy.txt", header=FALSE)   # Read the data into an array
names(x) <- c("lon", "lat", "z")                     # Provide meaningful column names
nrows <- length(levels(as.factor(x$lon)))            # Count distinct longitudes
library(raster)                                      # Load the 'raster' library
z <- raster(matrix(x$z, nrow=nrows), xmn=min(x$lon), 
    xmx=max(x$lon), ymn=min(x$lat), ymx=max(x$lat))  # Create a raster from the array
plot(z)                                              # Plot it

Bathymetry

That's the Reykjanes Ridge in the upper left and part of the Eriador Seamount near the lower right, where they should be.

share|improve this answer
    
Thank you @whuber. Not quiet sure what was the bug this morning but I managed to download the file without any problem! Thanks for sharing your raster code, I've never used it until now. It's great! P.S Have you used the new geom_raster in ggplot2? –  GodinA Apr 23 '12 at 23:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.