Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rating: Thread Rating: 4 votes, 2.00 average. Display Modes
Old 08-10-2009, 21:29   #91
Registered User

Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
Congratulations Dan.
I'm eagerly awating an explanation.
Thomas
cagney is offline   Reply With Quote
Old 08-10-2009, 23:10   #92
Registered User
 
blubaju's Avatar

Join Date: Mar 2008
Location: where my little boat is ;-) now Philippines
Boat: Catamaran Schionning Wilderness 1320, built myself
Posts: 475
Quote:
Originally Posted by dacust View Post
Or click here for full size.

The full sized ones are clear.

-dan
I am very disappointed, I expected a nice overlay over CM93 !

Joke only, I am sure this will come next, congratulations!!!!!

Average people like me would need a simplified import procedure, I am sure this will come too
blubaju is offline   Reply With Quote
Old 09-10-2009, 04:56   #93
Registered User
 
sinbad7's Avatar

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

And HOW was this possible? Prey tell!!
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 09-10-2009, 06:09   #94
Obsfucator, Second Class
 
dacust's Avatar

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,745
Actually, as many things are, it turned out to be simple. I'll do some better documentation when I'm done, but in a nutshell, here it is. And, mainly for you to do your own hand-georeferenced jpgs, all you need are the three commands below, plus the info that cagney posted about building the header file.

To put the important stuff up front, to create a photo kap from a jpg:

a0001_u.cmd
Code:
convert a0001_u.jpg -colors 127 a0001_u.gif
convert a0001_u.gif -colors 127 a0001_u.tif
tif2bsb -c 127 a0001_u.hdr a0001_u.tif a0001_u.kap
That's all there is. Simple, right?

Now, more details about doing it from the free Terraserver images:

The images are downloaded from Terraserver using TerraFetcher. I use UsaPhotoMaps to view the downloads and to mark regions when I'm doing it by hand.

The .jpgs are also created using TerraFetcher. I create a txt file that has the region I want for the jpg and run it. You can specify a different jpg on each line. This produces jpg, jgw and inf files. The jgw file is the World file with coordinates in UTM. The inf file contains the lat/log or the upper left and lower right of the image in DD.MM.mmmm. That is, degrees and decimal minutes.

When you use UsaPhotoMaps to choose a region for TerraFetcher to use, it produces this:

TerraFetcherRegion.txt
Code:
Region=4
Format=UTM
16 719702 3778446
16 720017 3778446
16 720017 3778217
16 719702 3778217
I just rearrange it to look like this:

a0001_u.txt (the region file)
Code:
a0001_u.jpg = 16 719702 3778446 720017 3778217
Then I use that file with TerraFetcher to produce the jpg and the following two files:

a0001_u.jgw - this won't be used
Code:
  0.250000
  0.000000
  0.000000
 -0.250000
719700.125000
3778449.875000
a0001_u.inf - this is what we need
Code:
34.7.43N, 84.37.06W
34.7.29N, 84.36.84W
a0001_u
So, I took the DD.MM.mmmm, converted it to DD.dddddddd, plugged it into the header file, and voila. (eg. 34 + 60 x .743)

BTW, the header file does not have to be named anything in particular, so I named it the same as the image, and used a made up extension of .hdr.

a0001_u.hdr
Code:
! Photo of Allatoona - not for navigational use
VER/3.0
BSB/NA=Allatoona Photo 15000
    NU=,RA=1400,1000,DU=300
KNP/SC=15000,GD=,PR=MERCATOR,PP=0.000
    PI=Unknown,SP=Unknown,0,SK=0.0
    UN=,SD=LAT,DX=000,DY=000
CED/SE=2009,RE=12,ED=30/09/2009
OST/1
REF/1,1,1,34.123833,-84.617667
REF/2,1400,1,34.123833,-84.614000
REF/3,1400,1000,34.121500,-84.614000
REF/4,1,1000,34.121500,-84.617667
PLY/1,34.121500,-84.614000
PLY/2,34.121500,-84.617667
PLY/3,34.123833,-84.617667
PLY/4,34.123833,-84.614000
Now, to get the image converted to a .tif that tif2bsb can use. If you convert the jpg to a tif, the tif is coded in RGB instead of using a color palette, so it's unusable. The tip I got that finally made the whole thing work is to first convert it to a .gif and then to a tif. That worked! gif only supports palette coding, so converting to that forces it.

a0001_u.cmd
Code:
convert a0001_u.jpg -colors 127 a0001_u.gif
convert a0001_u.gif -colors 127 a0001_u.tif
tif2bsb -c 127 a0001_u.hdr a0001_u.tif a0001_u.kap
I am still talking to folks on the ImageMagick forum to find a single conversion that will work. This was proposed, but didn't work.
  • convert a0001_u.jpg -type Palette -colors 127 a0001_u.tif

So I have a process, all free images, all free software.

Next I'll write an automated procedure to do the following:
  • custom - create the region files
  • TerraFetcher - create the jpg/jgw/inf
  • custom - build the hdr file from the inf
  • ImageMagick - convert the jpg to tif
  • libbsb - create the kap

Then I'll have a totally automatic procedure to create photo charts from Terraserver. Just need several terrabytes of disk. If Dave decided to support jpg/jgw files, that space requirement would be cut quite a bit. Examples:
  • Color photo -1400x1000 - jpg 144k, kap 1,142k
  • Color topo - 2600x2000 - jpg 1,736k, kap 4,141k
  • B&W photo - 1400x1000 - jpg 231k, kap 971k

-dan
dacust is offline   Reply With Quote
Old 09-10-2009, 06:28   #95
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Quote:
Originally Posted by GPS-Marco View Post
Hi I've successfully imported in OpenCPN a chart (from a GIF file). The process was:

1) saved the image as tiff, 6 bit palette (6bpp or 64 unique colours)

used tif2bsb with the following template:

VER/2.00
BSB/NA=Roma_Area_VFR_01,NU=,RA=3912,2584,DU=254
KNP/SC=350000,GD=LOCAL DATUM UNKNOWN,PR=LAMBERT CONFORMAL CONIC,PP=42.44,PI=5.200,SP=
SK=0.0000000,TA=90.0000000,UN=METERS,SD=MEAN LOW WATER SPRINGS DX=1.50,DY=1.50
CED/SE=2000,RE=1,ED=01/01/2007
OST/1
REF/1,413,209,42.0,12.0
REF/2,413,2172,41.25,12.0
REF/3,3869,2137,41.25,13.75
REF/4,3828,175,42.0,13.75
PLY/1,42.05,11.8
PLY/2,41.2,11.8
PLY/3,41.2,13.75
PLY/4,42.05,13.75

Note: the most important info that must be absolutely correct for a specific image are:
RA=xxx,yyy (the image width/height in pixels)
the REF points
the PLY limits (also the order matters)

I georeferenced the image by hand (look at the pixel x,y where the coordinate grids crosses, and write down the REF line (REF/n,x,y,lat,lon)

Note that OpenCPN loads some info from .kap files when you select chart folders. If you make changes to the .kap file, unistall the chart folder and re-install it to let OpenCPN to rescan the .kap files

Ciao, Marco.

P.S. I've not been able to tell OpenCPN that the chart is not MERCATOR but LAMBERT projection (it simply seem to ignore the PR= info). Maybe it's my fault.
Maybe someone have missed this one: I wrote down the whole process on how to manually import any picture in OCPN as BSB map. I now attach the "evidence": an aeronautical map into OCPN (... nice idea use OCPN for aeronautical navigation, isn't it? Just the icon seems... inappropriate)

Click image for larger version

Name:	Shot_1.jpg
Views:	303
Size:	111.5 KB
ID:	10389

Of course a more "automated" tool with a nice GUI could be written down now (similar to Seaclear/MapCal). Or maybe a quicker temporary solution could be just a simple translator between the Seaclear/MapCal georef file to a BSB template (to be then used by tif2bsb). I'm not a programmer, but if I can help...

Ciao, Marco.
GPS-Marco is offline   Reply With Quote
Old 09-10-2009, 06:32   #96
Obsfucator, Second Class
 
dacust's Avatar

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,745
Quote:
Originally Posted by GPS-Marco View Post
Maybe someone have missed this one.
Yep, I did. I think if I did see it, I saw .gif and it didn't register because I am doing jpgs, and they wouldn't work.

Thanks!

-dan
dacust is offline   Reply With Quote
Old 09-10-2009, 06:46   #97
Obsfucator, Second Class
 
dacust's Avatar

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,745
Quote:
Originally Posted by blubaju View Post
I am very disappointed, I expected a nice overlay over CM93 !
A**hole. I knew there was a good reason I like you.



-dan
dacust is offline   Reply With Quote
Old 09-10-2009, 07:08   #98
Registered User
 
blubaju's Avatar

Join Date: Mar 2008
Location: where my little boat is ;-) now Philippines
Boat: Catamaran Schionning Wilderness 1320, built myself
Posts: 475
Any picture as chart ? --> !

Isn't a Radar picture only a picture too?

Just dreaming of coconuts ;-)
blubaju is offline   Reply With Quote
Old 09-10-2009, 07:13   #99
Registered User
 
sinbad7's Avatar

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

You mention that the PLY limits must be in the right order. which order?
I presume the REF points are he calibration points x,y,lat,lon in any order?
The .gif to .tif conversion was sheer genius..

Dan..

Thanks for the in-depth explanation. The hardest work seems to be the conversion of the Terrasever images. Converting a scanned .jpg chart image to .tif via .gif in preparation for the final tif2bsb seemed easier.
I still do not get the prepared header.kap file to merge with the finished map.kap file..

By the way, what do you do on your spare time??
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 09-10-2009, 08:18   #100
Registered User
 
sinbad7's Avatar

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

I am having difficulties creating a successful NZ53.kap file.

I have the original NZ53.tif file from the NZ Gov. site in palette color.

I am using the following header.kap file:

BSB/NA=NZ53-BREAM HEAD TO SLIPPER ISLAND
NU=51,RA=12538,8634,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

(NU-PP-UN have 4 spaces in front,not shown here)

I am using the command line: tif2bsb -c 127 header.kap nz53.tif nz53.kap

I am creating a NZ53.kap file ok but the new header only contains RGB information.

HELP anybody ??
__________________
"And all I ask is a tall ship and a star to steer her by."
sinbad7 is offline   Reply With Quote
Old 09-10-2009, 08:21   #101
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Quote:
Originally Posted by sinbad7 View Post
Marco...

You mention that the PLY limits must be in the right order. which order?
I presume the REF points are he calibration points x,y,lat,lon in any order?
The .gif to .tif conversion was sheer genius..

...

The PLY order that worked for me was up/right - up/left - low/left - low/right (like to draw a rectangle). I think other combination may work.

I didn't give REF points any order and it worked.

Actually I made another try:

1) Useg GIMP (portable) to convert from a source image in pdf (but it can be anything else) to 6 bit palette (the GIMP Italian menu is Immagine->modalità->indicizzata->64 colori) and then saved the image both as tif and as png

2) Used MapClacII to generate (from the PNG) the calibration File CHARTCAL.DIR. this is the result:

[ROMA_URBE_VFR-GIMP.PNG]
NA=RomaUrbe
FN=ROMA_URBE_VFR-GIMP.PNG
GR=0
PY=1
QU=0
SC=200000
BC=4
B1=42.1891499980515,12.3400333330067
B2=41.8340000033721,12.3552333338963
B3=41.844216672989,12.7740500010982
B4=42.1985670153057,12.7617667274981
CC=4
C1=202,222,42.166666666667,12.416666666667
C2=744,237,42.166666666667,12.750000000000
C3=185,767,41.916666666667,12.416666666667
C4=729,783,41.916666666667,12.750000000000
GD=WGS84
NU=
PR=3
DS=0,0
WI=826
HE=1169
DX=49.23
DY=49.23
LAT0=0
LON0=9.4792175
DT=0
LATS=40
LATN=45
DU=0
PC=0

Built by hand the Template .kap file from the CHARTCAL.DIR info

VER/2.00
BSB/NA=RomaUrbeVFR,NU=,RA=826,1169,DU=100
KNP/SC=200000,GD=WGS84,PR=LAMBERT CONFORMAL CONIC,PP=0.0,PI=0.0,SP=
SK=0.0000000,TA=90.0000000,UN=METERS,SD=MEAN LOW WATER SPRINGS
DX=49.23,DY=49.23
CED/SE=2000,RE=1,ED=01/01/2007
PLY/1,42.1891499980515,12.3400333330067
PLY/2,41.8340000033721,12.3552333338963
PLY/3,41.844216672989,12.7740500010982
PLY/4,42.1985670153057,12.7617667274981
REF/1,202,222,42.166666666667,12.416666666667
REF/2,744,237,42.166666666667,12.750000000000
REF/3,185,767,41.916666666667,12.416666666667
REF/4,729,783,41.916666666667,12.750000000000

you can see how simple it is (the only complex thing is the LAMBERT PROJECTION, but for MERCATOR it should be straightforward)

used tif2bsb.exe with the above template + the tif saved by GIMP

put the .kap result in OCPN chart dir and reload in OCPN the chart dir.

Enjoy, Marco.
GPS-Marco is offline   Reply With Quote
Old 09-10-2009, 08:26   #102
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Quote:
Originally Posted by sinbad7 View Post
Dan,Thomas,Marco..
...
I am using the command line: tif2bsb -c 127 header.kap nz53.tif nz53.kap
...
Actually I don't use the -c 127 parameter but just

tif2bsb header.kap nz53.tif nz53.kap

And as I said I saved tif using only 64 colours. I don't know if it may be a problem
Ciao, Marco.
GPS-Marco is offline   Reply With Quote
Old 09-10-2009, 08:36   #103
Registered User

Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
Beautiful, just an intermediary gif, so simple...
GPS-Marco, yes you have a first, but I just thought as Dan .... I'm doing jpg:s.

I had to do an instant test on a prepared file. Anyone can now merge GE pictures.......

Sinbad, I'll see If I can help out with your template file, stand by...

Thomas
Attached Thumbnails
Click image for larger version

Name:	niuatoputapu.jpg
Views:	305
Size:	415.0 KB
ID:	10390   Click image for larger version

Name:	niuatoputapu1.jpg
Views:	321
Size:	422.4 KB
ID:	10391  

cagney is offline   Reply With Quote
Old 09-10-2009, 10:28   #104
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
As I said, I've used GIMP to generate the tif

I do not know ImageMagic very well but from the help I see how it should work.

Quantization -- IM v6 Examples

I can advice for Maps:
convert map.xxx -dither None -colors 64 map.tif

I can advice for Photos:
convert picture.xxx -dither FloydSteinberg -colors 64 picture.tif

Of course the latter will give bigger BSB maps due to less compressible pixelation.

You can also try with 128 colors

Let me know.

Ciao, Marco.
GPS-Marco is offline   Reply With Quote
Old 09-10-2009, 17:10   #105
Obsfucator, Second Class
 
dacust's Avatar

Join Date: Feb 2008
Location: Southeast USA.
Boat: 1982 Sea Ray SRV360
Posts: 1,745
Quote:
Originally Posted by GPS-Marco View Post
As I said, I've used GIMP to generate the tif

I do not know ImageMagic very well but from the help I see how it should work.

Quantization -- IM v6 Examples

I can advice for Maps:
convert map.xxx -dither None -colors 64 map.tif

I can advice for Photos:
convert picture.xxx -dither FloydSteinberg -colors 64 picture.tif

Of course the latter will give bigger BSB maps due to less compressible pixelation.

You can also try with 128 colors

Let me know.

Ciao, Marco.
Good info. I can tell you from experience that 128 colors doesn't work. But 127 does. At least for mine it worked that way.

I will try the dither and see if I can reduce the conversion to one step.

Thanks,

-dan
dacust is offline   Reply With Quote
Reply

Tags
charts, kml, raster2bsb, tiff2bsb, bsb


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

Advertise Here
  Vendor Spotlight
No Threads to Display.


All times are GMT -7. The time now is 12:49.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.