osm2mp.pl: OSM -> Polish format converter

I want to convert a osm file into a mp file by using osm2pm but I can not figure out how to do it. I tried to find an explanation on running osm2pm for a beginner for a couple of hours but I was not successful. I have installed a perl and tried the following command for the converstion.
c:\perl d:\osm2mp.pl d:\map.osm >map.mp
In d:, there were files, osm2mp.pl and map.osm.

It did not, however, work out and only produced an error message, "Can’t locate Template.pm in @INC… "

What are the correct way to do the conversion or where can I get an explanation for it?

Suggest you try ActivePerl if you haven’t. I found it’s installer and library managers are easier for a beginner than Strawberry Perl. If you track the error messages carefully, you will get a list of math modules you need that don’t come with the basic Perl package.

Thank Seldom for your suggestions.

I track the error message and installed the missing file Template.pm and ran osm2mp again by using the same perl command. However, again I got again an error message saying that another file was missing.

I also changed the Perl from Strawberry to Active but the result was the same.

It gives me a feeling that this not the way I can be successful with. Maybe I need to study Perl? What I want to do, however, is simply converting an osm file into a mp file, I wonder whether I really need to do so. Also I wonder whether by getting some knowdledge on Perl I would be able to successfully do the conversion.

Would you give me a recommendation?

I’m running Win7. When I installed ActivePerl I also got an app called Perl Package Manager.
I install OSM2MP.pl in the same folder as the OSM file I want to convert.
As you run OSM2MP you will get a series of error messages identifying missing library components. Browse for them with Perl Package Manager and install them. It may take a few tries, but eventually you will find all the packages you need.
It might be easier to open OSM2MP.pl in a text editor use the Package Manager to find the “required packages” listed at the start of the file.

Oh, it was great, finally I succeeded the conversion !!
Seldom, your comments of PPM(Active manager), finding required packages from the start of the file, and installig OSM2MP.pl in the same folder as the OSM file for conversion were critical to me.

I appreciate your help.

I summarize the tips for the converion work by using osm2mp for a beginner like me.

  1. Download osm2mp package (http://garminmapsearch.com/osm/osm2mp_v080.zip)
  2. Downaload Active Perl (http://www.perl.org/get.html ) and PPM(Perl Package Manager: http://search.cpan.org/~murray/PPM-2.1.9/bin/ppm.pl))
  3. Install Active Perl first, then PPM
  4. Open osm2mp.pl in a text editor and locate the list of the required packages at the top of the file.
  5. Run PPM by entering the command ‘ppm’ in the Command Window of Windows. Be sure that the computer is in connection with the Internet.
  6. At the ‘View all packages’ winfow of PPM, locate the required but uninstalled packages and put them to the action file list by clicking the package name, pressing the right button and selcting “install ….”
  7. Select “File”-“Run Marked Actions”
  8. Exit the PPM
  9. Put the osm file to convert to the directory of osm2mp package.
  10. In the Command Window of Windows, change the current directory to the directory of osm2mp package by the command, CD
  11. Run the following command
    osm2mp.pl map.osm > m1.mp

The options of osm2mp.pl can be listed by the command,
osm2mp.pl >list.txt

Glad it worked.

Can I ask for explanation what %name parameters can be used
in yml files.
Example:

  • condition:
    • building = *
      action:
    • action: write_polygon
      type: 0x13
      Label: %house

I found %house, %label and guessed %street

Second question is how to use values from other xml tags. (addr:city for example)

Regards

Michal

Hello Liosha,
I finally succeeded converting a .osm extract to .mp; I opened the file with MapEdit and then exported it to Navitel .nm2 format; I was happy with the process, but when I tried to open the file in Navitel 5.5.0.1, I see no map and after restarting Navitel, the message “Generating Maps” stays there forever. Is there something I am doing wrong? I am seeing all the data correctly displayed in MapEdit (ver 1.0.66.7); even the addresses and building numbers. So, it looks like the process of converting the .osm data into .mp is done correctly. Any ideas on this? I’ll greately appreciate any help on this.
Thanks for your work!

Hi Liosha,

Thank you for your great osm2pm.pl! It’s helping me a lot with maps for 7ways. I need your help with a problem I’m having here (Brazil). It seems that some long roads are not being split by osm2pm.pl, despite using max_road_nodes=N, and I added the condition in bold as an workaround. It seems to fix my problem and I can now convert the resulting mp to 7w, but I’m not sure if t’s OK. Would please comment on that? Also, I didn’t understand what the first condition below does, I’d much appreciate if you could explain that.

            elsif ( $rnod == 1 + $values->{max_road_nodes} // 999 ) {
                $countlong ++;
                $break = $prev;
                push @breaks, $break;
                $rnod = 2;
            }

** elsif ( ($i % 2000 ) == 0 ) {
$countlong ++;
$break = $i;
push @breaks, $break;
$rnod = 2;
}
**

Thanks in advance,
– Fidelis Assis