Hi,
I'm looking at using RandomAccessFile where I have a large (1.5GB) text file containing a regular grid of data. At the top of the file it tells you where the top left corner of the grid is (geographical X Y coordinates) and also the distance in metres between the regularly spaced data points (this is geographical data). There than follows a large grid of data values, a simple example looks something like this:
top_left_coord: 123, 543
spacing_dist_m: 50
-134.6 345.9 -12.78 1231.0 768.54
34.9 -12.05 66.72 236.57 366.0
-99.9 -264.08 -72.77 -547.5 8.9
-7.2 14.02 -22.0 -145.6 88.92
which represents a grid like:
. . . . .
. . . . .
. . . . .
. . . . .
The problem is I need to dip into this file and select a (probably square) portion of it from any location. The difficulty is knowing where to start reading using RAF. I don't know much about bytes etc as I am self-taught programmer working mainly on web stuff, but I'm guessing each number in the grid will be a different number of bytes long because of how they vary in the file and because the file's text.
Any ideas? Perhaps I need to convert these values to real numbers and create a binary version of the file...or perhaps I could index it in some way, but I don't know where to start and hoping you can give me some pointers please?!
I'm looking at using RandomAccessFile where I have a large (1.5GB) text file containing a regular grid of data. At the top of the file it tells you where the top left corner of the grid is (geographical X Y coordinates) and also the distance in metres between the regularly spaced data points (this is geographical data). There than follows a large grid of data values, a simple example looks something like this:
top_left_coord: 123, 543
spacing_dist_m: 50
-134.6 345.9 -12.78 1231.0 768.54
34.9 -12.05 66.72 236.57 366.0
-99.9 -264.08 -72.77 -547.5 8.9
-7.2 14.02 -22.0 -145.6 88.92
which represents a grid like:
. . . . .
. . . . .
. . . . .
. . . . .
The problem is I need to dip into this file and select a (probably square) portion of it from any location. The difficulty is knowing where to start reading using RAF. I don't know much about bytes etc as I am self-taught programmer working mainly on web stuff, but I'm guessing each number in the grid will be a different number of bytes long because of how they vary in the file and because the file's text.
Any ideas? Perhaps I need to convert these values to real numbers and create a binary version of the file...or perhaps I could index it in some way, but I don't know where to start and hoping you can give me some pointers please?!