On Tue, May 13, 2008 at 12:08 AM, Simon Wood <[EMAIL PROTECTED]> wrote:
> On Fri, 9 May 2008 00:24:11 -0600 > Simon Wood <[EMAIL PROTECTED]> wrote: > > > Well I've had a stab at this, probably the worlds worst python script but > it does work.... > > Cleaned up version added to SVN, browsable here: > > http://trac.openstreetmap.org/browser/applications/utils/import/mp2osm/mp2osm_catmp.py > > 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. > > Cheers, > Mungewell. > Simon, 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: 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. 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. 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. 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. 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. Karl
_______________________________________________ talk mailing list talk@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk