Batch converting ozfx files to locus

Started by InfX, March 23, 2011, 00:21:12

0 Members and 2 Guests are viewing this topic.

InfX

I've made a little bat file to convert multiple ozfx files to locus tar files without user interaction and though it may be useful for others as well, so i've decided to post it here. Let me know if posting something like this is considered wrong for whatever reason.

Tools used:
 * ozf2img v1.1
 * imagemagick convert v 6.6.8-5 (Q8), renamed to imconvert.exe
 * tar (unknown version, whatever runs under my win32)

Usage:
 * Make sure the tools mentioned above are accessible on your %path%
 * Copy the ozfx files together with the corresponding map files into a separate directory
 * Execute the bat below from inside this directory

Bat file code:
@echo off

:: run on all map files and convert those
for %%i in (*.map) do (
    call :convert %%i
    if errorlevel 1 echo Error !
    if errorlevel 1 exit /b 1
)
goto :eof

:: single map conversion function
:convert
    :: params
    set mapfile=%1
    set mapdir=%~n1
    set tarfile=%mapdir%.tar

    :: convert the map image into png
    echo Extracting image from %mapfile%...
    ozf2img.exe -i%mapfile% > NUL || exit /b 1
   
    :: crop the image into tiles, erase the big image
    echo Generating %mapdir% tiles...
    mkdir %mapdir% || exit /b 1
    imconvert *.png -crop 250x250 -set filename:fn "%%[fx:page.x/250+1000]_%%[fx:page.y/250+1000]" +repage %mapdir%%%[filename:fn].png
    if errorlevel 1 exit /b 1
    del *.png || exit /b 1
   
    :: rename the tiles
    cd %mapdir%
    for %%n in (????_????.png) do call :rename %%n || exit /b 1
    cd ..

    :: tar tiles and map, kill the tiles dir
    echo Packing %tarfile%...
    tar -c %mapfile% %mapdir%/* > %tarfile% || exit /b 1
    rmdir /q /s %mapdir% || exit /b 1
goto :eof

:rename
set fn=%1
ren %1 %fn:~1,3%_%fn:~6,3%.%fn:~10,3% || exit /b 1
goto :eof
  •  

Menion

#1
Hmm very nice. I moved you topic into "Tools". Just count that TAR maps are not much supported and it's a long time since I really test them with all Locus functionality!
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

InfX

#2
The tar format is what i've found on this forum while searching for a way to use ozi maps with locus. What is the format that is fully supported and how do you recommend to convert the ozi maps into it ?
  •  

Menion

#3
Yes, I used TAR as only format until cca november 2010. Then I completely rewrote Locus to support SQLite format. But to be true, I'm not using Ozi Maps so I don't even know method how to convert them into SQLite format. Anyway TAR should be still function so if it works, than fine. Leave it :)
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

maquinna123

#4
I bought your program Locus Pro but unless your program will handle  Geotiffs and DRGS, it is not really a Pro program. I have been trying to find a conversion program that will
convert OziExplorer .ozfx3 or ozfx2 files to tar format or SQLite. Basically if OziExplorer can load a satellite image, topographical map,  air chart or marine chart
 it can convert it to .ozfx3 or ozfx2 format. The formats include .tif, .bsb, .bmp, .png, .jpg, .ecw,  and .sid.
 Other formats can be converted to one of these format by using GlobalMapper. TerrainInCognita will capture images from Internet Mapping servers and save them in .tar format.
But Search and Rescue, oil and gas industry, mining industry, forestry industry etc. use geotiff topographical maps, known as DRGs in the USA.
Google Terrain mapping is good but it does not have the detail of a good topographical map.
Probably the best conversion program for mapping is GlobalMapper but it does not output the .tar or SQlite format.
Your program has great features pertaining to street level mapping but to compete with other mapping programs
coming on the market you should add the basic mapping formats to your product.
  •  

locuspro

#5
Is there any solution until now to convert ecw/geotiff to a LOCUS-Format ?
What ist ther resaon that ecw and geotiff  is not supported?

supported formats of globalmatter: http://www.globalmapper.com/product/formats.htm
NO WAY to use LOCUS therfore - why?
  •  

Menion

#6
for most map format conversion should be working mapc2mapc program. So check it (also have some free version), if it works as you need
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

cantece

#7
Hello,
I checked MAPC2MAPC free. Works fine (ozi to Locus) but I still have the white margins of the map. Do you have an idea how to remove them?
  •  

gynta

#8
I have the same problem and i wait for a answere from the MAPC2MAPC-author now...

->

gynta

#9
good news & bad news:

Hi,
In the current version of the program, only the formats with individual tiles are made transparent.
I will change the next version (469) to do the same for SQLITE tile stores. I will Email you when it is ready - this week I hope.
But Locus may not understand transparency!
Regards,
John


@ menion:
 is there plan for the future to fix this?
 or is this not possible?

Menion

#10
Hi,
  I don't think that transparency change something here. Tiles are precisely defined areas (256x256) pixels, and I'm loading them one next to other. No overlays aren't allowed. So even if transparency will be working, there will still be white space below transparent pixels. This can only change if some overlay will be working in Locus (which was already requested here on forum but denied due to memory limitations of android devices ... but I'm not saying it's not solvable)
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

garrymoore

#11
hi  to all   forum.asamm.czers  this is my frst post and thought i would say  a big hello to yous  -  
 regards speak again  soon  
 g moore
  •