For the demand of real-time on-line route planning, the principle is discussed here for math modeling and data compression of threats with nonformula geometry shape, such as terrain or weather. The data structure and storage method are analyzed for DEM(Digital Elevation Model) data decomposed by quadtree algorithm. Then the data compress algorithm by sparse quadtree is provided. And another data compress algorithm is also provided by multi-resolution sparse quadtree which is to divide the terrain data by different steps with the preplanned route as its center. The data updating process is described for the precision improvement of terrain data during real-time on-line application. The numerical simulation shows the comparison of different method, which proves the mentioned method's validation.