Method and apparatus for geographic coordinate data storage5995970Abstract The storage space required for representing geographic features is reduced by determining an optimum number of bits that can be used to store coordinate data along each separate axis. Any coordinate change that cannot directly fit within the optimum bit size is subjected to an escape sequence made up of one or more special values and a normal value that fits in the optimum bit size. The special values are obtained by a predetermined calculation for each bit size. If all changes for one axis are in the same direction and special values are not needed, a global sign can be used to further enhance use of the available space on the storage medium. Claims Having thus described the invention, what is claimed is: Description FIELD OF THE INVENTION
TABLE 1
______________________________________
Special delta value
Additional delta length
Delta size in bits
(hexadecimal) implied by special value
______________________________________
2 0 .times. 00000002
1
3 0 .times. 00000004
3
4 0 .times. 00000008
7
5 0 .times. 00000010
15
6 0 .times. 00000020
31
7 0 .times. 00000040
63
8 0 .times. 00000080
127
9 0 .times. 00000100
255
10 0 .times. 00000200
511
11 0 .times. 00000400
1023
12 0 .times. 00000800
2047
13 0 .times. 00001000
4095
14 0 .times. 00002000
8191
15 0 .times. 00004000
16383
16 0 .times. 00008000
32767
17 0 .times. 00010000
65535
18 0 .times. 00020000
131071
19 0 .times. 00040000
262143
20 0 .times. 00080000
524287
21 0 .times. 00100000
1048575
22 0 .times. 00200000
2097151
23 0 .times. 00400000
4194303
24 0 .times. 00800000
8388607
25 0 .times. 01000000
16777215
26 0 .times. 02000000
33554431
27 0 .times. 04000000
67108863
28 0 .times. 08000000
134217727
29 0 .times. 10000000
268435455
30 0 .times. 20000000
536870911
31 0 .times. 40000000
1073741823
32 0 .times. 80000000
2147483647
______________________________________
By way of example, if the delta size that is being used is 7 and there are two special values indicated followed by a normal delta value of -15, the actual delta value is -141. The two special values amount to a length increase of 126, and they are by definition the same sign as the normal delta value. In carrying out the invention, binary numbers are assigned base ten numbers in accordance with the following Table 2.
TABLE 2
______________________________________
BINARY NO. BASE 10 NO.
______________________________________
10 SPECIAL VALUE
11 -1
00 0
01 1
100 SPECIAL VALUE
101 -3
110 -2
111 -1
000 0
001 1
010 2
011 3
______________________________________
Delta sizes of four bits and more are treated similarly with the special value for each delta size being the binary number 1 followed by a number of zeros equal to the delta size minus one. The positive and negative signs are likewise handled in a similar manner in larger delta sizes. With reference now to the flow chart in detail and initially to FIG. 1A, the x-y coordinate pairs are listed in the input buffer as indicated by numeral 10. Next, the second coordinate pair is selected as the current coordinate pair as indicated in block 12. The x delta (change in the x coordinate) is set equal to the current x coordinate value minus the previous x coordinate value, as indicated in block 14. In order to determine whether all of the x deltas are in either the plus or minus direction, the step indicated in block 16 is carried out. If the x delta is less than zero, the operation in block 18 is effected and the minus x delta counter is incremented by one. Otherwise, the operation in block 20 determines whether the x delta is greater than zero. If it is, block 22 is entered and the positive x delta counter is incremented by one. From either block 18 or block 22, block 24 is entered and the y delta is set equal to the current value of y minus the previous value of y. If the y delta value is less than zero as indicated in block 26, the negative y counter is incremented by one in block 28. Otherwise, a determination is made as to whether the y delta value is greater than zero as indicated in block 30. If the y delta value is greater than zero, the positive y counter is incremented in block 32. Next, the delta sizes are tested in succession for a determination of which delta size is the optimum size for each coordinate direction. The first delta size is selected in block 34 which is entered from either block 28 or block 32. The first delta size may be equal to two bits as shown in Table 1. As indicated in block 36, N is set equal to 2.sup..DELTA.size-1 -1. For example, with an initial delta size of 2, N=2-1=1. If the absolute value of x delta is evenly divisible by N and is not equal to zero, as determined by the operation in block 38, N is set in block 40 equal to the delta size times the absolute value of x delta divided by N. Otherwise, block 42 is entered and N is set equal to the delta size times the sum of 1 plus the absolute value of x delta divided by N. In the calculation made in block 42, the quantity determined as the absolute value of x delta divided by N is rounded to an integer value by discarding any fractional quantity. Referring now to FIG. 1B, block 44 is entered from either block 40 or block 42 to make a determination as to whether special x values are needed. If N is greater than the delta size, special values are needed and a flag "special x values needed" that is associated with the current delta size is set in block 46. Otherwise, block 48 is entered directly from block 44 and the x bit counter associated with the current delta size is incremented by a value equal to N. If special x values are needed, block 48 is entered from block 46 after the "special x values needed" flag has been set. The number of bits needed for the y delta value at the current delta size is determined in a similar manner. As indicated in block 50, N is set equal to 2.sup..DELTA.size-1 -1. If the absolute value of y delta is evenly divisible by n and is not equal to zero, as determined in block 52, N is set equal to the delta size times the absolute value of y delta divided by N in block 54. Otherwise, N is set equal to the delta size times the sum of 1 plus the absolute value of the y delta divided by N in block 56. In the calculation made in block 56, the quantity determined as the absolute value of y delta divided by N is rounded to an integer value by discarding any fractional quantity. If N is greater than the delta size as determined in block 58, special y values are needed and the "special y values needed" flag that is associated with the current delta size is set in block 60. The y bit counter for this delta size is incremented by N in block 62. At this point, the number of bits needed to represent the first x delta and the first y delta using the current delta size has been determined, and the x bit and y bit counters have been incremented by the applicable N values to keep track of the total number of x bits and y bits needed for that delta size. If there are more delta size values to be tested, as determined in block 64, the next delta size is selected in block 66, and block 36 is then entered to repeat the routine for determining bit numbers needed for the next delta size. When all of the delta sizes have been tested, block 68 is entered from block 64 to determine whether all of the coordinate pairs have been used. If they have not, the next coordinate pair is selected in block 70 and block 14 is entered to repeat the routine for determining the number of bits needed for the next coordinate pair for each of the delta sizes. Once all of the coordinate pairs have been tested at all of the delta sizes, the x bit counter contains information indicating the total number of bits used for all of the coordinate changes at each different delta size. Similarly, the y bit counter contains information indicating the total number of y bits needed at each different delta size. The present invention contemplates the use of a global sign if all of the x deltas or all of the y deltas are identical in sign (i.e., all changes are in the same direction along either coordinate axis) and there are no special values needed. Thus, as shown in FIG. 1C, block 72 is entered from block 68 once all the coordinate pairs have been tested at all delta sizes. If the positive x delta counter and the negative x delta counter are both at a non-zero value, block 74 is entered directly from block 72. However, if either the positive x delta counter or the negative x delta counter is at a value of zero, block 76 is entered to determine whether the "special x values needed" flag is clear for any given delta size. If not, block 74 is entered directly from block 76. If the "special x values needed" flag is clear for any particular delta size, the x bit count for that particular delta size is reduced by a number equal to the number of the coordinate pairs minus one, as indicated in block 78. The operation in block 78 takes place if either the positive or negative x delta counter is equal to zero (meaning all of the x deltas are in one direction) and there are no special x values needed for a given delta size. A global sign is then available for that delta size, and the x bit counter for that delta size can be reduced by reason of the availability of the global sign. The reduction in the bit count is equal to the number of coordinate pairs minus one because the number of deltas is equal to that number. As indicated in block 74, a determination is made as to whether both the plus y delta counter and the negative y delta counter are non-zero. If they are, block 80 is entered from block 74. If one of the y delta sign counters is at a zero value, all of the y delta changes have been in one direction and a check is made in block 82 as to whether the "special y values needed" flag is clear for any particular delta size. If it is, block 84 is entered and the y bit count for that given delta size is reduced by an amount equal to the number of coordinate pairs minus one. Again, the reason is that the global sign is available for y deltas at the given delta size or sizes where no special y values are needed. Block 80 is entered from block 84. The total x bit and y bit counts for each delta size are then checked in blocks 80 and 85, and optimum sizes are selected. The optimum x delta size is the delta size that has the least total x bit count. Similarly, the optimum y delta size is the delta size that has the fewest y bit counts. Before the x delta and y delta values are packed using the optimum delta sizes, a determination is made as to whether global signs can be used. As indicated in block 86, a check is made as to whether the positive x delta count state is equal to zero. If it is not, block 87 is entered to determine whether the negative x delta count is equal to zero. If the positive x delta count value is zero, block 88 is entered from block 86 to determine whether the "special x values needed" flag is clear for the optimum x delta size. If it is not, block 87 is entered from block 88. If it is determined in block 88 that the "special x values needed" flag is clear for the optimum x delta size, a global minus x sign is set in block 90 and the routine proceeds to block 92 (see FIG. 1D). Thus, only if the positive delta x counter equals zero and there are no special x values needed is the global minus x sign set. If it is determined in block 87 that the negative x delta count is not zero, block 92 is entered from block 87. However, if the negative x delta count is equal to zero, a check is made in block 94 as to whether the "special x values needed" flag is clear for the optimum x delta size. If it is not clear, block 92 is entered from block 94. If the "special values needed" flag is clear for the optimum x delta size, a global plus x sign is set in block 96 and the routine proceeds to block 92. Beginning at block 92 (FIG. 1D), similar determinations are made as to the availability of global y signs. If the positive y delta count is not equal to zero, block 98 is entered from block 92. If the value of the positive y delta count equals zero, a check is made in block 100 as to whether the "special y values needed" flag is clear for the optimum y delta size. If it is not clear, block 98 is entered from block 100. If it is clear, the global minus y sign is set as indicated in block 102. Block 104 is then entered from block 102. If the minus y delta count is not equal to zero, block 104 is entered from block 98. If the minus y delta count has a value of zero, a check is made in block 106 as to whether the "special y values needed" flag is clear for the optimum y delta size. If it is not, block 104 is entered from block 106. If the flag is clear, the global plus y sign is set in block 108, and block 104 is then entered. Actual packing of the data coordinates begins by placing the starting coordinates, the optimum delta sizes for the x and y axes and the global sign flags (if any) in the output buffer, as indicated in block 104. The second coordinate pair is selected as the current pair, as indicated in block 110. In blocks 112 and 114, the x and y deltas are set equal to the current values minus the previous values. If it is determined in block 116 that there is a global sign for the x delta, the number of bits, N, is set equal to the optimum x delta size minus one in block 118. The x delta value is then stored by placing it in the next available bit positions, occupying a number of bit positions equal to N, as indicated in block 120. In block 122, the output bit pointer is advanced by N to reflect the bit positions occupied by the x delta bits. If it is determined in block 116 that there is no global sign for the x delta, N is set equal to 2.sup.x.DELTA.size-1 -1 in block 124. If it is determined in block 126 that the absolute value of x delta is evenly divisible by N and is not equal to zero, the number of special values, N, is set equal to the absolute value of x delta divided by N minus one in block 128. Otherwise, N is set equal to the absolute value of x delta divided by N, as indicated in block 130. In the calculation made in block 130, the result of the division is rounded to an integer value by discarding any fractional quantity. The program proceeds to block 132 where N special values are placed in the output buffer. In block 134, the output pointer is advanced by a number equal to N times the x delta size to reflect the number of bits occupied by the special value numbers. The next operation involves storing the normal x delta value which is carried out in block 136. The normal delta value has the same sign as the x delta and a magnitude equal to the absolute value of x delta minus N times 2.sup.x.DELTA.size-1 1, and it occupies the next x delta size bit positions. The output pointer is thus advanced by x delta size bits in block 138. As shown in FIG. 1E, the presence or absence of a global sign for y delta is determined in block 140 which is entered from either block 122 or block 138. If there is a global sign for y delta, the number of y delta bits, N, is set in block 142 equal to the optimum delta size minus 1. The y delta value is then placed in the next N bit positions, as indicated in block 144. The output bit pointer is advanced in block 146 by N, as indicated in block 146. If there is no global sign available for y delta, block 148 is entered from block 140 and N is set equal to 2.sup.y.DELTA.size-1 -1. If it is determined in block 150 that the absolute value of y delta is evenly divisible by N and is not equal to zero, the number of special values, N, is set in block 152 equal to the absolute value of y delta divided by N minus one. Otherwise, N is set in block 154 as equal to the absolute value of y delta divided by N. In the calculation made in block 154, the result of the division is rounded to an integer value by discarding any fractional quantity. Block 156 is entered from block 152 or block 154, and N special values are placed in the output buffer. The y output pointer is advanced in block 158 by a number equal to N times the y delta size, the number of bits occupied by the special values. The normal y delta value is stored, as indicated in block 160, in the next y delta size bit positions. Its value has the same sign as the y delta and a magnitude equal to the absolute value of y delta minus N times 2.sup.y.DELTA.size-1 -1. The output pointer is then advanced by y delta size bits as indicated in block 162. Block 164 is entered from either block 146 or block 162 to determine whether there are more coordinate pairs that need to be packed. If there are not, the packing is completed, as indicated in block 166. If more coordinate pairs need to be packed, the next coordinate pair is selected in block 168, and block 112 is entered and the delta values for that pair of coordinates and succeeding pairs of coordinates are packed in the manner previously described. It is thus apparent that the present invention provides a method and apparatus for efficiently storing coordinate data relating to geographic features. In particular, the technique of developing an escape sequence that makes use of the special value concept is important in reducing the storage size occupied by the stored data. The optimum delta storage size is determined for each coordinate direction on a per feature basis instead of for the data base as a whole. Particularly in situations where there is a large ranging change in coordinate position in one coordinate direction and a relatively small changing coordinate position in the other direction, use of the storage scheme of the present invention results in significantly less waste in storage space compared to conventional storage systems. Likewise, if there are only a few large ranging coordinate changes with the remainder being relatively small, the large ranging changes do not unduly penalize the entire set of data with respect to the storage space it occupies. Additionally, by taking advantage of situations where all of the changes along a given coordinate axis have the same sign, the necessary storage space is further reduced by making use of the global sign concept contemplated by the present invention. From the foregoing it will be seen that this invention is one well adapted to attain all ends and objects hereinabove set forth together with the other advantages which are obvious and which are inherent to the structure. It will be understood that certain features and subcombinations are of utility and may be employed without reference to other features and subcombinations. This is contemplated by and is within the scope of the claims. Since many possible embodiments may be made of the invention without departing from the scope thereof, it is to be understood that all matter herein set forth or shown in the accompanying drawings is to be interpreted as illustrative, and not in a limiting sense.
|
Same subclass Same class Consider this |
||||||||||
