OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2008-07-26 19:58:18

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

osm2mp.pl: OSM -> Polish format converter

osm2mp.pl can convert OpenStreetMap data into Polish map format (MP).

Current version is 0.80

Main features:
* customizable type set
* multipolygon support
* routing graph generation with road classes and turn restrictions
* address search support
* data processing for cgpsmapper (merging roads, fixing self-intersecting roads and close nodes)
* reports on data mistakes

Download: http://garminmapsearch.com/osm/osm2mp_v080.zip

Use: osm2mp.pl <options> file.osm > file.mp

Other useful tools:
cGPSmapper - for converting MP file into garmin IMG file. Use personal version for routing support.
GPSMapEdit - for MP visualization, editing and error checking

Last edited by liosha (2010-01-18 09:25:00)

Offline

#2 2008-07-26 20:15:09

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

nyem wrote:

I can't get osm2mp to process my turn restrictions. Do you have some examples on how it's being done?

some examples here: http://openstreetmap.org/edit?lat=55.78 … 16&zoom=14

Offline

#3 2008-07-26 22:53:17

nyem
Member
Registered: 2007-08-02
Posts: 20

Re: osm2mp.pl: OSM -> Polish format converter

Thanks

  <relation id="20408" visible="true" timestamp="2008-07-10T19:54:13+01:00" user="liosha">
    <member type="node" ref="271603925" role="via"/>
    <member type="way" ref="10630805" role="to"/>
    <member type="way" ref="25475073" role="from"/>
    <tag k="type" v="restriction"/>
    <tag k="created_by" v="Potlatch 0.9c"/>
  </relation>

Now I can see that to/from roles are applied to ways, instead of nodes tongue

Offline

#4 2008-07-29 11:58:08

mathew7481
Member
Registered: 2008-07-29
Posts: 1

Re: osm2mp.pl: OSM -> Polish format converter

Hello liosha,

I tried to use your converter for a map from Slovakia but faced the problem that some letters are not converted especially those which are not part of the us-ascii code set. Do you have any idea how to fix this?

Offline

#5 2008-07-29 22:00:38

usm78-gis
Member
Registered: 2008-04-21
Posts: 2,438

Re: osm2mp.pl: OSM -> Polish format converter

mathew7481 wrote:

some letters are not converted especially those which are not part of the us-ascii code set. Do you have any idea how to fix this?

You can replace the codepage number at the top of osm2mp.pl to match your preferred codepage.
Expect a weird conversion when some utf8 symbol is outside of the page range, and blame garmin for not using utf8 wink

my $codepage    = "1251";

Last edited by usm78-gis (2008-07-29 22:01:41)

Offline

#6 2008-08-01 18:28:08

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

small update: http://garminmapsearch.com/osm/osm2mp_v053.zip

* added duplicate road reporting
* geo. location in most error messages
* few fixes

Offline

#7 2008-08-02 10:59:24

Tommy
Member
Registered: 2008-07-11
Posts: 7

Re: osm2mp.pl: OSM -> Polish format converter

Good stuff liosha! Would it be possible to have the option send a parameter to the converter to disable some of the error corrections? I find it useful to use GPSMapEdit to spot errors that aren't easily found otherwise. Thanks!

Offline

#8 2008-08-02 11:33:12

Tommy
Member
Registered: 2008-07-11
Posts: 7

Re: osm2mp.pl: OSM -> Polish format converter

A small improvement suggestion, make the .cfg-files support tab. Have been trying to add shop=mall for some time until I finally realised it was the tabstops that screwed it up. Thanks again for a really useful piece of software!!

Offline

#9 2008-08-02 16:26:47

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

Tommy wrote:

Would it be possible to have the option send a parameter to the converter to disable some of the error corrections?

i'll implement command-line options in future versions.
this time you can disable features by editing first lines of the script, like my $fixclosenodes  = 1;
or just search result .mp for error messages: grep ERROR: file.mp

Tommy wrote:

make the .cfg-files support tab. Have been trying to add shop=mall for some time until I finally realised it was the tabstops that screwed it up

i'll fix it in next version

Offline

#10 2008-08-03 19:20:56

Skywave
Member
Registered: 2007-11-13
Posts: 91

Re: osm2mp.pl: OSM -> Polish format converter

Are you also going to do something with the coastlines?

Note: You could look at Kosmos, it has an algorithm which uses the bounding box in the OSM files to fill the right side of the coastline with water

Offline

#11 2008-08-17 05:14:33

Tommy
Member
Registered: 2008-07-11
Posts: 7

Re: osm2mp.pl: OSM -> Polish format converter

Here's another suggestion for improvement: Choose which language to use by default (name:en, name:de etc. with name as fallback if it doesn't exist)

Offline

#12 2008-08-30 01:17:08

Tommy
Member
Registered: 2008-07-11
Posts: 7

Re: osm2mp.pl: OSM -> Polish format converter

Trying to setup a correct poi.cfg file. And I'm in desperate need of some clarification. Which POI numbers should I use, it doesn't make sense to me since there are several numbers for the same POI's: SCHOOL can be defined as both 0x6410 and 0x2C05. I have a faint memory of reading a webpage somewhere stating that you should avoid using certain number-ranges due to compatibility issues. So what numbers should I use to define POI's?

If someone could clarify this for me I would greatly appreciate it!

Explain this, and if this is something you can specify anywhere which RGN set to use (as found in this file: http://ukgarminairmap.wikispaces.com/sp … GNtype.txt ):

GPSmapper element types list

RGN10 & RGN20 types-all types are two bytes, first byte is a major type byte, second byte is a subtype.

WARNING-RGN10 can use both bytes, RGN20 can use only the first byte, so if we want-create a Dinning point on map, using RGN10 we can define if it has-be an Asian(0x2a02) or Chinese(0x2a04) but using RGN20 element we can only define it as a Dinning area(0x2a)-no subtype is allowed!

Offline

#13 2008-09-14 01:28:02

scribbly
Member
Registered: 2008-09-14
Posts: 2

Re: osm2mp.pl: OSM -> Polish format converter

Really nice script.
I noticed one bug in the newest version though(An old version I used before did it correctly), some roads where getting random "no bicycle, no car, no etc..." tags
I solved this problem by changing

      undef ($poly);

      undef ($polyname);
      undef ($polydir);

      next;
   }

to

      undef ($poly);

      undef ($polyname);
      undef ($polydir);

   undef ($polytoll); 
   undef ($polynoauto);
   undef ($polynobus);
   undef ($polynoped);
   undef ($polynobic);
   undef ($polynohgv);

      next;
   }

Not sure if it'll cause any other problems, but at least the highway near my house isn't closed for cars anymore.

Last edited by scribbly (2008-09-14 01:29:06)

Offline

#14 2008-09-14 08:51:28

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

scribbly wrote:

Really nice script.
I noticed one bug in the newest version though(An old version I used before did it correctly), some roads where getting random "no bicycle, no car, no etc..." tags

stupid bug... thanks!  smile

Last edited by liosha (2008-09-14 09:00:01)

Offline

#15 2008-12-09 18:31:25

Nikita006
Member
Registered: 2008-12-09
Posts: 1

Re: osm2mp.pl: OSM -> Polish format converter

Hi Liosha, and thank you for the great job you do on routed maps.
You are using Template.pm module since few days. And when I run osm2mp (v0.60r19) it fails on Template.pm

Can't locate Template.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at F:\David\OSM\Tools\osm2mp_v060r19\osm2mp.pl line 66.
BEGIN failed--compilation aborted at F:\David\OSM\Tools\osm2mp_v060r19\osm2mp.pl line 66.

Where can I find this perl module ?

Offline

#16 2008-12-09 19:55:01

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

Yes, now osm2mp uses Template-Toolkit and Getopt::Long.
See http://cpan.org/
I use Perl Package Manager (PPM) to install them

Offline

#17 2008-12-12 15:29:14

hanno
Member
Registered: 2008-12-12
Posts: 2

Re: osm2mp.pl: OSM -> Polish format converter

The page
http://wiki.openstreetmap.org/wiki/Mkgmap/routing
says:
"osm2mp v0.53 has a bug causing access permissions to be overwritten. This has been fixed in the svn version. "

Can we have a new version with this fix?

Beside, could you please switch from DOS linebreaks (cr/nl) to unix breaks? The DOS breaks cause that it's not possible to make the osm2mp.pl file executable on linux and just run it:

hanno@libertalia ~/osm/routing/osm2mp-read-only/osm2mp $ ./osm2mp.pl
-bash: ./osm2mp.pl: /usr/bin/perl^M: bad interpreter: Datei oder Verzeichnis nicht gefunden

Offline

#18 2008-12-13 10:25:50

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

ok, i've removed cr symbol
you can get fixed code from svn: http://code.google.com/p/osm2mp/source/checkout

Offline

#19 2008-12-17 21:28:57

weolvi
Member
Registered: 2008-12-17
Posts: 26

Re: osm2mp.pl: OSM -> Polish format converter

Liosha,

first of all "Thank You" for the great script you wrote. I found that --fixclosenodes does not work correctly in all cases as cgpsmapper still detects a couple of too close nodes. As far as I can tell the closenodes() function is implemented correctly. My guess for the cause is that nodes are only checked and corrected in pairs: Assume that node 1 is too close to both node 2 and node 3. First the distance to node 2 ist corrected and then the distance to node 3. The second correction might push node 1 closer to node 2 again.

As a workaround I tried to execute the correction repeatedly in order to slowly push all conflicting nodes further apart until everything is fixed. However, it seems that this does not work. Either it converges only very slowly or certain node constellations are cycled through in a circular way. Unfortunately, I am not very good at perl so that I can't try anything more sophisticated.

Offline

#20 2008-12-22 20:37:57

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

I know about this problem
But it requires too complex processing to fix it
So i advise to fix such areas in OSM, or use cgpsmapper -e

Offline

#21 2008-12-22 21:19:46

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

Version 0.60
http://gpsmapsearch.com/osm/osm2mp_v060.zip

* added street indexing support (from is_in tag)
* added command-line options
* added list of tags for Label (--nametaglist)
* fixes

Now it needs two perl packages: Template-toolkit, Getopt::Long

Offline

#22 2008-12-22 22:39:58

mtrax
Member
From: Canberra, Australia
Registered: 2008-05-20
Posts: 103

Re: osm2mp.pl: OSM -> Polish format converter

have you got a wiki page for documentation for this package ?
and some 1,2,3 steps would be good for us noobies

Offline

#23 2008-12-23 08:53:58

liosha
Member
From: Moscow
Registered: 2008-03-04
Posts: 8,443
Website

Re: osm2mp.pl: OSM -> Polish format converter

There is a page in wiki, but not much documentation there
http://wiki.openstreetmap.org/wiki/Osm2mp

Offline

#24 2008-12-23 12:40:05

weolvi
Member
Registered: 2008-12-17
Posts: 26

Re: osm2mp.pl: OSM -> Polish format converter

liosha wrote:

I know about this problem
But it requires too complex processing to fix it
So i advise to fix such areas in OSM, or use cgpsmapper -e

I tried to use mapcenter2. Is there a possibility to pass the -e option?

Last edited by weolvi (2008-12-23 12:40:27)

Offline

#25 2008-12-26 16:13:14

hanno
Member
Registered: 2008-12-12
Posts: 2

Re: osm2mp.pl: OSM -> Polish format converter

I just found out that there's no license information of any sort in osm2mp.

Can you put it under some free software license?

Offline

Board footer

Powered by FluxBB