Method for extracting osm map data for rapid construction of regional road network
By extracting Way-type data from OSM map data, setting the parsing precision, and generating network points and topology, the problems of data filtering and structure transformation when constructing highway networks from OSM map data are solved, achieving the effect of quickly constructing regional highway network maps.
Patent Information
- Application Number
- CN202211474248.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-11-22
AI Technical Summary
In existing technologies, when constructing highway networks using OSM map data, there is an excessive amount of unnecessary data, and the data structure is incompatible with my country's regional highway network, resulting in a large workload for data filtering and structure transformation, and there is a lack of effective solutions.
By downloading OSM map data for a specified area, extracting Way-type data, setting the resolution precision, extracting and storing road segment information, generating network point and topology data, calculating road segment lengths, and finally constructing a regional highway network.
It enables the rapid construction of computer-represented regional highway network maps based on accuracy requirements, saving time and workload for manual network drawing.
Smart Images

Figure CN115905440B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of road traffic network calculation, and more particularly to a method for extracting OSM map data to quickly construct a regional highway network. BACKGROUND
[0002] Highways are the infrastructure of a country's or region's economy and national defense construction. At present, highway transportation is still one of the main transportation modes in China and is a necessary way to realize resident travel and logistics transportation. The quantity and quality of highway network construction are closely related to the modern economic development of China, and the quality of highway network traffic construction is also a main indicator for evaluating the modern development of China. The prerequisite for regional highway network traffic organization planning is to quickly extract perfect and accurate road network related data and to establish a computer expressed road traffic network map.
[0003] OpenStreetMap (OSM) is an open source world map and online map collaboration project that can be freely used according to an open license agreement. The OSM official website provides a map data download interface for any rectangular range, and the osm format file obtained by downloading stores all spatial data and attribute data of a specified region, including highway network related data, urban bus / rail network related data, railway network related data, administrative division, and various POI / AOI. In the process of constructing a highway network by using OSM map data, there are a lot of unnecessary data, and if manually deleted, the workload is extremely large, and the data structure is not the same as that of the regional highway network in China. Therefore, accurate data screening and structure conversion are needed to form a computer expressed regional highway network map, and at present, there is no perfect solution to this problem. SUMMARY
[0004] In order to solve at least one of the above technical problems, according to an aspect of the present application, a method for extracting OSM map data to quickly construct a regional highway network is provided, comprising the following steps:
[0005] S1: downloading OSM map data in a specified regional range;
[0006] The OSM official website (https: / / www.openstreetmap.org) provides a map data download interface for any rectangular range, and after the required regional range is framed and "exported" is clicked, a map data file with the suffix.osm is downloaded;
[0007] OSM map data contains spatial and attribute data within the target area. Its spatial data structure consists of three element types: Node, Way, and Relation. Nodes define geographic coordinates using latitude and longitude, representing traffic network nodes, linear topological points, POIs, etc. Ways are directional sequences of nodes formed by Node data, representing transportation lines such as roads, buses, and railways, rivers, boundaries, etc. Relations are complex geographic entities composed of Node and Way data with certain relationships. Attribute data is stored in tags, existing in the form of key-value pairs (k:v), used to record data characteristic information.
[0008] S2: Extract and store all Way type data from the OSM map data in set W;
[0009] W = {w i |w i =(ID) i Tag i ,L i )}, i∈Z, 0<i≤I
[0010] Where wi is the i-th element in W, IDi is the unique identifier number of the road segment; Tagi is a tag dictionary containing key-value pairs (k:v) describing the data characteristics of wi, and an example of data storage is shown in Table 1; Li is a list of node numbers, storing the numbers of the Nodes that make up wi. I is the length of the set W;
[0011] S3: Set the resolution of the regional highway network; the correspondence between the resolution resolution and the OSM road segment data labels is as follows:
[0012] First-level precision: Tag[k] = 'highway', Tag[v] = {'motorway', 'trunk', 'motorway_link', 'trunk_link'};
[0013] Second-order precision: Tag[k] = 'highway', Tag[v] = {'primary', 'primary_link'};
[0014] Level 3 precision: Tag[k] = 'highway', Tag[v] = {'secondary', 'secondary_link'};
[0015] Level 4 precision: Tag[k] = 'highway', Tag[v] = {'tertiary', 'tertiary_link'};
[0016] Level 5 precision: Tag[k] = 'highway', Tag[v] = {'unclassified', 'track', 'residential'};
[0017] S4: Extract the road segments and their valid information data under the set parsing precision, and store them in the set Wdict;
[0018] Create a dictionary Wdict that stores the set of valid road segment information under the precision set in step S3. Its storage structure is as follows:
[0019] Wdict = {ID a ID a :[name a ,ref a ,class a ,lanes a oneway a ,nodes a :[nid a1 ,...,nid ab ]]}, a∈Z,0<a≤A,b∈Z,0<b≤B a
[0020] Wherein, IDa is the unique identifier of the highway segment at the parsing precision of the a-th rule, namea is the name of the segment, refa is the keyword of the segment, classa is the level of the segment, lanesa is the number of lanes of the segment, onewaya is the one-way attribute of the segment, nodesa is the set of points contained in the a-th segment, nidab is the unique identifier of the b-th point in the directed node sequence that constitutes the a-th segment, A is the total number of highway segments at the parsing precision, and Ba is the length of the directed node sequence that constitutes the a-th segment.
[0021] S41: Initialize i = 1;
[0022] S42: Read the Tagi dictionary key-value pairs (k:v) of wi in set W;
[0023] S43: Determine if there is a tag value in (k:v) that matches the precision set in step S3: If yes, continue reading other information contained in the Tagi dictionary key-value pair (k:v) of this road segment and proceed to step S44 to store valid information data; otherwise, let i = i + 1 and return to step S4.2.
[0024] S4: Store the extracted valid road segment information data in the dictionary Wdict, and let i = i+1. Return to S42 and continue reading the tag data contained in wi+1.
[0025] S5: Determine the total number of road segments connected to a point and store it in the network point set dictionary Ndict;
[0026] Create a road network point set dictionary Ndict with the following structure:
[0027] Ndict = {Nid c | Nid c : [t c1 , t c2 , t c3}, c ∈ Z, 0 < c ≤ C
[0028] where Nidc is the unique identification number of the c-th point in the road network, tc1 represents the total number of road segments connected to the c-th point, tc2 = 1 indicates that the c-th point is the starting or ending point of a certain / some road segments, tc3 = 1 indicates that the c-th point is the intermediate point of a certain / some road segments, C is the total number of points in the road network, and the initial value of [tc1, tc2, tc3] is [0, 0, 0]. The specific calculation process is as follows:
[0029] S51: Initialize j = 1, c = 1;
[0030] S52: Read the list of point numbers nodes in the dictionary Wdict j Stored point number nid j1 , …, nid jb , and let b = 1;
[0031] S53: Determine whether the point number nid j in nodes jb is equal to a certain point number Nidc in Ndict. If so, tc1 = tc1 + 1; otherwise, Nidc = nidjb, tc1 = 1, c = c + 1;
[0032] S54: Determine whether the nid jb number is the first or last element in the nodesj list. If so, tc2 = 1; otherwise, tc3 = 1;
[0033] S55: If b < Bj, then let b = b + 1 and return to step S53; otherwise, let j = j + 1 and return to step S52;
[0034] S6: Extract and store the latitude and longitude data of the points in the OSM map data and store them in the set N;
[0035] According to the point number Nidc in Ndict, extract the Node type data in the OSM map data and store the unique identification number and location information of the points in the set N;
[0036] N = {nd c | ndc =(Nid) c ,lat c ,lon c )},cZ,0<c≤C
[0037] Where ndc is the c-th element in N, idc is the unique identifier of the c-th point; latc is the latitude value of the c-th point; lonc is the longitude value of the c-th point; and C is the length of set N.
[0038] S7: Perform node attribute determination and generate the network node set CoorN;
[0039] Create a collection called CoorN to store network node data:
[0040] CoorN={coor d coor d =(id) d ,lat d ,lon d )},d∈Z,0<d≤D
[0041] Where coord is the d-th element in CoorN, idd is the unique identifier of the d-th node; latd and lond are the latitude and longitude values of node coord, respectively, and D is the length of the set CoorN;
[0042] S71: Initialize j = 1, d = 1;
[0043] S72: Read the list [tj1,tj2,tj3] from the set Ndict, and perform node judgment based on the result obtained in step S5;
[0044] S73: If tj1 = 1 and tj2 = 0, this point is not a node and no processing is performed; if tj1 = 1 and tj2 = 1, this point is a node, and it is saved as a coord element with d = d + 1; if tc1 > 1, this point is a node, and it is saved as a coord element with d = d + 1.
[0045] S74: Let j = j + 1, then return to step S72;
[0046] S8: Generate the final highway segment and topology network structure data;
[0047] S81: Stores the nodes and topology points of each highway segment;
[0048] S811: Initialize t=1, b=1, k=1, m=1;
[0049] S812: Read the node numbers nid contained in the list of nodes in the dictionary Wdict. tb, if nidtb is equal to a node number in the CoorN set, then store the point information of nidtb in the sets Wcoor and Wtopo simultaneously, and let k = k + 1, m = m + 1, b = b + 1; otherwise, only store the point information of nidtb in the set Wtopo, m = m + 1, b = b + 1;
[0050] Wcoor = {wcoor t |wcoor t = (id tk , lat tk , lon tk )}, tZ, 0 < t ≤ T, kZ, 0 < k ≤ 2
[0051] Wtopo = {wtopo tm |wtopo tm = (id tm , lat tm , lon tm )}, t ∈ Z, 0 < t ≤ T, m ∈ Z, 0 < m ≤ M
[0052] Among them, idtk is the unique identification number of the k-th node included in the t-th road segment, lattk and lontk are the latitude value and longitude value of the node respectively; idtm is the unique identification number of the m-th topological point included in the t-th road segment, lattm and lontm are the latitude value and longitude value of the topological point respectively, T is the total number of road segments in the road network, and M is the number of topological points included in the road segment t;
[0053] S813: When k = 2, the two nodes of the t-th road segment have been found; at this time, if b < Bt, then create a node set for the next road segment with nidt as the starting point, and return to step S812; if the nodet list has been read end, then t = t + 1 and return to step S812;
[0054] S82: Calculate the length of the road segment;
[0055] S821: Convert the point coordinates from the geodetic latitude and longitude coordinates to web mercator coordinates for convenient distance calculation later;
[0056] S822: Calculate the distance between the two points wtopotm and wtopotm + 1 as lengthtm;
[0057] S823: Calculate the total length of the road segment
[0058] S83: Store all the information of the road segment in the Geom set:
[0059] Geom = {wayh |way h =(nid hs ,nid he ,length h ,class h ,lanes h ,name h )}, h∈Z, 0<h≤H
[0060] Where wayh is the h-th element in Geom, nidhs and nidhe represent the start and end numbers of the h-th road segment respectively, lengthh represents the segment length, classh represents the segment class, lanesh represents the number of lanes, nameh represents the segment name, and H is the length of the set Geom.
[0061] S9: The data obtained from the above steps constitutes the data for constructing the target area's road network, thus completing a method for rapidly constructing a regional road network by extracting OSM map data.
[0062] According to another aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for rapidly constructing a regional road network by extracting OSM map data according to the present invention.
[0063] According to another aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method of extracting OSM map data for rapid construction of regional road networks according to the present invention.
[0064] Compared with the prior art, the present invention has at least the following beneficial effects:
[0065] This invention allows users to parse OSM map data according to the accuracy requirements for constructing a regional road network, and finally construct a computer-represented regional road network map, saving the time and workload of manually drawing the network. Attached Figure Description
[0066] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments will be briefly described below. Obviously, the drawings described below only relate to some embodiments of the present invention and are not intended to limit the present invention.
[0067] Figure 1 This is a schematic diagram of the method flow of the present invention;
[0068] Figure 2 This is a schematic diagram of an embodiment of the present invention in an OSM map;
[0069] Figure 3 This is a computer-generated abstract diagram illustrating the rapid construction of a regional highway network according to an embodiment of the present invention. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention.
[0071] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0072] like Figures 1-3 As shown,
[0073] Example 1:
[0074] In order to quickly extract complete and accurate road network-related data and build a computer-represented road traffic network map, this invention discloses a method for rapidly constructing a regional highway network by extracting OSM map data, thereby achieving rapid extraction of road network data.
[0075] This embodiment describes a method for rapidly constructing a regional highway network by extracting OSM map data, such as... Figure 1 As shown, it includes the following steps:
[0076] Includes the following steps:
[0077] S1: Download OSM map data for the specified area;
[0078] The official OSM website (https: / / www.openstreetmap.org) provides an interface for downloading map data of any rectangular area. Simply select the desired area, click "Export," and you will receive a map data file with the .osm extension.
[0079] OSM map data contains spatial and attribute data within the target area. Its spatial data structure consists of three element types: Node, Way, and Relation. Nodes define geographic coordinates using latitude and longitude, representing traffic network nodes, linear topological points, POIs, etc. Ways are directional sequences of nodes formed by Node data, representing transportation lines such as roads, buses, and railways, rivers, boundaries, etc. Relations are complex geographic entities composed of Node and Way data with certain relationships. Attribute data is stored in tags, existing in the form of key-value pairs (k:v), used to record data characteristic information.
[0080] S2: Extract and store all Way type data from the OSM map data in set W;
[0081] W = {w i |w i =(ID) i Tag i ,L i )}, i∈Z, 0<i≤I
[0082] Where wi is the i-th element in W, IDi is the unique identifier number of the road segment; Tagi is a tag dictionary containing key-value pairs (k:v) describing the data characteristics of wi, and an example of data storage is shown in Table 1; Li is a list of node numbers, storing the numbers of the Nodes that make up wi. I is the length of the set W;
[0083] S3: Set the resolution of the regional highway network; the correspondence between the resolution resolution and the OSM road segment data labels is as follows:
[0084] First-level precision: Tag[k] = 'highway', Tag[v] = {'motorway', 'trunk', 'motorway_link', 'trunk_link'};
[0085] Second-order precision: Tag[k] = 'highway', Tag[v] = {'primary', 'primary_link'};
[0086] Level 3 precision: Tag[k] = 'highway', Tag[v] = {'secondary', 'secondary_link'};
[0087] Level 4 precision: Tag[k] = 'highway', Tag[v] = {'tertiary', 'tertiary_link'};
[0088] Level 5 precision: Tag[k] = 'highway', Tag[v] = {'unclassified', 'track', 'residential'};
[0089] S4: Extract the road segments and their valid information data under the set parsing precision, and store them in the set Wdict;
[0090] Create a dictionary Wdict that stores the set of valid road segment information under the precision set in step S3. Its storage structure is as follows:
[0091] Wdict = {ID aID a :[name a ,ref a ,class a ,lanes a oneway a ,nodes a :[nid a1 ,...,nid ab ]]}, a∈Z,0<a≤A,b∈Z,0<b≤B a
[0092] Wherein, IDa is the unique identifier of the highway segment at the parsing precision of the a-th rule, namea is the name of the segment, refa is the keyword of the segment, classa is the level of the segment, lanesa is the number of lanes of the segment, onewaya is the one-way attribute of the segment, nodesa is the set of points contained in the a-th segment, nidab is the unique identifier of the b-th point in the directed node sequence that constitutes the a-th segment, A is the total number of highway segments at the parsing precision, and Ba is the length of the directed node sequence that constitutes the a-th segment.
[0093] S41: Initialize i = 1;
[0094] S42: Read the Tagi dictionary key-value pairs (k:v) of wi in set W;
[0095] S43: Determine if there is a tag value in (k:v) that matches the precision set in step S3: If yes, continue reading other information contained in the Tagi dictionary key-value pair (k:v) of this road segment and proceed to step S44 to store valid information data; otherwise, let i = i + 1 and return to step S4.2.
[0096] S4: Store the extracted valid road segment information data in the dictionary Wdict, and let i = i+1. Return to S42 and continue reading the tag data contained in wi+1.
[0097] S5: Determine the total number of road segments connected by the points and store them in the network point set dictionary Ndict;
[0098] Create a dictionary Ndict containing a set of road network points, with the following structure:
[0099] Ndict = {Nid c |Nid c :[t c1 ,t c2 ,t c3 ]}, c∈Z, 0<c≤C
[0100] Among them, Nidc is the unique identification number of the c-th point in the road network, tc1 represents the total number of road segments connected to the c-th point, tc2 = 1 indicates that the c-th point is the starting point or ending point of a certain / some road segments, tc3 = 1 indicates that the c-th point is the intermediate point of a certain / some road segments, C is the total number of points included in the road network, and the initial value of [tc1, tc2, tc3] is [0, 0, 0]. The specific calculation process is as follows:
[0101] S51: Initialize j = 1 and c = 1;
[0102] S52: Read the list of point numbers nodes in the dictionary Wdict j The stored point number nid j1 ,…,nid jb , and let b = 1;
[0103] S53: Determine whether the point number nid j in nodes jb is equal to a certain point number Nidc in Ndict. If so, tc1 = tc1 + 1; otherwise, Nidc = nidjb, tc1 = 1, and c = c + 1;
[0104] S54: Determine whether the nid jb number is the first or last element in the nodesj list. If so, tc2 = 1; otherwise, tc3 = 1;
[0105] S55: If b < Bj, then let b = b + 1 and return to step S53; otherwise, let j = j + 1 and return to step S52;
[0106] S6: Extract and store the latitude and longitude data of the points in the OSM map data, and store them in the set N;
[0107] According to the point number Nidc in Ndict, extract the Node type data in the OSM map data, and store the unique identification number and location information of the points in the set N;
[0108] N = {nd c |nd c =(Nid c ,lat c ,lon c ),c ∈ Z,0 < c ≤ C
[0109]
[0111] Create a collection called CoorN to store network node data:
[0112] CoorN={coor d coor d =(id) d ,lat d ,lon d )},d∈Z,0<d≤D
[0113] Where coord is the d-th element in CoorN, idd is the unique identifier of the d-th node; latd and lond are the latitude and longitude values of node coord, respectively, and D is the length of the set CoorN;
[0114] S71: Initialize j = 1, d = 1;
[0115] S72: Read the list [tj1,tj2,tj3] from the set Ndict, and perform node judgment based on the result obtained in step S5;
[0116] S73: If tj1 = 1 and tj2 = 0, this point is not a node and no processing is performed; if tj1 = 1 and tj2 = 1, this point is a node, and it is saved as a coord element with d = d + 1; if tc1 > 1, this point is a node, and it is saved as a coord element with d = d + 1.
[0117] S74: Let j = j + 1, then return to step S72;
[0118] S8: Generate the final highway segment and topology network structure data;
[0119] S81: Stores the nodes and topology points of each highway segment;
[0120] S811: Initialize t=1, b=1, k=1, m=1;
[0121] S812: Read the node numbers nid contained in the list of nodes in the dictionary Wdict. tb If nidtb is equal to a node number in the set CoorN, then store the point information of nidtb in both sets Wcoor and Wtopo, and let k = k + 1, m = m + 1, b = b + 1; otherwise, store the point information of nidtb in only the set Wtopo, with m = m + 1 and b = b + 1.
[0122] Wcoor = {wcoor} t |wcoor t =(id) tk ,lat tk ,lontk ), t ∈ Z, 0 < t ≤ T, k ∈ Z, 0 < k ≤ 2
[0123] Wtopo = {wtopo tm | wtopo tm = (id tm , lat tm , lon tm ), t ∈ Z, 0 < t ≤ T, m ∈ Z, 0 < m ≤ M
[0124] Where, idtk is the unique identification number of the k-th node included in the t-th road segment, lattk and lontk are the latitude value and longitude value of the node respectively; idtm is the unique identification number of the m-th topological point included in the t-th road segment, lattm and lontm are the latitude value and longitude value of the topological point respectively, T is the total number of road segments in the road network, and M is the number of topological points included in road segment t;
[0125] S813: When k = 2, the two nodes of the t-th road segment have been found; at this time, if b < Bt, then starting from nidt, create a node set for the next road segment and return to step S812; if the nodet list has been read end, then t = t + 1 and return to step S812;
[0126] S82: Calculate the length of the road segment;
[0127] S821: Convert the point coordinates from geodetic latitude and longitude coordinates to web Mercator coordinates for convenient distance calculation later;
[0128] S822: Calculate the distance between two points wtopotm and wtopotm + 1 as lengthtm;
[0129] S823: Calculate the total length of the road segment
[0130] S83: Store all information of the road segment in the Geom set:
[0131] Geom = {way h | way h = (nid hs , nid he , length h , class h , lanes h , name h ), h ∈ Z, 0 < h ≤ H
[0132] Where wayh is the h-th element in Geom, nidhs and nidhe represent the start and end numbers of the h-th road segment respectively, lengthh represents the segment length, classh represents the segment class, lanesh represents the number of lanes, nameh represents the segment name, and H is the length of the set Geom.
[0133] S9: The data obtained from the above steps constitutes the data for constructing the target area's road network, thus completing a method for rapidly constructing a regional road network by extracting OSM map data.
[0134] Example 2:
[0135] The computer-readable storage medium of this embodiment stores a computer program that, when executed by a processor, implements the steps of the method for rapidly constructing a regional highway network by extracting OSM map data in Embodiment 1.
[0136] The computer-readable storage medium in this embodiment can be an internal storage unit of the terminal, such as the terminal's hard disk or memory; the computer-readable storage medium in this embodiment can also be an external storage device of the terminal, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the terminal; furthermore, the computer-readable storage medium can include both the terminal's internal storage unit and external storage devices.
[0137] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0138] Example 3:
[0139] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the method of extracting OSM map data for rapid construction of regional road networks in Embodiment 1.
[0140] In this embodiment, the processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The memory can include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.
[0141] Those skilled in the art will understand that the content disclosed in the embodiments can be provided as a method, system, or computer program product. Therefore, this solution can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this solution can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage) containing computer-usable program code.
[0142] This solution is described with reference to flowchart illustrations and / or block diagrams of methods and computer program products according to embodiments of this solution. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0143] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0144] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0145] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0146] The examples described herein are merely preferred embodiments of the invention and are not intended to limit the concept and scope of the invention. Any modifications and improvements made by those skilled in the art to the technical solutions of the invention without departing from the design concept of the invention should fall within the protection scope of the invention.
Claims
1. A method for rapidly constructing a regional highway network by extracting OSM map data, characterized in that, Includes the following steps: S1. Download OSM map data for the specified area; S2. Extract and store all Way type data from the OSM map data, and store them in set W; W={w i |w i =(ID i ,Tag i ,L i )},i∈Z,0<i≤I Where wi is the i-th element in W, IDi is the unique identifier number of the road segment; Tagi is a tag dictionary containing key-value pairs (k:v) describing the data characteristics of wi; Li is a list of node numbers storing the numbers of the Nodes that make up wi; I is the length of the set W; S3. Set the resolution of the regional highway network; S4. Extract the road segments and their valid information data under the set parsing precision, and store them in the set Wdict; S5. Determine the total number of road segments connected by the points and store them in the network point set dictionary Ndict; S6. Extract and store the latitude and longitude data of points in the OSM map data; Based on the point number Nidc in Ndict, extract Node type data from the OSM map data and store the unique identifier number and location information of the point in set N; N={nd c |nd c =(Nid c ,lat c ,lon c )},c∈Z,0<c≤C Where ndc is the c-th element in N, idc is the unique identifier of the c-th point; latc is the latitude value of the c-th point; lonc is the longitude value of the c-th point; and C is the length of set N. S7. Perform node attribute determination and generate the network node set CoorN; S8. Generate the final highway segment and topology network structure data; S9. The data obtained from the above steps constitutes the data for constructing the highway network of the target area, and the parsing is completed.
2. The method according to claim 1, characterized in that, In step S3, The correspondence between the resolution of regional highway network and the OSM road segment data labels is as follows: First-level precision: Tag[k] = 'highway', Tag[v] = {'motorway', 'trunk', 'motorway_link', 'trunk_link'}; Second-level precision: Tag[k] = 'highway', Tag[v] = {'primary', 'primary_link'}; Level 3 precision: Tag[k] = 'highway', Tag[v] = {'secondary', 'secondary_link'}; Level 4 precision: Tag[k] = 'highway', Tag[v] = {'tertiary', 'tertiary_link'}; Level 5 precision: Tag[k] = 'highway', Tag[v] = {'unclassified', 'track', 'residential'}.
3. The method according to claim 1, characterized in that, Step S4 is as follows: Create a dictionary Wdict that stores a set of valid road segment information under the specified precision. Its storage structure is as follows: Wdict={ID a |ID a :[name a ,ref a ,class a ,lanes a ,oneway a ,nodes a :[nid a1 ,…,nid ab ]]}, a∈Z,0<a≤A,b∈Z,0<b≤B a Among them, IDa is the unique identification number of the highway section under the a-th parsing accuracy, namea is the name of the section, refa is the keyword of the section, classa is the grade of the section, lanesa is the number of lanes of the section, onewaya is the one-way attribute of the section, nodesa is the set of points included in the a-th section, nidab is the unique identification number of the b-th point in the directed node sequence constituting the a-th section, A is the total number of highway sections under the parsing accuracy, and Ba is the length of the directed node sequence constituting the a-th section; S41: Initialize i = 1; S42: Read the Tagi dictionary key-value pair (k:v) of wi in the set W; S43: Determine whether there is a tag value corresponding to the set accuracy in step S3 in (k:v): If so, continue to read other information contained in the Tagi dictionary key-value pair (k:v) of this section of the road, and go to step S44 for storing valid information data; otherwise, set i = i + 1 and return to step S42; S44: Store the extracted valid information data of the road section in the dictionary Wdict, set i = i + 1, return to S42, and continue to read the tag data contained in wi+1.
4. The method according to claim 1, characterized in that, The specific steps of step S5 are as follows: Create a dictionary of the road network point set Ndict, and its structure is: Ndict={Nid c |Nid c :[t c1 ,t c2 ,t c3 ]},c∈Z,0<c≤C Among them, Nidc is the unique identification number of the c-th point in the highway network, tc1 represents the total number of road sections connected by the c-th point, tc2 = 1 indicates that the c-th point is the starting point or ending point of a certain / some road sections, tc3 = 1 indicates that the c-th point is the intermediate point of a certain / some road sections, C is the total number of points included in the highway network, and the initial value of [tc1, tc2, tc3] is [0, 0, 0]. The specific calculation process is as follows: S�1: Initialize j = 1, c = 1; S52: Read the list of node numbers from the dictionary Wdict. j Stored point number nid j1 ,…,nid jb Let b = 1; S53: Determine nodes j The point number nid jb Is it equal to a point number Nidc in Ndict? If so, then tc1 = tc1 + 1; otherwise, Nidc = nidjb, tc1 = 1, c = c + 1. S54: Determine nid jb Check if the index is the first or last element in the nodesj list. If it is, then tc2 = 1; otherwise, tc3 = 1. S55: If b < Bj, set b = b + 1 and return to step S53; otherwise, set j = j + 1 and return to step S52.
5. The method according to claim 1, characterized in that, The specific steps of step S7 are as follows: Create a set CoorN for storing network node data: CoorN={coor d |coor d =(id d ,lat d ,lon d )},d∈Z,0<d≤D Among them, coord is the d-th element in CoorN, idd is the unique identification number of the d-th node; latd and lond are the latitude value and longitude value of the node coord respectively, and D is the length of the set CoorN; S71: Initialize j = 1, d = 1; S72: Read the list [tj1, tj2, tj3] in the set Ndict, and make node judgments according to the results obtained in step S5; S73: If tj1 = 1 and tj2 = 0, this point is not a node and no processing is done; if tj1 = 1 and tj2 = 1, this point is a node, save it as the coord element and set d = d + 1; if tc1 > 1, this point is a node, save it as the coord element and set d = d + 1; S74: Set j = j + 1 and return to step S72.
6. The method according to claim 1, characterized in that, The specific steps of step S8 are as follows: Create sets Wcoor for storing node information of each highway section, Wtopo for storing topological point information of each highway section, and Geom for storing information of each highway section; Wcoor={wcoor t |wcoor t =(id tk ,lat tk ,lon tk )},t∈Z,0<t≤T,k∈Z,0<k≤2 Wtopo={wtopo tm |wtopo tm =(id tm ,lat tm ,loan tm )},t∈Z,0<t≤T,m∈Z,0<m≤M Where, idtk is the unique identification number of the k-th node included in the t-th road segment, and lattk and lontk are the latitude value and longitude value of the node respectively; idtm is the unique identification number of the m-th topological point included in the t-th road segment, and lattm and lontm are the latitude value and longitude value of the topological point respectively, T is the total number of road segments in the road network, and M is the number of topological points included in road segment t; Geom={way h |way h =(nid hs ,nid he ,length h ,class h ,lanes h ,name h )},h∈Z,0<h≤H Where, wayh is the h-th element in Geom, nidhs and nidhe respectively represent the starting point and ending point numbers of the h-th road segment, lengthh represents the road segment length, classh represents the road segment grade, lanesh represents the number of lanes, nameh represents the road segment name, and H is the length of the set Geom; S81: Store the nodes and topological points of each road segment; S811: Initialize t = 1, b = 1, k = 1, m = 1; S812: Read the node numbers nid contained in the nodet list of the set dictionary Wdict. tb If nidtb is equal to a node number in the set CoorN, then store the point information of nidtb in both sets Wcoor and Wtopo, and let k = k + 1, m = m + 1, b = b + 1; otherwise, store the point information of nidtb in only the set Wtopo, with m = m + 1 and b = b + 1. S813: When k = 2, the two nodes of the t-th road segment have been found; at this time, if b < Bt, create a node set of the next road segment with nidt as the starting point, and return to step S812; if the nodet list has been read end, then t = t + 1 and return to step S812; S82: Calculate the length of the road segment; S821: Convert the point coordinates from geodetic latitude and longitude coordinates to web mercator coordinates for subsequent distance calculation; S823: Calculate the total length of the road segment S822: Calculate the distance between two points wtopotm and wtopotm+1 as lengthtm; 7. A computer-readable storage medium having a computer program stored thereon, characterized in that: S83: Store all information of the road segment in the Geom set.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the program is executed by the processor, it implements the steps in the method for quickly constructing a regional road network by extracting OSM map data as described in any one of claims 1 to 6. When the processor executes the program, it implements the steps in the method for quickly constructing a regional road network by extracting OSM map data as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method of reserving original road network data and expanding road network by utilizing OSM (open street map) data
CN107403020A
Method for rapidly extracting user-defined polygonal region internal road network from OSM data
CN107480306A