# Patent

## Title
Generalization of features in a digital map using round number coordinates

## Abstract

A system and processes for generalizing a collection of objects using points not necessarily part of the original objects are provided. Generalization of features in a digital map includes moving points to round number coordinates, while keeping topology correct and not moving points outside an allowed distance range, thus substantially reducing the size of the data so generalized. However, doing so requires moving points from the original polyline to new points. Generalization of polylines to points preferentially chosen from a relatively sparse set is described.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims the benefit of U.S. Provisional Application 60/954,094, filed on Aug. 6, 2007, and incorporated by reference herein in its entirety.
This application is related to U.S. patent application Ser. No. 11/460,226, filed on Jul. 26, 2006, incorporated by reference herein in its entirety.


BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention is related to generalization in digital maps.
2. Description of the Related Art
Generalization in Maps
When a paper map is produced, shapes of objects represented in the map are rarely the same as they are in reality. For maps at anything other than the largest (most zoomed-in) scale, it is physically impossible to represent complex shapes like mountain roads exactly, because the width of the line describing the object is much too great to allow the true shape of the object to be illustrated. Cities, parks, and other areas may also have boundaries with complex shapes. Even when the line on a map is not too wide to allow a true representation of a shape, cartographers often smooth out a complex shape to make it more pleasing to a viewer's eye.
The simplification of objects represented on a map is called generalization. Generalization includes many kinds of operations: Complicated lines and boundaries may be smoothed out; narrow areas such as rivers may be represented as single lines; small areas such as small parks may be represented as single points; divided roads may be represented by single lines; highway interchanges may be represented by icons, often small white squares, instead of having their constituent roadways depicted; objects near roads may be displaced slightly from their true positions to improve visibility. All of these operations are forms of generalization. Our primary focus, however, is the first of these, namely, the simplification of lines. These lines can represent objects drawn one-dimensionally, such as roads, or the boundaries of two-dimensional objects, such as cities and parks.
Simplification as a Form of Generalization
In digital maps, one- and two-dimensional objects are typically represented as polylines or polygons. A polyline is a connected sequence of straight line segments. A polygon is a polyline that starts and ends at the same point. That is, if an object is actually curved in the real world, it is approximated by a sequence of points, called shape points, and the straight line segments connecting them. In the internal representation of the map, a one-dimensional object, or the one-dimensional boundary of a two-dimensional object, is typically represented by a list of its shape points. Because a polygon is merely a special case of a polyline, we frame the remaining discussion in terms of polylines for both increased readability and generality.
Often, in the use of digital map data the producer or user of the data finds that the data is much more precise, and the number of shape points is much greater, than is needed for the intended use. For example, this can happen when data originally collected for use at large (zoomed-in) scales is to be used instead at small (zoomed-out) scales. For example, digital road map data may be collected with enough shape points to guarantee that the polyline representing the road is never more than 20 meters from the actual road. When map data is to be used to draw a map of the entire United States on a computer screen, it typically suffices to make sure that the polyline is never more than, for example, five kilometers from the actual road. If the map is drawn using the more precise data, there are many times more points than necessary. This makes the data file much larger than necessary, and makes the processing time much longer than necessary as well.
Faced with this situation, the maker or user of digital map data often wants to generalize the polylines in a map so that they are not much more precise than the intended use requires. There are many possible ways to do this. In one method, each polyline is replaced by an entirely new polyline having new shape points, created in such a way that it does not deviate by more than a specified distance from the original polyline. In another method, each polyline is replaced by a new polyline with shape points selected from those of the original polyline in such a way that the new polyline does not deviate by more than a specified distance from the original polyline. That is, a subset of the shape points of the original polyline, in the order in which they occurred in the original polyline, is selected to be the shape points of the new polyline. This process is sometimes referred to as simplification of the original polyline. Because it has conventionally been thought advantageous for algorithmic reasons not to introduce new shape points, simplification is often a desirable method of generalizing polylines. However, simplification can be carried out in a variety of ways, and conventional methods have some significant drawbacks associated with them.
One of the most common methods of polyline simplification is the Douglas-Poiker algorithm (D. H. Douglas and T. K. Peucker, Algorithms for The Reduction of The Number of Points Required to Represent a Digitized Line or its Caricature, 10 Canadian Cartographer 112-22, 1973). In this method, a maximum deviation distance dmax is specified—for example, 5 km. The first and last shape points of the polyline are marked as “to be kept”. The chord (direct line segment) from the first shape point P1 to the last shape point Pn of the original polyline is considered. The shape points of the original polyline are inspected to see whether any of them are more than the maximum distance dmax from the chord. If any are, then the shape point Pi farthest from the chord is marked as “to be kept”, and the same operation is applied to the partial polylines from the beginning P1 to the farthest point Pi and from the farthest point Pi to the end point Pn. This process of checking, marking, and subdividing is applied recursively until the original polyline has been broken up into pieces such that the chord from the beginning to the end of each piece is no farther than the maximum deviation distance dmax from any of the shape points in between.
Another common algorithm is due to Lang (T. Lang, Rules For Robot Draughtsmen, 42 Geographical Magazine 50-51, 1969). In this method, a maximum number of points nmax to step, and a maximum deviation distance dmax, are specified. The algorithm then starts at the first point P1, which it marks as “to be kept”. It then considers the chords from P1 to Pi, where various values for i are tried, starting with i=1+nmax, then with i=nmax, then with i=nmax−1, then with i=nmax−2, and so on, until a chord is found that stays within distance dmax of the original polyline. Suppose that the first such chord is from P1 to Pc. The algorithm marks point Pc as “to be kept”, and then repeats the step of checking chords, from Pc to Pi, starting with i=c+nmax, then with i=c+nmax−1, then with i=c+nmax−2, and so on, until a chord is found that stays within distance dmax of the original polyline. The end point of the first such chord is marked as “to be kept”. This process is then repeated until the last shape point of the polyline is marked as “to be kept”.
There are other such common polyline simplification algorithms in use. The most commonly used algorithms, including those just discussed, share the property that the determination as to whether points are kept is based on properties of the intervening chords. However, since those chords are not considered in relation to other nearby chords, this can cause several problems when the resulting simplified polylines are used.
For example, without constraints on the angles formed by the resulting chords, the angles in the simplified polylines can be much sharper than in the original polyline. When the polylines are used for a purpose in which angles have significance, such as some driving-time estimating methods, the result can be significantly different from the original polyline, reducing the utility of the simplified polyline.
A more serious problem is that because the relationship of two chords that meet at a kept point is not constrained, the angle formed at the point can be reversed. For example, FIG. 1 illustrates a case in which an original polyline 102, which includes the shape points P1, P2, P3, P4, P5, P6, P7, P8, makes a sharp turn to the right at point P7, but the generalized polyline 104, which comprises the shape points P1, P7, P8, makes a sharp turn to the left at the same point P7. If the polyline is used to describe a driving route, this can be unfortunate, causing a driver to go in the wrong direction. If it is used as the boundary of an area, such as a park or lake, the result is even worse—such a change in angle can make the boundary of the area no longer topologically correct, turning the area inside-out, and making it impossible to draw the area correctly using the new polyline.
One advantage of generalization is that the smaller number of shape points makes the processing of the data faster at little or no cost to the accuracy of the data. Another advantage is that the smaller number of shape points makes the data file smaller, again at little or not cost to the accuracy of the data.
Some methods of representing data can use fewer bits for “rounder” coordinates. For example, in some methods of representing data, data is digitized to an accuracy of 2−28 revolution (about 1.34×10−6 degrees, which provides an accuracy of about 15 cm). Latitudes and longitudes measured to that accuracy can easily be represented in 27 and 28 bits, respectively. However, in some schemes of representing such data, a block of data all of which has n trailing zero bits can be represented with n fewer bits each. Thus, for example, if all the coordinates in a block of data all end with four zero bits when represented in units of 2−28 revolution, then latitudes and longitudes in that block of data can be represented using 23 and 24 bits respectively.
SUMMARY OF THE INVENTION
The present invention enables generalization of features in a digital map by performing a simplification of polylines. A set of chords between points on the original polyline is selected such that each chord does not violate rules such as maximum distance from the original polyline, maximum distance between points, and the like. If a chord between two points on the polyline is considered acceptable, then a node representing the chord is created, described by the start and end points of the chord. Next, for pairs of nodes created, a transition from the first node in the pair to the second node in the pair is evaluated to determine whether it is acceptable. In one embodiment, a transition is acceptable if the absolute value of the angle formed by the chords is within a threshold angle from the angle formed by the original polyline at that point. If the transition is acceptable, a link between the two nodes is established. After each pair of nodes is considered, a set of paths through a directed graph can be evaluated for cost. The cost of a path includes the sum of costs assigned to each node and link in the path. A least-cost path through the graph is chosen, and a simplified polyline is then generated according to the selected path.
A generalization method that can move points to round number coordinates, while keeping topology correct and not moving points outside an allowed distance range can substantially reduce the size of the generalized data. However, doing so requires moving points from the original polyline to new points. The present invention enables generalization of polylines to points preferentially chosen from a relatively sparse set.
The present invention provides a process for generalizing a collection of objects using points not necessarily part of the original objects.
A system in accordance with an embodiment of the present invention operates on a collection of polylines. A polyline is an ordered list of points, called shape points, connected in sequence by straight line segments. The first and last points are called terminal shape points, and the points between the terminal shape points are called intermediate shape points. In one embodiment, multiple polylines are prevented from sharing shape points with other polylines or with themselves, with the exception of the terminal shape points. That is, an intermediate shape point can be part of only one polyline, and can occur only once in that polyline.
The present invention enables generalization of a collection of polylines, as well as individual polylines.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is an illustration of a misleading simplified polyline generated according to a conventional method.
FIG. 2 is a block diagram illustrating a system for generalizing features in a digital map in accordance with an embodiment of the present invention.
FIG. 3 is a flowchart illustrating a method for simplifying a digital map in accordance with an embodiment of the present invention.
FIG. 4 is a flowchart illustrating the construction of nodes in accordance with an embodiment of the present invention.
FIG. 5 is a flowchart illustrating the construction of links in accordance with an embodiment of the present invention.
FIG. 6 is a flowchart illustrating the selection of a least-cost path in accordance with an embodiment of the present invention.
FIG. 7 is a diagram illustrating a polyline to be simplified in accordance with an embodiment of the present invention.
FIG. 8 is a diagram illustrating selection of candidate points not part of an original polyline in accordance with an embodiment of the present invention.
FIG. 9 is a diagram further illustrating selection of a candidate point where the nearest intersection is a shape point of the original polyline in accordance with an embodiment of the present invention.
FIG. 10 is a diagram illustrating a selection of a candidate point where the nearest intersection is a shape point not collinear with neighboring shape points, in accordance with an embodiment of the present invention.
FIG. 11 is a diagram illustrating a selection of a candidate point where the nearest point in the original polyline is a terminal shape point, in accordance with an embodiment of the present invention.



The figures depict embodiments of the present invention for purposes of illustration only. One skilled in the art will readily recognize from the following discussion that alternative embodiments of the structures and methods illustrated herein may be employed without departing from the principles of the invention described herein.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
FIG. 2 illustrates a block diagram of a system 200 for generalizing features in a digital map in accordance with an embodiment of the present invention. System 200 includes a node creation module 202, for creating a set of nodes; a link creation module 204 for creating a set of links; a cost assignment module 206 for assigning costs to the links and nodes created by link creation module 204 and node creation module 202, respectively; and a path creation module 208 for creating a least-cost path through a graph created as described with respect to FIG. 3. System 200 in one embodiment also includes a candidate selection module 210 for selecting shape point candidates as described below.
As noted above, in order to create a map with generalized features in accordance with the present invention, a graph is created. FIG. 3 illustrates the construction of such a graph in one embodiment. A graph is constructed by creating 302 a set of nodes, as described further below with respect to FIG. 4. Links are created 304 between the nodes, as described further below with respect to FIG. 5. Finally, as described further below with reference to FIG. 6, costs are assigned 306 to the links and the nodes in the graph, a least-cost path through the graph is chosen 308, and a simplified map is created 310.
FIG. 7 provides an illustration of a polyline 702 that is to be simplified in accordance with the present invention. For purposes of example, assume that a tolerance 704 of length dmax is provided as a requirement by the implementer. Then any chord in the simplification of polyline 702 must be with distance dmax of the original polyline 702. This can be illustrated by drawing a “bubble” 706 around original polyline 702 enclosing those points within a distance of dmax from the original polyline 702, and noting that any chord in the simplification of the original polyline 702 that travels outside of the bubble 706 has exceeded the tolerance distance from the original polyline.
A potential chord 708 from point 0 to point 4 is therefore unacceptable, since it is partially outside of the tolerance bubble 706 near points 1 and 2. In contrast, chord 710 is within the specified tolerance, and is therefore a potential candidate for the simplified polyline.
Suppose that the n points in the original polyline 702 are, in order, P1, P2, . . . , Pn. System 200 constructs a directed graph based on the original polyline 702. In this context, a graph is a collection of nodes, some pairs of which are connected by links. As is known by those of skill in the art, the nodes in a graph are mathematical abstractions, and in illustrative drawings are typically represented by points. The nodes need not be points in two- or three-dimensional space. The links are connections between nodes. In a directed graph, the links have directions—for example, there may be a link from node A to node B, but no link from node B to node A. In illustrative drawings, the links are typically represented by straight or curved arrows. However, the links are mathematical abstractions and the paths or crossings of such arrows have no significance.
FIG. 4 illustrates the selection of nodes by node creation module 202 for the directed graph in one embodiment. The nodes of the directed graph represent potential chords in a simplification of the polyline 702. First, a pair of points Pi and Pj are selected 402, where i<j, and a determination is made as to whether 404 the chord from Pi to Pj is acceptable. In one embodiment, node creation module 202 makes this determination by comparing the chord from Pi to Pj to the original polyline between Pi and Pj, and determining whether the chord remains within a previously specified distance dmax 704 of the polyline. Other criteria may also be applied. For example, in one embodiment a chord is considered unacceptable if the heading at each end of the chord deviates from the heading of the original polyline at that point by more than a specified maximum angle, other criteria notwithstanding. Alternatively, a chord from Pi to Pj may be considered unacceptable if the number of points between Pi and Pj in the original polyline is more than a maximum number, or if the length of the chord from Pi to Pj is greater than a maximum length, or if the distance from Pi to Pj along the original polyline is greater than a maximum distance, or if the ratio of the length of the polyline between Pi and Pj to the length of the chord from Pi to Pj exceeds a maximum value. Those of skill in the art will appreciate that there are many possible criteria that can be used to determine acceptability or unacceptability of a given chord. Note also that a segment of the original polyline 702, that is, a chord from one point in the original polyline to the next point in the original polyline is preferably itself acceptable. If the chord from Pi to Pj is acceptable 404, node creation module 202 creates 406 a node (Pi, Pj) to represent that chord. If 408 more points remain to be considered, the process is repeated. In addition, two special nodes (START, P1) and (Pn, END) are preferably created 410 at the first and last points of the original polyline, respectively. Thus, at the conclusion of the node creation process, node creation module 202 has created a set of nodes, each representing a valid chord.
Next, referring to FIG. 5, link creation module 204 creates links as follows in one embodiment. A pair of nodes (Pi, Pj) and (Pj, Pk) created by node creation module 202 as described above are selected 502, in which the second shape point of the first node is the same as the first shape point of the second node. The pair are then examined by link creation module 204 to determine 504 whether the transition from the first chord (from Pi to Pj) to the second chord (from Pj to Pk) is allowed. If the transition from the first chord to the second chord is allowed, then a link from the first node to the second node is constructed 506. In one embodiment, a rule for determining whether a transition is allowed is as follows: the angle formed by the original polyline at Pj is compared to the angle formed by the two chords at Pj. These angles are computed in a signed manner, so that, for example, a change in angle to the left at Pj is considered to be a positive angle, while a change in angle to the right is considered to be a negative angle. Then the transition from the first chord to the second chord is considered allowable if the absolute value of the difference between the signed angle in the original polyline and the signed angle between the chords does not exceed a predetermined threshold. A suitable limit on the absolute value of the difference, such as 180 degrees or any smaller limit will prevent the “turning inside out” of a boundary, a problem of some conventional methods as described above. Whatever the rule for determining allowable transitions, the transition between the chords representing two consecutive segments of the original polyline (Pi, Pi+1) and (Pi+1, Pi+2) is preferably allowed, and a link constructed between their nodes. If 508 additional nodes remain to be considered, the steps are repeated for the remainder. In addition to the links described above, in one embodiment a link is constructed 510 from a special node (START, P1) to every node (P1, Pi) representing a chord starting at the first shape point of the original polyline. Also, from every node (Pj, Pn) representing a chord ending at the last shape point of the original polyline a link is constructed to a special node (Pn, END).
Next, and referring to FIG. 6, cost assignment module 206 assigns 602 a cost to each link and each node. As will be understood by those of skill in the art, this cost is an abstract score, the total of which is typically sought to be minimized. In one embodiment, the cost of each node is one unit and the cost of each link is zero units, but other values may be used. The cost of a path is then a function of the costs of the nodes and links contained in the path; the function is in one embodiment a sum, although other functions could be chosen. From all possible paths through the directed graph, starting at the special node (START, P1), proceeding along links in the graph, and ending at the special node (Pn, END), cost assignment module 206 selects 604 a path with a minimal total cost. Given a directed graph with costs assigned to its nodes, there are many well-known methods for finding such a least-cost path. One such algorithm in the art is commonly known as Dijkstra's algorithm (E. W. Dijkstra, “A note on two problems in connexion with graphs,” 1 Numerische Mathematik 269-271, 1959). In some instances, there may be more than one path with the same minimal total cost; in such a case 606, any such path may be selected, though preferably a tie-breaking decision is made 608. The path will comprise a sequence of nodes with connecting links, where the second shape point of each node is the same as the first shape point of the next node: (START, P1), (P1, Pi), (Pi, Pj), . . . , (Pl, Pm), (Pm, Pn), (Pn, END). The sequence of chords represented by the nodes (other that the starting and ending special nodes) is then selected 610 as the simplified polyline.
As noted above, in some instances there may be more than one path through the directed graph with the same minimum cost. In order to choose a preferred path among all such paths, in one embodiment a second cost is defined for each node and each link in addition to the first cost described above. Then, among all the paths with a minimal total first cost, a path with a minimal total second cost is chosen. In one embodiment, the cost of each node (Pi, Pj) is the square of the number of original line segments spanned by the chord (j−i)2, and the cost of each link is zero. It can be seen that using this second cost will choose, among the simplifications with the same number of shape points, a simplification with chords that skip over numbers of shape points as nearly equal to each other as possible. In other embodiments, a third cost can be used to break ties in the first and second costs, a fourth cost can be used to break ties in the first, second, and third costs, and so on. A method of computing a route using first, second, and further costs is described in U.S. Pat. No. 5,893,081, which is incorporated by reference herein in its entirety.
Polylines representing one object on a map are preferably generalized such that they do not interfere with other objects on the map. For example, when the polylines representing two roadways of a divided road are generalized, it is desirable to prevent the two generalizations from crossing. Similarly, when a polyline representing a road near a lake is generalized, it is undesirable to generalize the polyline so that the road appears to go through the lake. As a third example, when a polyline representing a road that passes near a point of interest, such as a store, is generalized, it is undesirable to generalize the line so that the point of interest changes from one side of the road to the other. To prevent such problems, in one embodiment each chord is examined for acceptability not only as described above but in addition by comparing it to a collection of nearby “forbidden” map objects. A forbidden map object is one forbidden to intersect the generalized polyline, or to be on one side of the original polyline and on the other side of the generalized polyline. If the chord intersects any forbidden object, or if any forbidden object is on one side of a chord but on the other side of that part of the polyline between the endpoints of the chord, then the chord is considered unacceptable, and no node is created to represent it, notwithstanding its acceptability according to other criteria. For example, in one embodiment a check to see whether an object has switched sides can be carried out by determining whether the object is inside a polygon formed by the chord and the part of the original polyline spanned by the chord. If so, then the object has switched sides.
An embodiment of the invention has been described in which nodes correspond to single chords, and links represent acceptable chord-to-chord transitions. This allows a user of the system to specify what chords are acceptable (via the set of nodes) and what chord-to-chord transitions are acceptable (via the set of links), but not what chord-to-chord-to-chord transitions are acceptable. In other embodiments, nodes can represent sequences of two chords, or of three chords, and so on, and links can represent correspondingly longer acceptable transition sequences. For example, if each node represents an acceptable sequence of two chords (Pi, Pj, Pk), then a link is defined between two nodes (Pi, Pj, Pk) and (Pj, Pk, Pl) only when the last two points in the first node are the same as the first two points in the second node, and the chord-to-chord-to-chord transition from the chord (Pi, Pj) to the chord (Pj, Pk) to the chord (Pk, Pl) is acceptable according to a predetermined rule. By representing n shape points, and therefore (n−1) chords, in each node, the method can accept or reject sequences of up to n chords.
Those of skill in the art will appreciate that in its implementation, data structures representing the entire graph need not exist simultaneously. It is possible to embody the invention in such a way that, as links are considered in turn, certain links are rejected, and no representation of them is retained, before other links are considered and representations of them are created.
Generalization of Individual Polyline Objects
The polyline generalization algorithm described above simplifies the original polyline by selecting a subset of the original shape points on the polyline to form a simplified polyline. The algorithm is extendable by adding new candidate points in addition to those found on the original polyline. Candidate selection module 210 chooses candidates for shape points in the generalized polyline near the original feature of the polyline. In one embodiment, the candidate points chosen are points that have some advantage over the shape points in the original polyline. For example, in one embodiment it is desirable to generalize a polyline mostly using points that have round-number coordinates, and candidate selection module 210 favors points that are near the original polyline and that also have round-number coordinates. Alternatively, if a goal of the generalization is to use mostly points that have some other specified property, then candidate points can be chosen that have that property. Candidate selection module 210 identifies and sorts the list of candidate points. In one embodiment, original shape points are included in the list of candidate points.
In one embodiment, candidate points are assigned a not necessarily unique position number, which then allows sorting by ordering the candidate points according to their position numbers. In this embodiment, only those chords that connect candidate points in increasing order (or, alternatively, in non-decreasing order) of position number are allowed. In one embodiment, multiple candidate points may be assigned the same position number.
To order the candidate points, in one embodiment, each point is assigned a position number representing its position along original polyline 702. Each position number is determined by choosing an integer and then adding an offset, which is a positive or negative fraction between −1⁄4 (inclusive) and +3⁄4 (exclusive), or zero. The position number of an original shape point is the number of its place in original polyline 702. For example, referring to FIG. 8, the first four points of an original polyline 800 are given position numbers 1, 2, 3, and 4. The position number for a candidate point 802 that is not an original shape point of the polyline is determined as follows. First, the nearest point 808 on the original polyline 702 is found. This nearest point can be either an original shape point or a point somewhere in one of the segments connecting two original shape points.
In the case where the nearest point on the original polyline 808 is on a segment between two original shape points A 804 and B 806, where point A comes before point B in the original polyline 800, the position number of the candidate point is determined as follows. Define the nearest point on the original polyline to the candidate point 802 to be point C 808. The position number of the candidate point is that of point A 804, plus a fractional offset. The fractional value is one-fourth, plus one-half times the ratio of the length of the segment AC 810 to the length of the segment AB, i.e. 0.25+0.5×|AC|/|AB|. In the illustrated case of FIG. 8, point A 804 is at position 2, and point B 806 is at position 3. Accordingly, point C 808 will have a whole number of 2, and a fractional value that is one-fourth plus one-half of the ratio of the distance from position 2 to point C compared to the distance between position 2 and position 3. It can be seen that this position number will be between 2.25 and 2.75, inclusive.
In the case where the nearest intersection is a shape point P of the original polyline: The position number of the candidate is the position number of the shape point P, plus or minus a fractional offset that is determined as follows. Referring to FIG. 9, if the shape point P 902 is not a terminal shape point, it is between two other shape points A 904 and B 906. Let A denote the shape point earlier in the enumeration of points in the original polyline, and B denote the shape point later in that enumeration. If A, P, and B are collinear, the fractional offset is zero. Alternatively, and referring now to FIG. 10, if A, P, and B are not collinear, then the candidate point is outside the angle APB—otherwise P could not be the nearest point on the original polyline. Draw a line lA 1010 perpendicular to the line segment AP at P, in the direction away from the interior of angle APB. Draw another line lB 1012 perpendicular to the line segment PB at P, in the direction away from the interior of angle APB. The candidate point 1008 must be between lA and lB—otherwise P could not be the nearest point on the original polyline. Draw a third line lcand from the candidate point to P. Consider the ratio of the angle between lA and lcand to the angle between lA and lB. The fractional offset is one-half of that ratio minus one-quarter, that is, 0.5×(angle between lA and lcand)/(angle between lA and lB)−0.25. It will be seen that the fractional offset is −1⁄4 if the candidate point is on lA, +1⁄4 if the candidate point is on lB, and a proportionate value between −1⁄4 and +1⁄4 if the candidate point is between lA and lB.
Referring to FIG. 11, the fractional offset is determined in a mostly similar way if the nearest point 1104 in the original polyline 1102 is a terminal shape point, as follows: Let the next or previous shape point on the original polyline be A 1106. Draw a line lext 1108 extending the line segment PA in the direction away from A. Draw a second line lperp  1110 perpendicular to the line segment PA at P, and on both sides of the line segment PA. Draw a third line lcand  1112 from P to the candidate point 1114. Consider the ratio of the angle between lcand and lperp to the angle between lext and lperp. The fractional offset is one-quarter of that ratio, that is, 0.25×(angle between lcand and lperp)/(angle between lext and lperp), with a negative sign if P is the first point in the original polyline and with a positive sign if P is the last point in the original polyline. It will be seen that the fractional offset is ±1⁄4 if the candidate point is on lext, 0 if the candidate point is on lperp, and a proportionate value between ±1⁄4 and 0 if the candidate point is between lext and lperp.
With position numbers assigned to candidate points in this way, the position numbers for candidate points increase in order as the points move from near the first shape point to near the last shape point. Candidate points in one embodiment have position numbers as shown in the following table:











Candidate points for which the nearest
. . . have position


point on the original polyline is . . .
numbers . . .







the first shape point
between 0.75 and 1


between the first and second shape points
between 1.25 and 1.75


the second shape point
between 1.75 and 2.25


between second and third shape points
between 2.25 and 2.75


the third shape point
between 2.75 and 3.25


. . .
. . .


the jth shape point
between j − 0.25 and



j + 0.25


the between the jth and the (j + 1)st
between j + 0.25 and


shape points
j + 0.75


. . .
. . .


the last shape point, shape point number n
between n and n + 0.25









It should be noted that the foregoing assignment of candidate numbers is just one possibility. One of ordinary skill in the art will understand that many other possible assignments of candidate numbers can also be made. For example, in another embodiment all position numbers are twice the values defined here. In other embodiments, position numbers are just the latitude or longitude of the candidate point.
As in the method in which only original shape points are used as candidate points, it is sometimes desirable to impose constraints on the angles at which chords meet, based on the angles formed by the segments of the original polyline. In order to do this, it is necessary to define a meaning for the “original angles” at a candidate point that is not in fact an original shape point. In one embodiment, for each candidate point there is assigned a corresponding original shape point, and the original angles at that corresponding original shape point are used as the “original angles” at the original shape point. In one embodiment, the original shape point with a position number nearest to that of the candidate point is the corresponding original shape point. Ties, i.e., cases in which the position number of a candidate point is exactly halfway between the position numbers of two original shape points, can be broken in any manner that is convenient to implement, for example, always in favor of the higher-numbered original shape point, or always in favor of the lower-numbered original shape point, or simply at random.
In addition to sorting the candidate points by position number, costs are associated with each candidate point for use in determining the cost of chords going through it. Cost assignment module 206 in one embodiment assigns a high cost value to original shape points, while candidate points that are not original shape points are given a smaller cost value. The high cost causes path creation module 208 to tend to select new points rather than original points. However, the existence of the original points in the pool of allowable points guarantees that at least one generalization of the polyline is possible, namely, selection of all the original points.
Candidate selection module 210 chooses points in one embodiment centered around each shape point in the polyline 702, or alternatively along the segments of the polyline.
In one embodiment, candidate points are selected as points with round number coordinates, that is, coordinates having a representation in base 2 or base 10 that ends with a number of zeros specified by the caller, that is, by the person or program requesting the generalization. Candidate points include all points with round number coordinates that fall within a specified distance d of any original shape point. In another embodiment, candidate points include all points with round number coordinates that fall within a caller-specified bounding box centered on any original shape point. A bounding box centered on an original shape point includes the set of all points within a specified distance dx from the original shape point in the x direction (or, alternatively, in longitude) and within a specified distance dy from the original shape point in the y direction (or, alternatively, in latitude).
In another embodiment, candidate points include all points with round number coordinates within a specified distance d of any part of original polyline 702, not only in the vicinity of an original shape point. In this and the preceding paragraph, the distances d, dx, and dy are typically chosen to be approximately the maximum distance allowed between the original polyline and the generalized polyline.
Still other selection methods are possible, including those in which candidate selection module 210 selects candidate points at irregular intervals, for example, with each possible candidate point included with a probability p, where a greater probability can be chosen to allow more candidate points and therefore more possible chords and consequently a more suitable result, or a lesser probability can be chosen to allow fewer candidate points and therefore a faster computation. Fewer points than all those up to a specified distance may also be chosen. For example, in one embodiment candidate selection module 210 chooses the nearest n points with round-number coordinates to each original shape point, rather than all such points up to a given distance.
A certain number of the candidate points are identified as candidate terminal points, associated with one of the terminal points of the original polyline 702. In one embodiment, the set of candidate points that are within a specified distance d of an original terminal point are candidate terminal points associated with that original terminal point.
Once the additional candidate points have been identified by candidate selection module 210, path creation module 208 finds a route of least cost from a candidate terminal point associated with one original terminal point to a candidate terminal point associated with the other original terminal point.
Generalization of a Group of Polyline Objects
A map having a number of polyline objects can be generalized by generalizing each polyline object in turn as described above. It is usually desirable to generalize polylines that meet at their endpoints in such a way that the generalized polylines are still connected, and are connected in the same order as the original polylines. The shared terminal points at which polylines come together can be called junctions.
A process for generalizing groups of polylines works as follows. A first junction is chosen in some way, for example, at random, or by choosing the northernmost junction. The junction will have been associated with at least one candidate terminal point, as described above. One such candidate terminal point is selected. In one embodiment, a candidate point with round number coordinates nearest to the original junction is selected. The junction is then moved to the selected nearby candidate point. Each polyline connected to the junction is generalized as described above, with the terminal point at the junction constrained to be at the point selected for the junction; and each such polyline's generalization is saved as a candidate generalization. With the placement of a terminal point fixed at a particular candidate, it may be impossible to find a generalization, for example, if all candidate chords intersect another object in the map. If system 200 is able to generalize each object successfully, it retains the generalizations as the latest known generalizations. If any of the objects fail to generalize successfully, the candidates using the proposed terminal point are not retained. In that case, a second candidate terminal point is selected and the junction is then reprocessed as described above, attempting to generalize all polylines incident to the junction with their end points fixed at the new candidate terminal point. Candidates in one embodiment are picked in an order from most advantageous to least advantageous, with the original location of the junction as the last choice. At this point, if generalization still fails, the last known good generalizations are still valid. The last known generalization may be the original polyline.
When generalization fails with one candidate terminal point, the attempt with the next candidate terminal point need not happen immediately. In one embodiment, when generalization fails for a given candidate terminal point, successive candidate terminal points are tried in succession until generalization succeeds. In an alternative embodiment, when generalization fails for a given candidate terminal point, an attempt is made to move a different junction to a candidate terminal point, and the next attempt for the junction where generalization failed is made at some later time. Either approach is valid.
The present invention has been described in particular detail with respect to a limited number of embodiments. Those of skill in the art will appreciate that the invention may additionally be practiced in other embodiments. For example, the functionality of the graph-generating engine can be provided in other embodiments by other modules. The present invention also has application beyond the simplification of digital maps. For example, in various embodiments the present invention can be used to simplify polylines in any application in two- or higher-dimensional space, for example in rendering drawings with vectors.
Within this written description, the particular naming of the components, capitalization of terms, the attributes, data structures, or any other programming or structural aspect is not mandatory or significant, and the mechanisms that implement the invention or its features may have different names, formats, or protocols. Further, the system may be implemented via a combination of hardware and software, as described, or entirely in hardware elements. Also, the particular division of functionality between the various system components described herein is merely exemplary, and not mandatory; functions performed by a single system component may instead be performed by multiple components, and functions performed by multiple components may instead performed by a single component. For example, the particular functions of node creation module 202, link creation module 204 and so forth may be provided in many or one module.
Some portions of the above description present the feature of the present invention in terms of algorithms and symbolic representations of operations on information. These algorithmic descriptions and representations are the means used by those skilled in the art to most effectively convey the substance of their work to others skilled in the art. These operations, while described functionally or logically, are understood to be implemented by computer programs. Furthermore, it has also proven convenient at times, to refer to these arrangements of operations as modules or code devices, without loss of generality.
It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the present discussion, it is appreciated that throughout the description, discussions utilizing terms such as “selecting” or “computing” or “determining” or the like, refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system memories or registers or other such information storage, transmission or display devices.
Certain aspects of the present invention include process steps and instructions described herein in the form of an algorithm. It should be noted that the process steps and instructions of the present invention could be embodied in software, firmware or hardware, and when embodied in software, could be downloaded to reside on and be operated from different platforms used by real time network operating systems.
The present invention also relates to an apparatus for performing the operations herein. This apparatus may be specially constructed for the required purposes, or it may comprise a general-purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program may be stored in a computer readable storage medium, such as, but is not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, magnetic-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, application specific integrated circuits (ASICs), or any type of media suitable for storing electronic instructions, and each coupled to a computer system bus. Furthermore, the computers referred to in the specification may include a single processor or may be architectures employing multiple processor designs for increased computing capability.
The algorithms and displays presented herein are not inherently related to any particular computer or other apparatus. Various general-purpose systems may also be used with programs in accordance with the teachings herein, or it may prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will appear from the description above. In addition, the present invention is not described with reference to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any references to specific languages are provided for disclosure of enablement and best mode of the present invention.
Finally, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, the disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention.

## Claims

1. A method for generalizing a feature of a digital map, the feature including a polyline, the polyline including a plurality of original shape points, the method comprising:
identifying a plurality of candidate shape points, at least one of the plurality of candidate shape points not located on the polyline, and the plurality including at least one candidate terminal point associated with each terminal point of the polyline;
determining a position for each of the plurality of candidate shape points;
creating, by a computer, a set of nodes by, for each pair of candidate shape points:
determining, by the computer, whether a chord from the first shape point of the pair to the second shape point of the pair is acceptable;
responsive to the chord being acceptable, creating, by the computer, a node representing the chord;

creating, by the computer, a set of links by, for each pair of nodes in which the second candidate shape point in one node is the same point as the first candidate shape point in the other node:
identifying, by the computer, an original shape point on the polyline corresponding to the candidate shape point;
determining, by the computer, a first angle, the first angle formed by the polyline at the original shape point;
determining, by the computer, a second angle, the second angle formed by a transition from the chord represented by the first of the pair of nodes to the chord represented by the second of the pair of nodes;
comparing the first angle and the second angle to determine whether the transition having the second angle is acceptable;
responsive to the transition being acceptable, creating, by the computer, a link between the pair of nodes;

for each path from a node including a candidate first terminal point to a node including a candidate last terminal point, determining a cost of the path based on a cost associated with each node and a cost associated with each link; and
generating, by the computer, as a simplified polyline the polyline represented by the path having the least cost.

2. The method of claim 1 wherein each candidate point is located within a threshold distance of at least one of the original shape points.

3. The method of claim 1 wherein each candidate point falls within a bounding box centered on one of the original shape points.

4. The method of claim 3 wherein the bounding box is specified by a distance in an x direction and a distance in a y direction.

5. The method of claim 4 wherein the bounding box is specified by a distance in longitude and latitude.

6. The method of claim 1 wherein each candidate point is located within a threshold distance of the polyline.

7. The method of claim 1 wherein each candidate terminal point is located within a threshold distance of a terminal point of the polyline.

8. The method of claim 1 wherein the determined position for each of the plurality of candidate shape points includes a position number and an offset.

9. The method of claim 8 further comprising:
determining a point P on the polyline nearest to the candidate shape point;
responsive to the determined point P being an original shape point and located on the polyline between a second original shape point A and a third original shape point B:
determining that the position number of the candidate shape point is the position number of P;
given a line segment lA at P, perpendicular to AP in a direction away from the interior angle of APB, a line segment lB at P, perpendicular to PB, and a line segment lcand from P to the candidate point, determining a ratio of the angle between lA and lcand to the angle between lA and lB; and
determining the offset of the candidate shape point as a function of the determined ratio.

10. The method of claim 9 wherein the function is one half of the determined ratio minus one quarter.

11. The method of claim 1 wherein the candidate shape point and the identified original shape point on the polyline are the same point.

12. A computer program product for generalizing a feature of a digital map, the feature including a polyline, the polyline including a plurality of original shape points, the computer program product stored on a non-transitory computer readable medium and including instructions configured to cause a processor to carry out the steps of:
identifying a plurality of candidate shape points having round number coordinates, at least one of the plurality of candidate shape points not located on the polyline, and the plurality including at least one candidate terminal point associated with each terminal point of the polyline;
determining a position for each of the plurality of candidate shape points;
creating a set of nodes by, for each pair of candidate shape points:
determining whether a chord from the first shape point of the pair to the second shape point of the pair is acceptable;
responsive to the chord being acceptable, creating a node representing the chord;

creating a set of links by, for each pair of nodes in which the second candidate shape point in one node is the same point as the first candidate shape point in the other node:
identifying an original shape point on the polyline corresponding to the candidate shape point;
determining a first angle, the first angle formed by the polyline at the original shape point;
determining a second angle, the second angle formed by a transition from the chord represented by the first of the pair of nodes to the chord represented by the second of the pair of nodes;
comparing the first angle and the second angle to determine whether the transition having the second angle is acceptable;
responsive to the transition being acceptable, creating a link between the pair of nodes;

for each path from a node including a candidate first terminal point to a node including a candidate last terminal point, determining a cost of the path based on a cost associated with each node and a cost associated with each link; and
generating as a simplified polyline the polyline represented by the path having the least cost.

13. The computer program product of claim 12 wherein a chord from a first point of a pair of nodes to a second point of the pair of nodes is acceptable if a maximum distance between the polyline and the chord is less than a threshold amount.