Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 21-04-2013, 04:48   #151
Registered User

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

The projection of your maps are NZTM2000, a version of UTM.
map2kap probably don't recognize this and treats the charts as a Mercator. To really know, I have to see the text header of your kap file.

Try to change the GD value to UTM, and make sure the PP value is the mid longitude.

See Chart Conversion Manual | Official OpenCPN Homepage for the details.

Thomas
__________________

__________________
cagney is offline   Reply With Quote
Old 21-04-2013, 13:31   #152
Registered User

Join Date: Apr 2013
Posts: 4
Re: map2kap - OziExplorer to OpenCPN

Thanks for the reply.

I've uploaded some sample files here...

mediafire.com/?ll1xnuo454zvr76

I was unable to upload here due to file size and extension issues.
The header reads...

! 2011 imgkap 1.11 - at 18/04/2013 from Ada Flat (BT24).TIF
! Converted Ozi Explorer .map file
! Converted with map2kap Version 0.2.22
VER/3.0
BSB/NA=Ada Flat (BT24)
NU=1
RA=5671,8505,DU=
KNP/SC=50000,GD=NZGD2000,PR=MERCATOR
PP=-42.307777,PI=UNKNOWN,SP=UNKNOWN,SK=0.0
UN=METERS,SD=UNKNOWN,DX=000,DY=000

After I converted the charts I tried changing NZGD2000 to WGS84 in the header but this didn't help. Do you think it needs to be changed BEFORE converting the files.

Just to confirm, do you mean to change the GD to "UTM" or PR to "UTM"?

Also, please excuse my ignorance but not sure what you mean by "make sure the PP value is the mid longitude".

I'll take a look at the link you have provided. I may be out of my depth

Thanks
__________________

__________________
inspectaclueso is offline   Reply With Quote
Old 21-04-2013, 14:03   #153
Registered User

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

Map2kap is not intended to be able to handle these maps. It's geared at common nautical charts. Having said that, it's probably not a problem to display them with the correct settings. To be sure, it would help to see the map file as well.
Quote:
Just to confirm, do you mean to change the GD to "UTM" or PR to "UTM"?
Good catch I meant PR, not GD in my first post.

After having a look at the charts again and at your post, I suggest to change
GD=WGS84
PR=TRANSVERSE MERCATOR
PP= longitude of the middle of the chart.

Use a text editor to do the changes, and run "bsbfix" afterwards.
This requires the installation of "libbsb", so it's not altogether straight forward.

Thomas
__________________
cagney is offline   Reply With Quote
Old 22-04-2013, 02:36   #154
Registered User

Join Date: Jul 2011
Location: Southern Germany
Boat: Crisline 530
Posts: 33
Re: map2kap - OziExplorer to OpenCPN

For those files that convert without errors or warnings, but display stangely, I have no further clue beyond what Thomas already posted.

As for the conversion warnings and errors, let me first verify some assumptions:
  1. You have been drag&dropping an image file to the map2kap shortcut on your desktop
  2. A .map file with the same base name exists in the same folder as the image file
  3. For whatever reason, the .map file refers to a different image file than the one you were originally drag&dropping
You can verify this last assumption, by opening the .map file in a text editor. Once these three assumptions are verified, we can move on...

You can also try drag&dropping the .map file instead of the image file and see what happens...

The error message "internal GetPalette" comes from imgkap.c, which is not my code (I have been writing only the script around it). It happens when the function HistGetPalette unexpectedly returns 0 instead of a valid number of colors. The most likely reason for this to happen (without additional error message) is a corrupt image file. Which brings me back to taking the first warning message serious and get rid of it, before looking at follow-up errors...
__________________
hyman is offline   Reply With Quote
Old 23-04-2013, 03:40   #155
Registered User

Join Date: Apr 2013
Posts: 4
Re: map2kap - OziExplorer to OpenCPN

Thanks for the reply.

Yes, for the most part I've been dragging a .tif file to convert. It gives the image differs error but defaults to look in the same folder and converts.

However if I dragged the .map file it could not find the image file despite the name of the .tif file being the same as the .map file and both being in the same folder. When inspecting the header it had an absolute file path to the image that was correct but I've since change to the file name only (as it will be in the same folder) and now I can drag the .map file successfully without error.

When I previously converted the whole lot of charts I ran from CMD prompt and don't recall any errors which is odd?

I'm now in the process of opening all 400 odd .map files to change the image path.

I'll then try convert some of the charts I had "internal GetPalette" errors with. Like you say, perhaps the image file is corrupt?

Thanks to everyone so far for their input.
__________________
inspectaclueso is offline   Reply With Quote
Old 24-04-2013, 20:04   #156
Registered User

Join Date: Apr 2013
Posts: 4
Re: map2kap - OziExplorer to OpenCPN

I've finished editing all the .map files so the .tif files does not have an absolute file path. I also found that there was a double space where there should have been a single space so used TextCrawler to edit that.

All but two of the 400 odd maps converted successfully. The two gave the GetPallette error and about 5 or 6 gave a warning about Transverse Mercator projection but converted all the same.

I then changed from NZDTM2000 to WGS84 and Mercator to Transverse Mercator but I still have the same issue.

Would someone with more experience be interested in taking on this project and I could pay for there time. It might be quite simple for someone who has mastered the art.

The source files are good. They were purchased from OziExplorer an I've used them on navigators running OziExplorer so it must be an issue with the conversion.

Anyway, if someone is interested please let me know.

Cheers
__________________
inspectaclueso is offline   Reply With Quote
Old 26-04-2013, 11:37   #157
Registered User

Join Date: Jul 2011
Location: Southern Germany
Boat: Crisline 530
Posts: 33
Re: map2kap - OziExplorer to OpenCPN

As I said, the "internal GetPalette" error "internal GetPalette" comes from imgkap which I haven't written and therefore have very limited understanding of. Maybe the author can help with this, if you supply him some example files. On his website, he writes:
If you have comments, e-mail the Webmaster
__________________
hyman is offline   Reply With Quote
Old 27-04-2013, 14:38   #158
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 hyman View Post
As I said, the "internal GetPalette" error "internal GetPalette" comes from imgkap which I haven't written and therefore have very limited understanding of. Maybe the author can help with this, if you supply him some example files. On his website, he writes:
If you have comments, e-mail the Webmaster
The Link you post above is me. But I did not write imgkap. I just have a link on my website so he could post his code there.

On that page (which you link in your post) the very first link is for the forum where you can get support. Which is, funny enough, a thread in this very forum we are in.

Imgkap - kap File Converter Tool

The webmaster link is only for comments about the web page.

-dan
dacust is offline   Reply With Quote
Old 28-04-2013, 13:58   #159
Registered User

Join Date: Jul 2011
Location: Southern Germany
Boat: Crisline 530
Posts: 33
Re: map2kap - OziExplorer to OpenCPN

Hi Dan,

sorry for mixing this up, thanks for clarifying.

Regards

Horst
__________________
hyman is offline   Reply With Quote
Old 28-04-2013, 14:07   #160
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

Horst,

Hey, between the two of us we got them headed in the right direction. Thanks!

-dan
dacust is offline   Reply With Quote
Old 04-05-2013, 01:13   #161
Registered User

Join Date: Jul 2011
Location: Southern Germany
Boat: Crisline 530
Posts: 33
Re: map2kap - OziExplorer to OpenCPN

Hi all,

this is to announce version 0.3.00, which contains some bugfixes recently discussed, and small updates to the documentation.

For those of you who haven't used map2kap before, here are the installation instructions for Windows XP:
  1. Download the current version of the Ruby programming language
  2. Create a new folder "Chart Tools" in "C:\Program Files\"
  3. Download imgkap.exe and place it into "C:\Program Files\Chart Tools".
  4. Download map2kap.zip and unzip. Place both contained files map2kap.rb (the actual conversion tool) and map2kap.bat (the drag&drop companion) into "C:\Program Files\Chart Tools", too.
  5. "Copy" the batch file map2kap.bat and "Paste shortcut" on the Desktop (or any other place that you like for drag&drop).
  6. Open Start -> Control Panel -> System. Click the "Advanced" tab, and then the button "Environment Variables".
  7. In the area "System Variables", select the variable "Path" and click the button "Edit". Append ";C:\Program Files\Chart Tools" (without the quotes, but with the semicolon at the beginning!) to the "Variable value".
  8. Finalize the change by clicking "OK" three times through the different dialogs. Close the Control Panel.
  9. Double-click map2kap on the desktop. A new window should appear, showing brief usage information for map2kap.
Installation on other versions of Windows is similar. Users of Linux or Mac OS will need to compile imgkap themselves (out of scope for this description). For them, map2kap.bat is not used. Still at least for Linux there is a way to enable drag&drop (see post #143 above).

How to use

In order to create a BSB/KAP file from an Ozi MAP, you always need a pair of source files:
  • A picture file (for example .jpg, .png oder .tif)
  • A Calibration file ending in .map
Both of these need to be stored in the same folder. Conversion can be started either of two ways:
  • Open a command prompt. cd into the folder containing the source files. Start map2kap.rb with the required command line parameters. (Without any parameters map2kap.rb shows brief usage information.)
  • If no other parameters are needed besides the file name(s), you can also drag&drop files onto the map2kap Desktop symbol.
Either way, map2kap informs about progress and potential problems during conversion. Converted BSB/KAP files are placed into the same folder that contains the source files.

Unfortunately, the ZIP files of FreieTonne Charts that I used to refer to in previous posts are no longer available.

Have fun

Horst
__________________
hyman is offline   Reply With Quote
Old 04-05-2013, 02:33   #162
Registered User

Join Date: Jul 2011
Location: Southern Germany
Boat: Crisline 530
Posts: 33
Re: map2kap - OziExplorer to OpenCPN

Since I am moving to a new Laptop that has Windows 7, I have done the installation on Windows 7 for the first time. Here is how it differs from Windows XP:
  • You can safely use Ruby 2.0.0 instead of 1.9.2
  • You may want to install Ruby under "Program Files" rather than in the default location the installer offers (the root directory of your system drive)
  • Make sure you tick the following options during the Ruby install:
    • Add Ruby executables to your PATH
    • Associate .rb and.rbw files with this Ruby installation
  • In the Windows 7 Control Panel, you can edit the PATH under "System" (or easily find the right place by searching for "environment")
Keep converting charts, sailing & cuising ...


Horst
__________________
hyman is offline   Reply With Quote
Old 05-08-2013, 15:28   #163
Registered User

Join Date: Aug 2013
Posts: 2
Post Re: map2kap - OziExplorer to OpenCPN

Did some linux scripts to automate the process of converting many map fragments at once.

Can be downloaded from here:
http://www.blixth.se/seacharts/convert.zip
File contains 4 files:
map2kap.rb
remove_white.sh
convert.sh
README.txt
You have to install 'libbsb', 'libtiff4-dev' and 'imagemagick' manually

Code looks as following, and may be abit clumsy written, I'm no linux script master, but it works


Code:
#		*** Map to Kap Batch Converter ***
#	** MAKE SURE map2kap.rb IS IN THE SAME FOLDER 	**
#	** Make sure script has propper privileges  	**
#	** i.e `chmod u+x convert.sh` 			**
#
#	Contact: Johan (at) Blixth .se
#
#
#	Since I've been using Mobile Atlas Creator (MOBSC) to rip chart
#	information. I've ended up with quite alot of small map
#	fragments that needs to be converted.
#
#	The naming convention I've been having from MOBAC is the following
#
#		AtlasName Zoomlevel MapFragment
#	ie	baltic sea 15 (066).png
#	ie	baltic sea 15 (066).map
#
#
#	This script does not remove whitespace from filename, 
#	I have another script that does that. And I'd recommend
#	eiter replace spaces with underscores `_` or remove them
#	all together, or map2kap.rb wont parse the full filename.
#
#	This script does two things at the moment, since my naming
#	convention has been the first 2 numbers in the filenames are
#	MOBAC zoom level, I extract those, and use for scale. Second
#	it passes filename and flags to map2kap.
#
#	it Defaults to searching for png files, using METERS for soundings
#	and can easily be changed below

SOUNDINGS="METERS"
FILETYPE=*.png

for f in $FILETYPE #Parse through all files of FILETYPE
	do
		TMP=`echo ${f//[^0-9]/}` #TMP file keeping all Numbers from Filename
		SCALE=`echo ${TMP:0:2}`  #SCALE only takes the very first 2 numbers from TMP
		FILENAME=`echo "$f" #| cut -d'.' -f1` #FILENAME self explanatory
		echo "./map2kap.rb \"$FILENAME\" "$SCALE" "$SOUNDINGS"" #Show map2kap.rb command
		./map2kap.rb "$FILENAME" "$SCALE" "$SOUNDINGS" #Run map2kap.rb script
	done
Code:
#		*** CHANGE WHITESPACE TO UNDERSCORE ***
#
#		Simple Script to change all filenames in current folder
#		to having underscores instead of whitespaces
#
#		contact: Johan (at) Blixth .se

for file in *\ *; do mv "$file" "${file// /_}";
done
Hope it helps someone // Blixth
__________________
Blixth is offline   Reply With Quote
Old 12-08-2013, 02:03   #164
Registered User

Join Date: Aug 2013
Posts: 7
Re: map2kap - OziExplorer to OpenCPN

Hi, new forum member here enjoying the map2kap conversion program.

I managed well to convert my marine ozi .map files, but the resulting .kap files are calibrated off around 200 m too much to east. So it seems that that the chart datum is problem. The charts GD is originally WGS84 but after conversion to ozi's .map file the line 5 starts with "Finland Hayford", which was the old finnish calibration system. This difference is excactly explaining the offset of calibration. Still, the .map files are perfectly calibrated to real world when using Ozi, I have used these for years so I am sure .

Next I tried to change this "Finnish Hayford" in .map file line 5 to "Universal Transverse Mercator" or "WGS 84" but still the resulting .kap files were off excactly as before.

To get more puzzling, at least one of the "Finnish Hayford" converted .kap files behaved strangely in OpenCPN; when opened, it was off as usual but after couple of seconds moved to perfectly correct place. I could repeat this several times, but now even this map seems to be constatly off.

Hopefully someone can solve this challange and pinpoint me the correct way.
__________________
TechNeck is offline   Reply With Quote
Old 12-08-2013, 04:58   #165
Registered User

Join Date: Aug 2013
Posts: 7
Re: map2kap - OziExplorer to OpenCPN

Quote:
Originally Posted by TechNeck View Post
Hi, new forum member here enjoying the map2kap conversion program...
New note; when using chart in single mode (non-quilting, F9), I see it moving to excactly correct place. Returning to map combos (quilting mode) the chart is offset again... is this bug or is it me???

__________________

__________________
TechNeck 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 09:32.


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.