Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 2.00 average. Display Modes
Old 05-10-2009, 06:53   #61
Registered User

Join Date: Aug 2009
Posts: 54
Quote:
Originally Posted by dacust View Post
To write a "simple" georeference utiity, Dave would have to go through some of the same things we are going through. What formats would it accept? Then how to convert those formats to something OpenCPN could use, then how to georeference.

That is all we are doing. Figuring out how to georeference .tiffs. And the method we are using is to georeference and generate a .kap which OpenCPN already uses.

If a simple georeference is provided for OpenCPN, I might still not use it, as I have a large number of aerial photos I want to use. They are already georeferenced, just not in a way OpenCPN can use. So, this exercise is getting me close to a way to convert them all in batch. It would be rather painful to use a screen to one-by-one convert thousands of photos.

What you see going on here is what developers go through all the time when doing something new. Also, for me, this is fun. I'm, having a blast delving into areas that are very far outside my work experience. Different platforms, different operating systems, different languages and a totally different set of geo problems.

In the end, we may have a solution. Or we may have a companion tool for OpenCPN users. Or we may have some ideas Dave can use. Who knows. It's research.

In other words, this is a very normal part of software development.

-dan
Dan,

Good points, especially if it's fun for you. However, the task of producing a calibration utility can be simplified - just use SeaClear's, then it seems to me the only issue is OpenCPN supporting SeaClear's WCI charts.........
Would that be difficult?

/David
__________________

__________________
kiwiradical is offline   Reply With Quote
Old 05-10-2009, 07:30   #62
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
The newly created nz53a.kap chart did not display in OpenCPN and also on further inspection of the header,only the first 4 lines were added:

IFM/3
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255

I had used the header in your previously converted nz53.kap file but it was severely curtailed in the conversion process. Why?

I received the following error message in the command screen:
Attached Thumbnails
Click image for larger version

Name:	COMMANDLINE-2.jpg
Views:	183
Size:	51.0 KB
ID:	10313  
__________________

__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 07:30   #63
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Quote:
Originally Posted by kiwiradical View Post
Dan,

Good points, especially if it's fun for you. However, the task of producing a calibration utility can be simplified - just use SeaClear's, then it seems to me the only issue is OpenCPN supporting SeaClear's WCI charts.........
Would that be difficult?

/David
Only problem is, you are still stuck using the charts only in either Seaclear or OpenCPN.

If the idea is only to provide a functionality to OpenCPN, then you may be right.

So, the question might be, is it easier to provide a way to calibrate charts for a format OpenCPN already supports, or add support for a new format? Dave might be able to answer that. Then again, he might have to go through a lot of experimentation similar to what we have before he will know.

Another point is, right now Dave is working on other stuff, while we are over here trying to hash this out. If he wants to support another format, he is probably on his own, as I, for one, can't help.

This is how open source works. People often go off on other tacks. Sometimes they pan out, sometimes they don't. In the end, we may have several solutions to choose from. Some would say all the options that don't get used were wasted time. Some would say if they weren't all tried, the best one wouldn't have been found. Open source is inefficient in some ways. Kinda like the infinite monkeys trick. But in the end, it works.

As they say, "Hey, it's all good". We're all having fun and we're not wasting any employer's money. And who knows, we might come up with something.

-dan
dacust is offline   Reply With Quote
Old 05-10-2009, 07:34   #64
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Quote:
Originally Posted by sinbad7 View Post
The newly created nz53a.kap chart did not display in OpenCPN and also on further inspection of the header,only the first 4 lines were added:

IFM/3
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255

I had used the header in your previously converted nz53.kap file but it was severely curtailed in the conversion process. Why?

I received the following error message in the command screen:
Post the header.kap. I think something is wrong in there... It looks like it didn't use it at all. The RGB lines are created by the tif2bsb, so I don't think it used anything at all from your header file.

-dan
dacust is offline   Reply With Quote
Old 05-10-2009, 08:58   #65
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
dan

This is the command line I used:

tif2bsb -c 4 header.kap nz53.tif nz53a.kap

This is the header file I used:

NZ53.kap 000644 001750 001750 00025246555 11260426642 010505 0 ustar 00 000000 000000 BSB/NA=NZ53
NU=51,RA=12536,8633,DU=300
KNP/SC=200000,GD=WGS84,PR=MERCATOR
PP=0.000,PI=UNKNOWN,SP=UNKNOWN,SK=0.0
UN=METERS,SD=LAT,DX=000,DY=000
CED/SE=2009,RE=12,ED=27/09/2009
OST/1
REF/1,472,8160,-37.0833,174.3333
REF/2,472,475,-35.8333,174.3333
REF/3,12064,475,-35.8333,176.6667
REF/4,12064,8160,-37.0833,176.6667
PLY/1,-37.0833,176.6667
PLY/2,-37.0833,174.3333
PLY/3,-35.8333,174.3333
PLY/4,-35.8333,176.6667
IFM/7
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255
RGB/5,60,190,217
RGB/6,197,235,244
RGB/7,98,171,116
RGB/8,246,200,110
RGB/9,185,150,83
RGB/10,160,143,227
RGB/11,183,172,244
RGB/12,160,120,186
RGB/13,128,128,128
RGB/14,224,127,255
RGB/15,167,113,11
RGB/16,30,95,108
RGB/17,0,0,0
RGB/18,0,0,0
RGB/19,0,0,0
RGB/20,0,0,0
RGB/21,0,0,0
RGB/22,0,0,0
RGB/23,0,0,0
RGB/24,0,0,0
RGB/25,0,0,0
RGB/26,0,0,0
RGB/27,0,0,0
RGB/28,180,130,170
RGB/29,192,192,192
RGB/30,0,0,0
RGB/31,83,56,5
RGB/32,45,138,163
RGB/33,255,0,0
RGB/34,0,255,0
RGB/35,0,0,255
RGB/36,0,255,255
RGB/37,255,0,255
RGB/38,255,255,0
RGB/39,0,0,0
RGB/40,0,0,0
RGB/41,0,0,0
RGB/42,0,0,0
RGB/43,0,0,0
RGB/44,0,0,0
RGB/45,64,64,64
RGB/46,0,0,0
RGB/47,0,0,0
RGB/48,0,0,0
RGB/49,0,0,0
RGB/50,0,0,0
RGB/51,0,0,0
RGB/52,0,0,0
RGB/53,0,0,0
RGB/54,0,0,0
RGB/55,0,0,0
RGB/56,0,0,0
RGB/57,0,0,0
RGB/58,0,0,0
RGB/59,0,0,0
RGB/60,0,0,0
RGB/61,0,0,0
RGB/62,0,0,0
RGB/63,0,0,0
RGB/64,0,0,0
RGB/65,0,0,0
RGB/66,0,0,0
RGB/67,0,0,0
RGB/68,0,0,0
RGB/69,0,0,0
RGB/70,0,0,0
RGB/71,0,0,0
RGB/72,0,0,0
RGB/73,0,0,0
RGB/74,0,0,0
RGB/75,0,0,0
RGB/76,0,0,0
RGB/77,0,0,0
RGB/78,0,0,0
RGB/79,0,0,0
RGB/80,0,0,0
RGB/81,0,0,0
RGB/82,0,0,0
RGB/83,0,0,0
RGB/84,0,0,0
RGB/85,0,0,0
RGB/86,0,0,0
RGB/87,0,0,0
RGB/88,0,0,0
RGB/89,0,0,0
RGB/90,0,0,0
RGB/91,0,0,0
RGB/92,0,0,0
RGB/93,0,0,0
RGB/94,0,0,0
RGB/95,0,0,0
RGB/96,0,0,0
RGB/97,0,0,0
RGB/98,0,0,0
RGB/99,0,0,0
RGB/100,0,0,0
RGB/101,0,0,0
RGB/102,0,0,0
RGB/103,0,0,0
RGB/104,0,0,0
RGB/105,0,0,0
RGB/106,0,0,0
RGB/107,0,0,0
RGB/108,0,0,0
RGB/109,0,0,0
RGB/110,0,0,0
RGB/111,0,0,0
RGB/112,0,0,0
RGB/113,0,0,0
RGB/114,0,0,0
RGB/115,0,0,0
RGB/116,0,0,0
RGB/117,0,0,0
RGB/118,0,0,0
RGB/119,0,0,0
RGB/120,0,0,0
RGB/121,0,0,0
RGB/122,0,0,0
RGB/123,0,0,0
RGB/124,0,0,0
RGB/125,0,0,0
RGB/126,0,0,0
RGB/127,0,0,0

And yes,you are right, it looks like it did not use it at all,but why not?
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 10:23   #66
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,250
Sinbad
Try this command:
tif2bsb -c 127 header.kap nz53.tif nz53a.kap

Also a few issues with your template file, a lot of "garbage" there.
The formatting is very important, I don't know if is displayed correctly. Please use the # button an the CODE tags to keep formatting. This is how I would write "header.kap"
Code:
BSB/NA=NZ53
    NU=51,RA=12536,8633,DU=300
KNP/SC=200000,GD=WGS84,PR=MERCATOR
    PP=0.000,PI=UNKNOWN,SP=UNKNOWN,SK=0.0
    UN=METERS,SD=LAT,DX=000,DY=000
CED/SE=2009,RE=12,ED=27/09/2009
OST/1
REF/1,472,8160,-37.0833,174.3333
REF/2,472,475,-35.8333,174.3333
REF/3,12064,475,-35.8333,176.6667
REF/4,12064,8160,-37.0833,176.6667
PLY/1,-37.0833,176.6667
PLY/2,-37.0833,174.3333
PLY/3,-35.8333,174.3333
PLY/4,-35.8333,176.6667
IFM/7
Note that this is slightly different from my post #5
When a line is longer than 80 characters you have to continue on a new line. This new line must start with 4 spaces.

Error messages from #62.
I get these error messages as well from some of the nz files.
They are not show-stoppers, I still get a usable .kap file that displays alright.

Thomas
__________________
cagney is offline   Reply With Quote
Old 05-10-2009, 11:10   #67
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
Thomas

I used your header file and command line as shown in your #66 and created nz53b.kap.
The resulting header is full size but the nz53b.kap chart does not show up in OpenCPN.
I have placed the file in my dropbox if you would like to inspect it.
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 11:56   #68
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,250
Quote:
Originally Posted by sinbad7 View Post
Thomas

I used your header file and command line as shown in your #66 and created nz53b.kap.
The resulting header is full size but the nz53b.kap chart does not show up in OpenCPN.
I have placed the file in my dropbox if you would like to inspect it.
For some reason, your .kap file is missing all lines above
IFM/7. The lines in my post above should all be there in the finished .kap file.
How did you manage to do that???
I hope you are using a "pure" text editor and not "words or a similar word processor ???

Thomas
__________________
cagney is offline   Reply With Quote
Old 05-10-2009, 12:37   #69
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
I am using the Notispad only.

Have no idea why your header was not included in the final .kap file
I am following your instructions EXACTLY..

Later I will test the whole thing out on my desktop running under XP Pro to see if it makes any difference. Don't forget we are using different versions of libbsb,mine for Win XP.
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 13:36   #70
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
Thomas..

Tried the same conversion on my desktop XP with even worse results. No header at all and many blanks in the rest of the code. Doesn't look like it's possible at all...

How about trying to convert the nz5322 for me if you have the time. Probably quicker if you download it direct from the NZ Govt website. Thanks..
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 13:42   #71
Registered User
 
jonasaberg's Avatar

Join Date: Jul 2008
Location: Kristiansand, Norway
Boat: Wasa 410
Posts: 305
Partial success;

So my attempt trying to be consistent:
Using nz53.tif (12538*8634 pixel, 300dpi)
and the template file by Cagney

I named the file nz53.txt. The suffix change to .txt does not matter and we don't have the confusion between template *.kap files and real calibrated finalized caps.
*******
BSB/NA=NZ53
NU=51,RA=12536,8633,DU=300
KNP/SC=200000,GD=WGS84,PR=MERCATOR
PP=0.000,PI=UNKNOWN,SP=UNKNOWN,SK=0.0
UN=METERS,SD=LAT,DX=000,DY=000
CED/SE=2009,RE=12,ED=27/09/2009
OST/1
REF/1,472,8160,-37.0833,174.3333
REF/2,472,475,-35.8333,174.3333
REF/3,12064,475,-35.8333,176.6667
REF/4,12064,8160,-37.0833,176.6667
PLY/1,-37.0833,176.6667
PLY/2,-37.0833,174.3333
PLY/3,-35.8333,174.3333
PLY/4,-35.8333,176.6667
IFM/7
*******

And then, in my system, i write the command and get the output:
C:\kap>tif2bsb nz53.txt nz53.tif nz53.kap
TIFFReadDirectory: Warning, nz53.tif: unknown field with tag 33550 (0x830e) encountered.
TIFFReadDirectory: Warning, nz53.tif: unknown field with tag 33922 (0x8482) encountered.

-In MapCalII/Seaclear I get the error: Error when reading c:\kap\nz53.kap
-In OpenCPN i get no response.

To make sure nothing old was interfering I uninstalled OpenCPN, checked that the .../Application/OpenCPN folder with the log file and config.ini was erased and reinstalled v1.3.4.
The log file says:

***
18:44:32: Search directory: C:\kap for *.KAP
18:44:32: Create ChartTable Entry for C:\kap\nz53.kap
18:44:32: CreateChartTableEntry() failed for file: C:\kap\nz53.kap
18:44:32: Create ChartTable Entry for C:\kap\nz53.kap
18:44:32: CreateChartTableEntry() failed for file: C:\kap\nz53.kap
***

After a lot of trials I found an error in the template. The second line starting with NU=51 has to be in the end of the first line. It is allowed to let it continue on the second row and IF you add four blanks in the beginning of the second row the resulting kap (after using tif2bsb) works in OpenCPN.

Example:
Like this with a long first line. (adding four blanks does not show here due to the html formating here, but try it!):
*****
BSB/NA=NZ53 Bream Head to Slipper Island NU=51,RA=12536,8633,DU=300
KNP/SC=200000,GD=WGS84,PR=MERCATOR
PP=0.000,PI=UNKNOWN,SP=UNKNOWN,SK=0.0
UN=METERS,SD=LAT,DX=0,DY=0
CED/SE=2009,RE=12,ED=27/09/2009
OST/1
REF/1,472,8160,-37.0833,174.3333
REF/2,472,475,-35.8333,174.3333
REF/3,12064,475,-35.8333,176.6667
REF/4,12064,8160,-37.0833,176.6667
PLY/1,-37.0833,176.6667
PLY/2,-37.0833,174.3333
PLY/3,-35.8333,174.3333
PLY/4,-35.8333,176.6667
IFM/7
****

The generated kap shows ok in OpenCPN and the title shows nicely in the chart info window in OpenCPN.

However:
It does NOT work in Seaclear and that makes me really suspicious: All other BSB/KAP files I have works perfect in MAPCAL/Seaclear. This makes it possible to open a *.kap in MapCalII and check the calibration with the excellent tools that draws latitudes and longitudes acording to the calibration information in the file and compare that to the image in the file. This is a great feature to be able to check:
1. If you placed the calibration points correctly.
2. If you should add extra points for increased accuracy
3. Whether you picked the correct projection.

Well, I hope this makes it possible for some other to investigate what cause the error in the generated kap file.

I also tried to fiddle with a lot of other stuff by comparing other kap-file headers with the nz53.txt header and found that:

-Dx and Dy is usually set to real values (= distance per pixel in x and y direction) and not left empty
-SD=MEAN LOW WATER in my other files

also in my other BSB/Kap files all lines start with three letters a slash and then a list of variables and parameters
examples:
BSB/NA=51
KSP/SC=250000
VER/1.0
REF/1,
PLY/1

In the template file i started with this is not so... so i think all lines not starting with a three letter+/ should probably be seen as the former line being continued and should have four blanks in the start.

/Jonas
__________________
jonasaberg is offline   Reply With Quote
Old 05-10-2009, 13:45   #72
Registered User
 
jonasaberg's Avatar

Join Date: Jul 2008
Location: Kristiansand, Norway
Boat: Wasa 410
Posts: 305
Oops!
Sorry, missed some posts about the lack of the blanks while reading kap-headers like mad...
/J
__________________
jonasaberg is offline   Reply With Quote
Old 05-10-2009, 13:48   #73
Obsfucator, Second Class
 
dacust's Avatar

Cruisers Forum Supporter

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,743
Total Bummer.

Code:
C:\libbsbwork\terrafetcher>convert c0001_p.jpg c0001_p.tif

C:\libbsbwork\terrafetcher>tif2bsb -c 127 c0001_p.hdr c0001_p.tif c0001_p.kap
No support for TIFF files with PHOTOMETRIC=1 (only images containing color maps
supported)

C:\libbsbwork\terrafetcher>tif2bsb -c 1 c0001_p.hdr c0001_p.tif c0001_p.kap
No support for TIFF files with PHOTOMETRIC=1 (only images containing color maps
supported)
EDIT: Dang I get the same thing with the color Topo maps, except it says PHOTOMETRIC=2.

So, obviously, this method won't work for my stuff.

-dan
dacust is offline   Reply With Quote
Old 05-10-2009, 14:35   #74
Senior Cruiser
 
sinbad7's Avatar

Cruisers Forum Supporter

Join Date: Sep 2003
Location: Ubatuba,SP,Brazil (Ex Norway)
Boat: (Ex) Alu. 60' yacht-"Eight Bells"
Posts: 2,717
Images: 57
Send a message via Skype™ to sinbad7
Jonas..

I followed your example to the letter but the header of the resulting .kap file looks like this and is useless..

IFM/4
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255
RGB/5,60,190,217
RGB/6,197,235,244
RGB/7,98,171,116
RGB/8,246,200,110

I am running under Vista if that makes any difference and I have the Win ver. of libbsb. Seems the command line ignores the content in the template.kap file..

COME ON DAVE!! a calibration utility for OpenCPN, PLEASE!!

And keep up the quest for 'the holy kap' everybody else..
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 05-10-2009, 14:40   #75
Registered User
 
jonasaberg's Avatar

Join Date: Jul 2008
Location: Kristiansand, Norway
Boat: Wasa 410
Posts: 305
Something to try:
When you use MapCal you can save the calibration as a chartcal.dir file. This file contains a lot of the info needed. maybe it is possible to use mapcal and write a script that creates the template file for use with tif2bsb from the chartcal.dir file. It is a bit of a workaround but might be faster than writing a whole new app and faster than finding the calibration points manually. MapCal is, i think...., reported to work well in Wine for you Linux guys and gals.

I converted the nz53.tig to png, opened in mapcal, and made four calibration points:
****
[NZ53.PNG]
NA=bream head
FN=NZ53.PNG
GR=0
PY=1
QU=0
SC=200000
BC=4
B1=-35.7564087258184,174.239533011272
B2=-37.1588198129098,174.239533011272
B3=-37.1587891136495,176.761272141707
B4=-35.7560554259853,176.761272141707
CC=4
C1=12063,8161,-37.083333333333,176.666666666667
C2=471,8161,-37.083333333333,174.333333333333
C3=471,474,-35.833333333333,174.333333333333
C4=12063,476,-35.833333333333,176.666666666667
GD=WGS84
NU=1
PR=1
DS=0,0
WI=12538
HE=8634
DX=18.23
DY=18.23
LAT0=0
LON0=0
DT=0
LATS=0
LATN=0
DU=1
PC=0
****

A lot is obvious comparing with the nz53.txt.

/J
__________________

__________________
jonasaberg is offline   Reply With Quote
Reply

Tags
charts, kml, raster2bsb, tiff2bsb, bsb

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
Charts on CD stxboy Navigation 43 28-01-2014 11:40
Charts for BC Charlie Navigation 11 19-04-2007 04:39
Used Charts daven Navigation 2 28-11-2006 17:47
Looking at charts - where to go to next Rippy Other 19 10-03-2006 05:27



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 06:22.


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.