The rapid development of remote sensing technology provides people with a lot of information about the Earth's space, however, making map cache is a very time consuming work, according to the traditional method of cutting and caching, the image data cannot be used in time, that is, the timeliness is poor; the slicing process is frequent, difficult to manage and requires strong hardware support. , the large amount of slicing data is prone to problems such as disk fragmentation, so how to solve the problem of tile fragmentation is the key to solve the rapid transmission of remote sensing images.
Imagine such a scenario: if the space adjacent tiles on disk storage is also relevant, so not only can solve the problem of disk fragmentation, but also reduce the seek for the disk, optimize the transmission of remote sensing images. It is well known that the Hilbert curve is the best spatial filling curve of spatial autocorrelation at present, if the remote sensing tile is indexed by this curve as index, the re-organization of remote sensing tile is realized.
German mathematician David Hilbert discovered a curve, first dividing a square into four small squares, starting from the center of the square in the southwest corner, heading north to the center of the northwest Square, then toward the center of the square in the east to the northeast corner, and then south to the southeast corner of the Square center, which is an iteration, If the above process is continued on the four small squares, down and repeated, the result is a curve that fills the entire square, which is the Hibert curve, as shown in the approximate process:
650) this.width=650; "Src=" http://img.blog.csdn.net/20150418220337551?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvemhhb3poaxblbmc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Center "style=" border:none; "/>
Hibert curve generation process
Implementation steps:
1. First, the remote sensing tiles are sliced;
2, using run-length coding to compress the tiles;
3, using Hilbert curve for tile re-coding;
3. The tiles are stored linearly according to the coding, and the coding position is recorded in the index file.
Partial implementation Code:
1, Hilbert code:
[CPP] view plaincopy
//rotate/flip a quadrant appropriately
voidRot (intN,int*x,int*y,intRx,intry) {
if (ry = = 0) {
if (Rx = = 1) {
*x = n-1-*x;
*y = n-1-*y;
}
//swap x and y
int t = *x;
*x = *y;
*y = t;
}
}
intxy2d (intN,intx,inty) {
int Rx, Ry, s, d = 0;
for (s = n/2; s>0; S/= 2) {
Rx = (x & S) > 0;
ry = (Y & s) > 0;
D + = S * S * ((3 * rx) ^ ry);
Rot (S, &x, &y, Rx, ry);
}
return D;
}
//convert D to (x, y)
voidD2xy (intN,intD,int*x,int*y) {
int Rx, Ry, s, t = D;
*x = *y = 0;
for (s = 1; s<n; s *= 2) {
Rx = 1 & (T/2);
ry = 1 & (t ^ rx);
Rot (s, x, Y, Rx, ry);
*x + = s * RX;
*y + = s * ry;
T/= 4;
}
}
Fast transmission algorithm of remote sensing image