<div class="gmail_quote">On Tue, May 13, 2008 at 12:08 AM, Simon Wood <<a href="mailto:simon@mungewell.org">simon@mungewell.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, 9 May 2008 00:24:11 -0600<br>
<div class="Ih2E3d">Simon Wood <<a href="mailto:simon@mungewell.org">simon@mungewell.org</a>> wrote:<br>
<br>
</div><div class="Ih2E3d">> Well I've had a stab at this, probably the worlds worst python script but it does work....<br>
<br>
</div>Cleaned up version added to SVN, browsable here:<br>
<a href="http://trac.openstreetmap.org/browser/applications/utils/import/mp2osm/mp2osm_catmp.py" target="_blank">http://trac.openstreetmap.org/browser/applications/utils/import/mp2osm/mp2osm_catmp.py</a><br>
<br>
Supports POI, POLYLINE and POLYGON. Can parse the CATMP stuff without error, but have not uploaded resultant data to OSM yet. Doesn't do anything with the 'Nod[1..]' bits as I couldn't see how to re-open an element in ElementTree to modify it/add the appropriate tag.<br>
<br>
Cheers,<br>
Mungewell.<br>
</blockquote></div><br>Simon,<br><br>Okay, I finally got around to taking a quick look at your script and your converted data. I don't really know python, but I have a few comments:<br>1. This import doesn't keep track of the topology (i.e., nodes are duplicated instead of shared between ways which connect). For a nice, routable dataset such as what we're getting here, it would be a shame to lose that. Maybe you could create a hashtable with a mapping from the routing nodes (Nod[1...]) to the OSM node ids, and then refer to that as you're creating the ways (and re-use the OSM ids when you encounter a routing Node ID you've seen before). You might want to just read the entire Data0 line into a string variable and then defer parsing it until you hit the [END] line for that section.<br>
2. You should only be reading the Data0 info, because it has the highest-resolution data (what we want to import). The higher numbers just have lower-resolution data for farther-out zoom. If I'm reading it right, it looks like you're appending all the linestrings from each Data0, Data1, etc. together, which will create a repeated, overlapping series, which is not what you want.<br>
3. It wouldn't take much to explode the "RouteParam" line and assign access, oneway and maxspeed tags to the ways based on that information. I gave you the explanation of the encoding of the RouteParam fields in an earlier email.<br>
4. Similarly, there should be only a few Garmin map types used in this map--it wouldn't take much to translate those to OSM "highway" or whatever tags.<br><br>There are a bunch of map datasets out there being maintained in the MP or Polish map format, so spending some time to get this script improved could have a great impact later if we get to import some of those other ones. If I get a chance this weekend (not very likely), I'll see if I can improve the script, but if you get to it first, so much the better.<br>
<br>Karl<br>