Bílý vrch
icon TrekBuddy
www.trekbuddy.net
Outdoor companion.
  • internal / bluetooth / simulator GPS
  • offline raster maps
  • smart GPX / raw NMEA logs
  • waypoints and simple navigation
  • custom views
  • MIDP and Symbian phones
  • Blackberry
  • Android
Visit wiki to see all features, guides and howtos. Project tracker.

Partners:    (Polish/Polski)(Polski) Compass mapy      (Polish/Polski)(Polski) Galileos mapy      (Polish/Polski)(Polski) CartoMedia      (Czech/Èesky)(Èesky) Eaglesoft trasy      (Polish/Polski)(Polski) ExpressMap     

 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Batch method of generating TB Map folders from Ozi maps?

 
Post new topic   Reply to topic    TrekBuddy Forum Index -> Tools
View previous topic :: View next topic  
Author Message
Bambleweenie



Joined: 13 Dec 2010
Posts: 32

PostPosted: Tue Apr 03, 2012 3:16 pm    Post subject: Batch method of generating TB Map folders from Ozi maps? Reply with quote

Hi all,

Is there a batch method of generating untared maps starting from a folder containing multiple OziExplorer .map and .gif files?

I'm imagining a process starting from a folder containing two or more Ozi paired files xxx.map/xxx.gif and yyy.map/yyy.gif, leading to the creation of two output folders called xxx and yyy and containing the relevant .map, and .set files and the set folder with the map tiles.

It would be ideal to invoke say jTBtar in batch mode, but I can't see anyway of doing this. As far as I know, jTBtar can't run from the command line.

I've searched the forums, and it seems there might have been a way of doing this with the Gimp, but it doesn't seem to work anymore.

The idea is to point the batch process at a folder containing multiple Ozi map files, and end up with a collection of TB Map folders (named after the Ozi pair) which can then be arranged into an Atlas structure optimised for the easy zoom feature of TB.

If anyone has any ideas or suggestions, I'd be grateful
Back to top
View user's profile Send private message
Freddie



Joined: 11 Jun 2008
Posts: 71

PostPosted: Tue Apr 17, 2012 8:26 pm    Post subject: Reply with quote

This script supports maps created on the basis of "PNG".
As at the beginning may be enough.



Rys.jpg
 Description:
Instructions
 Filesize:  43.25 KB
 Viewed:  13522 Time(s)

Rys.jpg



Ozi2TB.zip
 Description:
Script and programs

Download
 Filename:  Ozi2TB.zip
 Filesize:  870.98 KB
 Downloaded:  15 Time(s)


_________________
K530 > K770 > J105 > DG300 > Huawei P8 Lite & PENTAGRAM P 3101
Back to top
View user's profile Send private message Send e-mail
Freddie



Joined: 11 Jun 2008
Posts: 71

PostPosted: Wed Apr 18, 2012 4:22 pm    Post subject: Reply with quote

I've added the ability to convert BMP, JPG, GIF, and PNG.

In theory, adding the "Run_All.bat" in line "(*. Png, *. Jpg, *. gif, *.bmp.)" by analogy other formats, script should work.

The script saves the pieces of the image in PNG format, and modifies the MAP configuration file, to be compatible with pieces of PNG



Rys2.jpg
 Description:
Folder
 Filesize:  17.7 KB
 Viewed:  13423 Time(s)

Rys2.jpg



Ozi2TB_2.zip
 Description:
New script and progrms

Download
 Filename:  Ozi2TB_2.zip
 Filesize:  800.94 KB
 Downloaded:  31 Time(s)


_________________
K530 > K770 > J105 > DG300 > Huawei P8 Lite & PENTAGRAM P 3101
Back to top
View user's profile Send private message Send e-mail
Bambleweenie



Joined: 13 Dec 2010
Posts: 32

PostPosted: Thu Apr 19, 2012 10:43 pm    Post subject: Reply with quote

Hi Freddie,

Thanks for taking the time to reply. I can't get the bat file to work - it doesn't appear to do anything. Please could you post some instructions?

I think that your intention is to run the .bat file using an xxx.png file as the input? If I drag a xxx.png file onto TB.bat, it creates an xxx.map file and a set folder - but the set folder has no contents (no map tiles), and the xxx.map file refers to the original image. If I drag xxx.png onto the RUN_ALL.bat file, nothing happens at all. I'm probably doing something dumb, but would appreciate any pointers


Last edited by Bambleweenie on Fri Apr 20, 2012 8:26 am; edited 1 time in total
Back to top
View user's profile Send private message
Freddie



Joined: 11 Jun 2008
Posts: 71

PostPosted: Fri Apr 20, 2012 8:04 am    Post subject: Reply with quote

The instructions are simple. Belongs to folder with files from OZI copy everything from the package made ​​available on the forum and start RUN_ALL.BAT
_________________
K530 > K770 > J105 > DG300 > Huawei P8 Lite & PENTAGRAM P 3101
Back to top
View user's profile Send private message Send e-mail
Bambleweenie



Joined: 13 Dec 2010
Posts: 32

PostPosted: Fri Apr 20, 2012 8:32 am    Post subject: Reply with quote

Hi Freddie

Sorry, I edited my above post and ended up cross-posting. To repeat:

I put an xxx.png and xxx.map Ozi pair in the Ozi2TB_2 folder. When I drag the xxx.png file onto the RUN_ALL.bat file, nothing happens at all. If I drag the xxx.png file onto TB.bat, it creates an xxx.map file and a set folder - but the set folder has no contents (no map tiles), and the xxx.map file refers to the original image.

I'm probably doing something dumb, but would appreciate any pointers. I am trying to run the .bat files by dragging and dropping the image files onto the .bat file - this should work?
Back to top
View user's profile Send private message
Freddie



Joined: 11 Jun 2008
Posts: 71

PostPosted: Fri Apr 20, 2012 8:44 am    Post subject: Reply with quote

Run only "Run_All.bat", the program finds files themselves. Drag and Drop is not needed.

Source "Run_All.bat"
Code:

FOR %%f IN (*.png;*.jpg;*.gif;*.bmp) DO (TB.bat "%%f" 240 320)


Source "TB.bat"
Code:

@echo off
rem The script divides the image "%1" into pieces with dimensions "%2"x"%3".
rem "%1", "%2", %3" are the parameters to run the script.
rem Example: "TB.bat image.png 240 320"
rem "Nconvert.exe" and "Fart.exe" files is required for proper operation of the script.

rem == Reading image dimensions - Width (w) and Height (h) ==

For /f "tokens=1,2 delims=':')" %%a in ('"nconvert -info %1 | find "Width""') do set /a w=%%b
For /f "tokens=1,2 delims=':')" %%a in ('"nconvert -info %1 | find "Height""') do set /a h=%%b


rem == Reading the map name and create the folder (%1) ==

For /f "tokens=1,2 delims='.')" %%a in (%1) do set n=%%a&set e=%%b
mkdir "%n%\set"
copy "%n%.map" "%n%" > nul


rem == Modifying the name extension in the configuration file maps ==

fart -i "%n%\%n%.map" .%e% .png


rem == Cutting a bitmap with dimensions (%2) x (%3) ==

set y=0
:cropy
set x=0
:cropx
nconvert -crop %x% %y% %2 %3 -o %%\set\%%_%x%_%y%.png -out png -colors 256 %1 > nul
set /a x=x+%2
if %x% lss %w% goto :cropx
set /a y=y+%3
if %y% lss %h% goto :cropy


rem == Creating "set" file ==

dir "%n%"\set\ /B > "%n%\%n%.set"

_________________
K530 > K770 > J105 > DG300 > Huawei P8 Lite & PENTAGRAM P 3101
Back to top
View user's profile Send private message Send e-mail
Ranger



Joined: 12 Dec 2006
Posts: 6030

PostPosted: Fri Apr 20, 2012 9:01 am    Post subject: Reply with quote

Just try to doubleclick on run_all.bat to run script.
Back to top
View user's profile Send private message
Bambleweenie



Joined: 13 Dec 2010
Posts: 32

PostPosted: Fri Apr 20, 2012 9:10 am    Post subject: Reply with quote

@ Ranger - thanks, that was the bit I was missing - how to run the .bat file. Double-clicking it worked fine

@Freddie - got it to work, and it does an excellent job. Thanks for taking the time to create and share the script - I appreciate your help
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    TrekBuddy Forum Index -> Tools All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group