Jump to content

cGPSMapper Polish Format routing data, explained


SiliconFiend

Recommended Posts

Groundspeak's servers suck. Server timeout left the thread but nuked my post. Here it is again:

 

A new thread instead of further hijacking an existing one...

 

This is a quick overview/explanation of the routing data for cGPSMapper, which uses a file format known as the "Polish Format" (*.mp)

 

The thing with routing data is that it really isn't a visual thing. At its core, it is a simplification of the roads and trails, etc. into a network of nodes which indicate what roads connect to each other and where. This is necessary in order to optimize the data for a routing program (i.e., your GPS) to be able to make route calculations with limited resources (memory and processor time).

 

Here's just two trail snippets from the excellent Calgary Area Trail Maps to give a quick example:

[POLYLINE]
Type=0x16
RoadID=492
RouteParam=1,0,0,0,1,1,1,1,1,0,0,1
Data0=(51.31465,-115.08197),(51.31169,-115.07952),(51.31010,-115.07901),(51.30873,-115.07724),(51.30842,-115.07698),(51.30722,-115.07690),(51.30521,-115.07762),(51.30430,-115.07820),(51.30315,-115.07956),(51.30096,-115.08754)
Nod1=0,2904,0
Nod2=8,2908,0
Nod3=9,3715,0
[END]

[POLYLINE]
Type=0x16
Label=INDIAN SPRINGS TR
RoadID=419
RouteParam=1,0,0,0,1,1,1,1,1,0,0,1
Data0=(51.28890,-115.13917),(51.29160,-115.13805),(51.29328,-115.13665),(51.29452,-115.13483),(51.29525,-115.13440),(51.29607,-115.13449),(51.29650,-115.13440),(51.29710,-115.13359),(51.29817,-115.13277),(51.29903,-115.13175),(51.29993,-115.13166),(51.30259,-115.12779),(51.30418,-115.12625),(51.30452,-115.12578),(51.30546,-115.12191),(51.30564,-115.12084),(51.30564,-115.11940),(51.30636,-115.11428),(51.30611,-115.11309),(51.30551,-115.11180),(51.30538,-115.11116),(51.30551,-115.10977),(51.30564,-115.10917),(51.30615,-115.10814),(51.30701,-115.10746),(51.30808,-115.10728),(51.30903,-115.10668),(51.31027,-115.10530),(51.31053,-115.10475),(51.31079,-115.10316),(51.31225,-115.10050),(51.31241,-115.09943),(51.31233,-115.09848),(51.31298,-115.09764),(51.31332,-115.09698),(51.31375,-115.09545),(51.31435,-115.09192),(51.31452,-115.09020),(51.31499,-115.08815),(51.31504,-115.08673),(51.31495,-115.08612),(51.31435,-115.08351),(51.31465,-115.08197)
Nod1=0,2818,0
Nod2=42,2904,0
[END]

 

A polyline is just a string of points that are connected together to form a continuous path. Those points are defined in the Data0 line as pairs of coordinates. This is the base for all linear features on GPS maps (roads, trails, streams, etc.). (As an interesting aside, I think you can make any type of line routable, including rivers, streams, railroads, etc.--the GPS doesn't care).

 

There are a few attributes that are added to a normal polyline definition to make it routable, including the RoadID, RouteParam and then Nod1, Nod2, etc. The RoadID is only used for turn restrictions, so I won't talk about that. The RouteParam defines various things such as how "important" the road is, how fast you can go, and what vehicle types are allowed. This information is all important because the road speed combined with the distance is used to calculate the "Fastest" route on your GPS.

 

The Nod1, Nod2, Nod3 define the routing nodes. As mentioned before, routing nodes define the interconnections between roads or trails. If you look at the first polyline in the sample, you see Nod1=0,2904,0 The number after Nod (1,2,3) doesn't really matter, it's just used to distinguish between the routing node definitions for a particular polyline. The first number after the equals sign indicates which coordinate pair is a routing node, starting at 0 for the first point. For example, if the indicated coordinate pair is 8 and you stood on the first point of the Data0 line and jumped to each coordinate pair in sequence, when you jumped 8 times, you would be at the routing node (intersection). The next number after the comma is the Routing Node ID, which is just a unique number for that Routing Node. When there are other roads that intersect at that point, they'll use the same Routing Node ID in their routing node definitions. That's how the GPS knows that those two roads share the same point and you can move from one road to the other. The last number after the comma is just a flag indicating that the routing node is at the edge of your map segment and can link to a corresponding node in another map segment.

 

So, looking at our map code sample again, you can see that the first polyline has Nod1=0,2904,0 and the second polyline (Indian Springs Tr) has Nod2=42,2904,0 Because they share a Node ID (2904), those trails are linked at that point and you can route between them. Repeat thousands of times for thousands of polylines and you build up an entire road network that way. Because of this, it's best not to do it manually (that would be quite error-prone) but it's well-suited for automated tools such as GPSMapEdit to create and manage the routing nodes.

 

Hope this helps improve your understanding.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...