Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-03-2011, 10:57   #106
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,249
Re: map2kap - OziExplorer to OpenCPN

I have come across some ozi charts covering archipelago areas, all in scale 1:50000.
This little batch script worked beautifully.
Quote:
#!/bin/sh

for foo in *.jpg
do
./map2kap_0.1.11.rb $foo 50000 METERS MSL
done

mkdir KAP
mv *.kap KAP
I just sat back and enjoyed myself, and after a while there were around 30 charts ready to test in the KAP directory.
Why copy and paste when you don't have to?

Converting tifs:
If you have tif pics that you know that tif2bsb can handle just comment out line 219 in the code. That is change
Quote:
system("convert \"#{pic}\" -colors 127 \"#{pic_tif}\" 2>nul")
to
Quote:
#system("convert \"#{pic}\" -colors 127 \"#{pic_tif}\" 2>nul")
This will result in a slightly faster script.

Thomas
__________________

__________________
cagney is offline   Reply With Quote
Old 03-03-2011, 08:37   #107
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Cool!I've already done about 150charts (on a steep-and-rugged learning curve!)- but it looks like the last 50 will be a breeze with this help!
__________________

__________________
HappySeagull is offline   Reply With Quote
Old 03-03-2011, 11:04   #108
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

hmm.trying ...trying.My best effort so far is(laugh all you like!)
FOR %% IN (*.tif) DO map2kap *.tif /2500 /meters /MSL

but while it runs correctly through the correct amount of tifs and says "check your kap!" after each,it only actually outputs the first one as a kap...
__________________
HappySeagull is offline   Reply With Quote
Old 03-03-2011, 11:21   #109
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by HappySeagull View Post
hmm.trying ...trying.My best effort so far is(laugh all you like!)
FOR %% IN (*.tif) DO map2kap *.tif /2500 /meters /MSL

but while it runs correctly through the correct amount of tifs and says "check your kap!" after each,it only actually outputs the first one as a kap...
Try:
FOR %%I IN (*.tif) DO (map2kap %%~nI.tif /2500 /meters /MSL)

-dan
dacust is offline   Reply With Quote
Old 03-03-2011, 12:43   #110
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by dacust View Post
Try:
FOR %%I IN (*.tif) DO (map2kap %%~nI.tif /2500 /meters /MSL)

-dan
Wow!Thanks,Dan!I'm going to try that right now!...no,it says," %%I is unexpected at this time..."BUTYES!It works! as a ".bat" script!

I had just had a "lightbulb" moment and stole and edited Marcos' script for libbsb as in:

@echo off
for %%I IN (*.tif) DO (
echo converting %%~nI.tif
map2kap %%~nI.tif /25000 /meters %%~nI.kap
)
echo.
echo conversion complete
echo.
pause
and it worked too!as a ".bat" batch script that is.I've only done each once and things are a mess with text files all over the desktop...
Of course,I have no clue why it does ,or what "%%" and the other whatits are for....I hope marcos won't mind.
.
__________________
HappySeagull is offline   Reply With Quote
Old 03-03-2011, 15:59   #111
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by HappySeagull View Post
Wow!Thanks,Dan!I'm going to try that right now!...no,it says," %%I is unexpected at this time..."BUTYES!It works! as a ".bat" script!

I had just had a "lightbulb" moment and stole and edited Marcos' script for libbsb as in:

@echo off
for %%I IN (*.tif) DO (
echo converting %%~nI.tif
map2kap %%~nI.tif /25000 /meters %%~nI.kap
)
echo.
echo conversion complete
echo.
pause
and it worked too!as a ".bat" batch script that is.I've only done each once and things are a mess with text files all over the desktop...
Of course,I have no clue why it does ,or what "%%" and the other whatits are for....I hope marcos won't mind.
.
Marcos will be expecting royalties. But, no worries. I think he only charges $4.98 per chart attempt (whether it works or not).

-dan
dacust is offline   Reply With Quote
Old 04-03-2011, 10:08   #112
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Dacust,I used yours-worked a cert!
I'm going to try to learn something from yours....I thought of maybe trying to make a script that would ask for scale parameters before batching...but as it was,just dragging the same-scale sets into the working folder and editing the script to suit worked quick enough!

...typically,now that I'm all done,and an "expert",nothing more to convert! (I've got a little manual I wrote myself though,for next time!)
...I can see why Larger Brains like the command line...it's satisfying to see a computer actually working as a computer.
__________________
HappySeagull is offline   Reply With Quote
Old 04-03-2011, 11:26   #113
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

This works....kinda fun!
Dacust' script pecked by gull..

set /p scale= what is scale?
set /p depth= what are depth units?
FOR %%I IN (*.tif) DO (map2kap %%~nI.tif /%scale% /%depth% MSL)

...if there's another seagull flapping around out there,copy,paste into a text file and rename it .bat instead of .txt.
Put the mapfiles and images that have the same scale and depth units into the map2kap work folder with this script.Double click the batfile,hit "Enter" after you've typed "100000" or? and then after "meters" or?...
I 've only used it with 16-128 colour tif images so far...
it follows that MSL meansea level and map2kaps other inputs could also be batched the same?
__________________
HappySeagull is offline   Reply With Quote
Old 04-03-2011, 12:08   #114
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,249
Re: map2kap - OziExplorer to OpenCPN

Hey Happy, ...great.
...and your next assignment is to write your own version of kapview, using a .bat file.
Give it a go mate!

Thomas
__________________
cagney is offline   Reply With Quote
Old 04-03-2011, 12:45   #115
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Cagney,Yikes!...but sure ,that's good homework!
Oh,here's Seagull-PeckedDacustScriptFor Map2Kap,more elegant:
@echo off
set /p scale= what is scale?
set /p depth= what are depth units?
FOR %%I IN (*.tif) DO (map2kap %%~nI.tif /%scale% /%depth% MSL)
pause

because it's better to see the output from Map2kap.
__________________
HappySeagull is offline   Reply With Quote
Old 05-03-2011, 09:03   #116
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

...well,I got a bit distracted and created a roccoco version.It only works for tifs-..but this one handles spaces in names and cleans up after too.

TifOnly_SeagullShredsDacustMap2kapScript
@echo Put the mapfiles of similar scale in this workfolder or go do this now.I'll wait
echo .
@echo off
set /p depth= type depth units (meters or fathoms or feet?) Hit "Enter" after all inputs
set /p scale= type scale as in 1:10000 is 10000
FOR %%I IN ("*.tif") DO (map2kap "%%~nI.tif" /%scale% /%depth% /MSL)
SET /P M=Would you like to view ONE, ALL,or NONE of your new kaps now? Type "o" [ONE],"a" [ALL],OR "n" [NONE]Close viewer with Window's X If they do display badly,drag em onto bsbfix.[o?/n?/a?]
if %M%==o GOTO view
IF %M%==n GOTO moving
IF %M%==a GOTO viewall
:view
SET /P K=Type or paste the name of the kap to view...
kapview "%k%"
@echo .................................................
@echo Now,your fresh-baked files will be moved to convenient sub-folders.Go get more maps to convert!
pause
GOTO moving
:viewall
FOR %%I IN ("*.kap") DO (kapview "%%~nI.kap")
pause
:moving
MD KapsDone
MD OziMapsDone

I was able to make an all-image-type version but I just find imagemagick too slow compared to batch-converting images myself beforehand and,I tookMagick's "convert"out of the folder because map2kap calls it and it makes error messages...
__________________
HappySeagull is offline   Reply With Quote
Old 06-03-2011, 11:49   #117
Registered User

Join Date: Mar 2011
Posts: 3
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by cagney View Post
Here is my first version of a (semi) automatic tool for conversion of
OziExplorer charts to bsb charts.



map2kap will produce usable charts with just the mapfile and picturefile as arguments, but it is worthwhile to open the chart picture and get some basic information:
The chart scale.
Sounding units - for example METERS or FATHOMS
Sounding Datum for example LAT,lowest astronomical tide.
Information is often available on the chart for applying corrections to the chart to agree with WGS84, Reverse the signs! This may be included in the map file, but not always.

The PP is handled by map2kap by averaging lat for mercs and long for tmercs.
Ozi separates REFs and PLYs, I have chosen to include all the ozi PLYs as REFs as well, as the geo referencing info is there.
Most picture formats are handled, but not always in the most efficient way, especially if the picture already is a tif.

An example


Here I'm converting the Uruguayan chart ROU3. Chart scale is 1:30,000, soundings in meters and the datum for soundings is the mean sea level. There is no information available about the Geodetic Datum.When the script has finished, there is a kap file available with the same name as the map&picture file.

Dependencies: ruby, libtif, libbsb, ImageMagic
For this version of map2kap to work on windows you probably need cygwin installed.

I'm looking for Ozi charts that are Transverse Mercator, also chart that actually contains WGS84 corrections.

Feedback, as always, welcome

Thomas
Hi, Attilio new user. Also new user of OpenCPN, coming from OziExplorer. I use Win7 and I have all Male Karte, the official charts of Dalmatia/Croatia. It is not clear to me how to use map2kap in windows. Please be patient and explain me.
My private email is Asiviero (@) gmail (dot) com Thanks a lot
__________________
asiviero is offline   Reply With Quote
Old 06-03-2011, 13:52   #118
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Here's a better one...I made a mistake-not crucial (nor suprising)-per unneeded slashes:
FOR %%I IN ("*.tif") DO (map2kap "%%~nI.tif" /%scale% /%depth% /MSL)
...these slashes show up in the kap header and the charts don't get organized as to scale in OpenCPN.
Also,added the ability to input DepthDatum per MSL,LLW,or whathave you...
and more quotes!these do work to use names with spaces on the ones I've tested(yes,Ellagaroo,-it's still sinking in..)
by the way,actually,if you don't "enter" anything,anywhere,map2kap still outputs kaps....but not as good
BestSeagullShredsDacustBatch.doc
__________________
HappySeagull is offline   Reply With Quote
Old 06-03-2011, 14:26   #119
Registered User
 
HappySeagull's Avatar

Join Date: Dec 2010
Location: B.C.,Canada
Boat: 29'
Posts: 2,395
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by asiviero View Post
Hi, Attilio new user. Also new user of OpenCPN, coming from OziExplorer. I use Win7 and I have all Male Karte, the official charts of Dalmatia/Croatia. It is not clear to me how to use map2kap in windows. Please be patient and explain me.
My private email is Asiviero (@) gmail (dot) com Thanks a lot
Hi,aiviero.

As you know,Ozi can autoread chart files and then writes it's own ".map"
file where it stores information about the chart.Ozi can also be used to calibrate a picture of a chart.So,two files are always needed for Ozi:the map file + chart file or the map file+picture file.
That is the first important question....which have you?

Example:if you open one of OZI's ".map" files in a text reader,what file is mentioned about here(in red)...

"OziExplorer Map Data File Version 2.1
Chatham_antarcticridge
Chatham_AntarcticRidge.tif
1 TIFF scale factor
NAD83etc...
This map file refers to a picture file,a "tif".What do yours refer to?

I don't know much about Male Karte charts.Do you?Most charts are specialized picture files with a header added on ...
__________________
HappySeagull is offline   Reply With Quote
Old 07-03-2011, 03:46   #120
Registered User

Join Date: Mar 2011
Posts: 3
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by HappySeagull View Post
Hi,aiviero.

As you know,Ozi can autoread chart files and then writes it's own ".map"
file where it stores information about the chart.Ozi can also be used to calibrate a picture of a chart.So,two files are always needed for Ozi:the map file + chart file or the map file+picture file.
That is the first important question....which have you?

Example:if you open one of OZI's ".map" files in a text reader,what file is mentioned about here(in red)...

"OziExplorer Map Data File Version 2.1
Chatham_antarcticridge
Chatham_AntarcticRidge.tif
1 TIFF scale factor
NAD83etc...
This map file refers to a picture file,a "tif".What do yours refer to?

I don't know much about Male Karte charts.Do you?Most charts are specialized picture files with a header added on ...
BELOW AN EXAMPLE OF A .MAP FILE CONTENT:

__________________________________________________ ______
OziExplorer Map Data File Version 2.1
01-trscanski zaljev.tif
D:\Karte-Jadran\01-Trscanski zaljev.tif
1 TIFF scale factor
WGS 84,WGS 84, 0.0000, 0.0000,WGS 84
Reserved 1
Reserved 2
Magnetic Variation,,45,E
Map Projection,Mercator,PolyCal,No,AutoCalOnly,No,BSBU seWPX,No
Point01,xy, 552, 1044,in, deg, 45, 40.0000,N, 13, 30.0000,E, grid, , , ,N
Point02,xy, 1574, 2501,in, deg, 45, 30.0000,N, 13, 40.0000,E, grid, , , ,N
Point03,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point04,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point05,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point06,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point07,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point08,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point09,xy, , ,in, deg, , ,N, , ,E, grid, , , ,N
Point10,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point11,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point12,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point13,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point14,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point15,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point16,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point17,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point18,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point19,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point20,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point21,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point22,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point23,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point24,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point25,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point26,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point27,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point28,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point29,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Point30,xy, , ,in, deg, , ,N, , ,W, grid, , , ,N
Projection Setup,,,,,,,,,,
Map Feature = MF ; Map Comment = MC These follow if they exist
Track File = TF These follow if they exist
Moving Map Parameters = MM? These follow if they exist
MM0,Yes
MMPNUM,4
MMPXY,1,0,0
MMPXY,2,2434,0
MMPXY,3,2434,3434
MMPXY,4,0,3434
MMPLL,1, 13.409980, 45.785784
MMPLL,2, 13.806915, 45.785784
MMPLL,3, 13.806915, 45.393012
MMPLL,4, 13.409980, 45.393012
MM1B,12.703098
MOP,Map Open Position,0,0
IWH,Map Image Width/Height,2434,3434
__________________________________________________ ________

ACTUALLY I HAVE ALL .TIF AND .MAP FILES FOR CROATIAN COAST, THE OFFICIAL ONES (CALLED "MALE KARTE" IN CROATIAN LANGUAGE).

I UNDESTAND THAT IT IS ONLY A MATTER TO LAUCH YOUR BATCH FILE IN ORDER TO HAVE THE CONVERSION TO BSB CHARTS? SHOULD I DOWNLOAD AN AMENDED VERSION OF MAP2KAP?

Thanks a lot

Attilio
__________________

__________________
asiviero is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Portable OpenCPN zemaria OpenCPN 12 05-07-2010 05:34
I Have a Few Questions Regarding OpenCPN Skua OpenCPN 1 03-06-2010 23:24
OpenCPN bdbcat OpenCPN 1343 19-09-2009 16:59
OziExplorer phiggins Navigation 2 27-06-2009 14:43



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 16:09.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.