You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2009-12-02 02:16:51

Seldom
Member
Registered: 2009-01-25
Posts: 193

How do I run mkgmap on a batch of files in Windows?

I'd like to run mkgmap on a set of 20 MP files.

Windows will run 

for %%i in (*.mp) do java.exe -Xmx1280M -enableassertions -jar "c:\program files\mkgmap\mkgmap.jar" --route --net --description="SUT-2D" --mapname=12345678 %%i

but, as it stands, this code will only overwrite 12345678.img with every file in the set of *.mp.  Is there a way to get mkgmap to access the 8 digit MapID in the MP file, or to get Windows to concatenate and increment the IMG name?

Thanks in advance.

Offline

#2 2009-12-02 10:07:48

Lambertus
Inactive
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: How do I run mkgmap on a batch of files in Windows?

How about run Mkgmap without the for loop:

java.exe -Xmx1280M -enableassertions -jar "c:\program files\mkgmap\mkgmap.jar" --route --net --description="SUT-2D" --mapname=12345678 *.mp

Because that's what is working for me under linux.


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#3 2009-12-02 11:53:00

Seldom
Member
Registered: 2009-01-25
Posts: 193

Re: How do I run mkgmap on a batch of files in Windows?

I can see how that works for creating the 6324000.TDB and IMG, but how does that generate multiple map names?  It looks to me like that would overwrite 12345678.IMG with every MP in *.MP.  In my case 20 calls end with a single 12345678.IMG, the last compiled  file.

Offline

#4 2009-12-02 16:40:00

triggerfish
Member
Registered: 2009-12-02
Posts: 5

Re: How do I run mkgmap on a batch of files in Windows?

Not sure if it's the same. But when I process my downloaded raw data from the open streetmaps server I use this cmd file, which i call like

> maak.cmd Nederland

It makes files named the same as the input files, but with other extention. It contains:

FOR %%X IN (*.osm) DO (call :s_mm %%X %1%)
GOTO :eof

:s_mm
SET _alles=%1%
SET _land=%2%
SET _kaart=%_alles:~0,8%
SET _gridd=%_alles:~4,4%
echo %_land% %_alles% %_kaart% %_gridd%
java -jar c:\apps\geocaching\mkgmap\mkgmap.jar --mapname=%_kaart% --description="%_land% grid %_gridd%" %_alles%
GOTO :eof

It will process all files ending on .osm and I set some parameters:
First I set a parameter to the full filename:
SET _alles=%1%

The I set a parameter to the parameter passed to the cmd file for naming the country:
SET _land=%2%

Then I set a parameter for the mapname, which the first 8 characters from the name, which is an 8 digit number in my case:
SET _kaart=%_alles:~0,8%

Finally I set a parameter to a grid coordinate. That's just the way I named my data.
SET _gridd=%_alles:~4,4%


Hope this helps...

Offline

#5 2009-12-05 18:31:18

Seldom
Member
Registered: 2009-01-25
Posts: 193

Re: How do I run mkgmap on a batch of files in Windows?

Thanks, triggerfish. It helps a lot, although there is more Windows Command Language here than I ever hoped to learn.  If I read this right, your OSM filename is in a format like 12345678.OSM where 5678 is parsed to the grid and 12345678 is parsed to the mapname.  Is the _land parameter Nederland?

Offline

#6 2009-12-07 20:09:17

triggerfish
Member
Registered: 2009-12-02
Posts: 5

Re: How do I run mkgmap on a batch of files in Windows?

Yes, that is correct. I used the filename's first four digits to define a country then two sets "coordinates" on a map "chess board". So i got several files which together defined an area. The only parameter you would probably need would be the _kaart one, which reflects the name part of the filename.

Best regards, Peter

Offline

Board footer

Powered by FluxBB