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 Rate Thread Display Modes
Old 10-05-2020, 10:13   #301
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,541
Re: Imgkap - kap File Converter Tool

Andi
This is still a picture and no converting has been done.
Why you do not like to read the help of imgkap as HappySeagull told you?
If you do not know any latitude/longitude points of this picture you cannot convert it to a kap chart.
CarCode is offline   Reply With Quote
Old 10-05-2020, 13:20   #302
Registered User

Join Date: Mar 2016
Boat: Parker Super Seal 26
Posts: 183
Re: Imgkap - kap File Converter Tool

Quote:
Originally Posted by CarCode View Post
Andi
This is still a picture and no converting has been done.
Why you do not like to read the help of imgkap as HappySeagull told you?
If you do not know any latitude/longitude points of this picture you cannot convert it to a kap chart.

Well, it's a GeoTIFF, the information is included. I'm aware that imgkap needs it as parameters and can't just extract the embedded information. I just wanted to confirm that I produced a good enough map, now I'm struggling to convert it to something to imgkaps liking.



I read the help, it's just not very helpful. The option "-j" is just smoke and mirrors, it seems it's not actually used in the code, just dragged through a couple of variables.
_andi_ is offline   Reply With Quote
Old 10-05-2020, 13:35   #303
Registered User

Join Date: May 2012
Posts: 1,206
Re: Imgkap - kap File Converter Tool

If you can read it with Photolayer_pi there is an option to make a kap. interested to know the result.

Mike
Rasbats is offline   Reply With Quote
Old 10-05-2020, 14:49   #304
Registered User

Join Date: Mar 2016
Boat: Parker Super Seal 26
Posts: 183
Re: Imgkap - kap File Converter Tool

@Rasbats: Thanks for the tip! Photolayer says "... unable to transform points between pixel/line and PCS space". But this may be an installation issue, didn't find any documentation for installation so I just did a cmake . && make on a linux box, got a couple of complaints from the compiler...


I guess I got imgkap to work by yanking the scale complaint from the source code. Spot check looks good on a couple of points.
_andi_ is offline   Reply With Quote
Old 10-05-2020, 22:04   #305
Registered User

Join Date: May 2012
Posts: 1,206
Re: Imgkap - kap File Converter Tool

_andi_...

The 'unable to transform points' is because your geotiff is in 'mercator' CRS. If you change the tiff to 'latlon' you should find that photolayer will work. John Thorn's 'MAPC2MAPC' program can do this. SASPlanet has the option to save in both formats. There are probably other programs that can do the same job.

Mike
Rasbats is offline   Reply With Quote
Old 11-05-2020, 01:01   #306
Registered User

Join Date: Mar 2016
Boat: Parker Super Seal 26
Posts: 183
Re: Imgkap - kap File Converter Tool

Quote:
Originally Posted by Rasbats View Post
_andi_...

The 'unable to transform points' is because your geotiff is in 'mercator' CRS. If you change the tiff to 'latlon' you should find that photolayer will work.
Mike
Hi Mike, THANKS! We should document this in the opencpn wiki, it's really a slick way to precisely georefence stuff.

Steps:
  • Get any decent map for the area and open it in Qgis
  • Use Georeferencer Plugin to reference details on the image/pdf (just click on any point in the image, click "select from map canvas" and click on the same point in the map window)
  • Right Click on the added layer, "export->save as..." select "rendered image" "Format GeoTIFF" and "EPSG:4326 - WGS 84" as CRS
  • Open the GeoTIFF in OpenCPN / Photolayer
  • Export as .kap and use it on your phone
  • DONE
_andi_ is offline   Reply With Quote
Old 11-05-2020, 01:09   #307
Registered User

Join Date: Mar 2016
Boat: Parker Super Seal 26
Posts: 183
Re: Imgkap - kap File Converter Tool

bonus step:
  • Make the georefenced image layer transparent and check alignment the easy way
_andi_ is offline   Reply With Quote
Old 30-06-2020, 08:18   #308
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 272
Re: Imgkap - kap File Converter Tool

Need some assistance with an odd imgkap generation that places the chart almost 7 MN WSW off the expected location. I am sure I've done a silly mistake somehow and are aware the the lat/long ratio is not 100% correct but still, it passes the conversion without error messages.

After the kap generation I made this 'kymmendo.txt' file from the kap file:

-----------------------
! Map generated not for navigation created at 30/06/2020
! Extend widthin 1574 heightin 1528 to widthout 1620 heightout 1528
! Size in milles 0.34 x 0.32
! Resolution units METERS - 0.38x0.38 -> 3838 at 254 dpi
VER/2.0
CED/SE=1,RE=1,ED=30/06/2020
BSB/NA=Kymmendö - Myrängsflaket
NU=Kymmendo,RA=1620,1528,DU=254
KNP/SC=3838,GD=WGS84,PR=MERCATOR,PP=0.00
PI=UNKNOWN,SP=UNKNOWN,SK=0.0,TA=90
UN=METERS,SD=UNKNOWN,DX=0.38,DY=0.38
REF/1,0,0,59.072720,18.291565
REF/2,1620,0,59.072720,18.302431
REF/3,1620,1528,59.067443,18.302431
REF/4,0,1528,59.067443,18.291565
PLY/1,59.072720,18.291565
PLY/2,59.072720,18.302431
PLY/3,59.067443,18.302431
PLY/4,59.067443,18.291565
DTM/0.000000,0.000000
RGB/1,206,119,138
RGB/2,249,246,197
RGB/3,121,229,253
RGB/4,193,235,249
RGB/5,254,246,179
RGB/6,210,238,183
RGB/7,136,157,144
RGB/8,98,161,177
RGB/9,253,246,185
RGB/10,112,98,51
RGB/11,65,101,120
RGB/12,94,97,83
RGB/13,127,240,211
RGB/14,233,120,185
RGB/15,94,168,149
RGB/16,244,248,231
-------------------------

It should be possible to use any 'kymmendo.png' image (1574x1528 pix) and run 'imgkap Kymmendo.kap kymmendo.txt' to generate a dummy chart from the above.

When done, compare the displayed location with the location defined in the kap file. They differ about 6.7 NM in bearing 244 degrees.
I also noted the scale is wrong but don't really care as it can be changed using a hex editor.

Defined position: 59.072720 18.291565 59.067443 18.302431
Shown in position: 59.143631 18.174937 59.040468 18.181462

I'm sure I've made some silly mistake but can not find it!
Thanks in advance for any help!

/Lennart
LennartG is online now   Reply With Quote
Old 30-06-2020, 08:30   #309
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,740
Re: Imgkap - kap File Converter Tool

Quote:
Originally Posted by LennartG View Post
After the kap generation I made this 'kymmendo.txt' file from the kap file:

-----------------------
! Map generated not for navigation created at 30/06/2020
! Extend widthin 1574 heightin 1528 to widthout 1620 heightout 1528

/Lennart

Lennart...


do you have the complete imgkap command with its parameters you used to generate the kap at hand?


Hubert
bcn is offline   Reply With Quote
Old 30-06-2020, 09:12   #310
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 272
Re: Imgkap - kap File Converter Tool

Hubert,
thanks for your prompt reply. This is what I used:
imgkap -n Kymmendo.png 59.072720 18.291565 59.067443 18.302431
/Lennart
LennartG is online now   Reply With Quote
Old 30-06-2020, 09:27   #311
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,740
Re: Imgkap - kap File Converter Tool

When you analyze your png in GIMP for the PLYs x;y, are those
0;0 upper left and 1620;1528 lower right?
bcn is offline   Reply With Quote
Old 30-06-2020, 09:39   #312
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 272
Re: Imgkap - kap File Converter Tool

Hubert,
upper left is 0,0 while lower right is 1574,1528.
This coincides with the error shown in the second row in the txt file generated so it should not be the cause (i hope).

/Lennart
LennartG is online now   Reply With Quote
Old 30-06-2020, 10:20   #313
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,740
Re: Imgkap - kap File Converter Tool

And if you try
imgkap mykap.png lat0 lon0 x0;y0 lat1 lon1 x1;y1 ?
bcn is offline   Reply With Quote
Old 30-06-2020, 10:40   #314
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 272
Re: Imgkap - kap File Converter Tool

Hubert,
Then I just get error messages like:

ERROR - Can't open Header file x0
ERROR - imgkap ((null)) return 2.
Adding the header file (the one above) gives the displacement error I had to begin with.
/Lennart
LennartG is online now   Reply With Quote
Old 30-06-2020, 11:23   #315
Registered User

Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
Re: Imgkap - kap File Converter Tool

LennartG
The best you can do is to write your own header file, and make sure that

REF/1 to REF/4 are the real values from the picture size and the georeferencing. Use the command
Quote:
$imgkap myimg.png myheaderkap.txt myresult.kap
Read more in the OpenCPN conversion manual.

Thomas
cagney is offline   Reply With Quote
Reply

Tags
imgkap


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
Development Debugging Environment - Setup Help rgleason OpenCPN 654 04-10-2020 05:37
OpenCPN Beta Version 3.1.814 Released bdbcat OpenCPN 185 14-09-2012 07:43
Route File Transfer via SDcard to Garmin 441s four winds Navigation 11 25-02-2012 08:34
GRIB Weather Mark Ward OpenCPN 26 12-02-2012 21:33
Route Properties, Missing Functions James Baines OpenCPN 13 13-07-2011 04:31

Advertise Here


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


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.