I have a large csv containing ~5 million rows containing Lat, Lon, and Depth bathymetry values. I want to generate a raster GRID (for use in Arc) from this, but the trouble is the lat/lons are irregularly spaced. I've figured out the basics for reading in the data, creating a spatial object, and writing a raster assuming the points are regular:
pts = read.csv("data.csv", header=T) coordinates(pts) = ~Lon+Lat proj4string(pts) = CRS("+init=epsg:4326") gridded(pts) = TRUE #### FAILS ras = raster(pts) writeRaster(ras, "output.grd", "raster)
Currently it crashes on the gridded line with error:
suggested tolerance minimum: 0.0025975 Error in points2grid(points, tolerance, round) : dimension 1 : coordinate intervals are not constant
Is there some way to fit a regular grid over these points, and then sample averages from the points within each cell?
I'm still learning R.
I'm open to python scripting with tools from ArcToolbox as well. Although I was under the impression that R would be faster. I have access to 3D Analyst, Geostatistical Analyst, Network Analyst, Spatial Analyst, and Tracking Analyst.