Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

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 15-02-2018, 05:18   #1
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Updated advice for calibrating/georeferencing raster files

I've undertaken a project to add the MN DNR's water trails maps to OpenCPN. These are the best available charts for non-navigable rivers in Minnesota, and offer some detail not readily available in other sources for the Mississippi, Minnesota, and St. Croix:

1. River mile.
2. Dangerous obstructions, particularly dams and rapids.
3. Bridges, although there is no clearance information.
4. Public lands adjoining the rivers, including information on services available, such as restrooms, water, and picnic areas.
5. Boat launches.

The information in the OpenCPN on how to georeference a raster file is badly out of date, and depends on weak tools like SeaClear that have been unsupported for years. Here is the path I am using:

1) Use ghostscript to rasterize the PDF files from the state. Though not strictly necessary, this allows control of the resolution, where a direct PDF import does not. Ghostscript is in all the major Linux distros, and is available as part of cygwin for Windows users. I created BMP files although other formats will work.

2) Use QGIS to perform the georeferencing. I find that it works best to download the OpenStreetMap plugin and use it for a base map. The georeferencer is included in the QGIS package, but has to be enabled in the "plugins' page in order to work. It is important to add an OpenStreetMap layer (or other base layer) before doing any georeferencing or the coordinate system will be wrong, even if you specify it manually (bug). The georeferencer will produce a georeferenced .tiff file, and save your points separately also.

3) The thin plate spline transformation setting works best for most cases. It is necessary to have at least 3 reference points. 4 will work better, and 5 will give you useful residual error data that will identify any inaccurate points. Unlike older tools, QGIS will properly adjust maps that are skewed. If you include enough points, it will correct distortions that result from a bad scan or even a hand-drawn map.

I was not able to get GRASS to do what I need.
I found SeaClear to be buggy on Windows 10 and almost impossible to use.
I was not able to get ImageCal to work on Windows 10.
Jammer is offline   Reply With Quote
Old 15-02-2018, 05:55   #2
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Re: Updated advice for calibrating/georeferencing raster files

I'm working on the BSB/KAP export now.

Libbsb appears to be orphaned. There's a working mirror at https://github.com/nohal/libbsb - no binaries, you have to build it from source.

On cygwin you have to have libtiff-devel installed before building it in order to get the build to produce tif2bsb.
Jammer is offline   Reply With Quote
Old 15-02-2018, 06:06   #3
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Re: Updated advice for calibrating/georeferencing raster files

Looking at imgkap source code now. It doesn't look like there's anything out there that can convert a georeferenced TIFF file into a BSB/KAP file. Is there? Anyone? I may have to modify imgkap to be able to read the TIFF geo header. Yay.
Jammer is offline   Reply With Quote
Old 15-02-2018, 06:31   #4
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: Updated advice for calibrating/georeferencing raster files

Quote:
Originally Posted by Jammer View Post
Looking at imgkap source code now. It doesn't look like there's anything out there that can convert a georeferenced TIFF file into a BSB/KAP file. Is there? Anyone? I may have to modify imgkap to be able to read the TIFF geo header. Yay.
libgeotiff
I will gladly accept a pull request implementing it directly to https://github.com/nohal/imgkap of course...

Pavel
nohal is online now   Reply With Quote
Old 15-02-2018, 06:33   #5
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,426
Re: Updated advice for calibrating/georeferencing raster files

which sources of imgkap did you pull?
seandepagnier is offline   Reply With Quote
Old 15-02-2018, 07:03   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: Updated advice for calibrating/georeferencing raster files

BTW, for plain manual conversion of GeoTIFF to KAP, the new photolayer OpenCPN plugin (https://github.com/Rasbats/photolayer_pi) seems to do it quite fine.
nohal is online now   Reply With Quote
Old 15-02-2018, 07:17   #7
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Re: Updated advice for calibrating/georeferencing raster files

Quote:
Originally Posted by boat_alexandra View Post
which sources of imgkap did you pull?
The ones from Pavel's git repo. (nohal)
Jammer is offline   Reply With Quote
Old 16-02-2018, 11:01   #8
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Updated advice for calibrating/georeferencing raster files

Jammer wrote:

The information in the OpenCPN on how to georeference a raster file is badly out of date, and depends on weak tools like SeaClear that have been unsupported for years. Here is the path I am using:

It appears you are in the process of rewriting this old section. When you have perfected the process please update this, so we can update the wiki.

Also btw which pages in the wiki exactly are outdated?
rgleason is offline   Reply With Quote
Old 20-02-2018, 18:47   #9
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Re: Updated advice for calibrating/georeferencing raster files

Quote:
Originally Posted by nohal View Post
libgeotiff
I will gladly accept a pull request implementing it directly to https://github.com/nohal/imgkap of course...

Pavel
I'm working on a getting a shell script together that will do all the steps using existing tools.

Modifying imgkap is problematic because it relies on FreeImage, which has not been actively maintained for several years and will no longer compile, at least on cygwin, which is what I have to work with at the moment. I doubt if the outcome would be different on more widely accepted platforms. FreeImage also uses nonstandard license terms, fwiw.

Anyway, to make the chain work cleanly without extensive scripting, I would have to modify FreeImage so that it will compile, and then modify it to use the geotiff library and add APIs to pass those coordinates up. A separate problem is that imgkap will not read the image data from the tiff files produced by QGIS, apparently due to a limitation of FreeImage, so that would also have to be fixed.

All that aside, QGIS works well for the georeferencing itself, nice interface, will rotate the input rasters as needed, and uses a spline algorithm that can compensate for nonlinearities in the input.
Jammer is offline   Reply With Quote
Old 20-02-2018, 19:09   #10
Moderator
 
Jammer's Avatar

Join Date: Jan 2010
Location: Minnesota
Boat: Tartan 3800
Posts: 5,174
Re: Updated advice for calibrating/georeferencing raster files

Quote:
Originally Posted by rgleason View Post
It appears you are in the process of rewriting this old section. When you have perfected the process please update this, so we can update the wiki.

Also btw which pages in the wiki exactly are outdated?
I will do this.

There are several pages on the wiki that document individual paths of conversion that have worked for people over time, such as https://opencpn.org/wiki/dokuwiki/do...manual:pdf2kap

The whole section, IMO, should be updated to focus on modern tools.
Jammer is offline   Reply With Quote
Old 21-02-2018, 01:03   #11
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: Updated advice for calibrating/georeferencing raster files

Quote:
Originally Posted by Jammer View Post
I'm working on a getting a shell script together that will do all the steps using existing tools.

Modifying imgkap is problematic because it relies on FreeImage, which has not been actively maintained for several years and will no longer compile, at least on cygwin, which is what I have to work with at the moment. I doubt if the outcome would be different on more widely accepted platforms.
I remember some very trivial stuff when compiling on Windows with VS2017 some time ago, took few minutes to fix. Can we look at what cygwin complains about exactly?
Quote:
FreeImage also uses nonstandard license terms, fwiw.
What is nonstandard on "FreeImage is licensed under the GNU General Public License, version 2.0 (GPLv2) or version 3.0 (GPLv3)"? It is certainly good enough to be included in Debian. And as we know nothing is good enough for Debian license wise
Quote:
Anyway, to make the chain work cleanly without extensive scripting, I would have to modify FreeImage so that it will compile, and then modify it to use the geotiff library and add APIs to pass those coordinates up. A separate problem is that imgkap will not read the image data from the tiff files produced by QGIS, apparently due to a limitation of FreeImage, so that would also have to be fixed.
As far as I can say FreeImage is based on libtiff, do you want to say libtiff, the standard used by everything, does not read the QGIS tiffs? Or is there some other problem? Which?
Quote:
All that aside, QGIS works well for the georeferencing itself, nice interface, will rotate the input rasters as needed, and uses a spline algorithm that can compensate for nonlinearities in the input.
So to conclude, you will script QGIS and don't need any other tools? That would of course be a solution as well.

Pavel
nohal is online now   Reply With Quote
Old 21-02-2018, 13:09   #12
Registered User

Join Date: May 2012
Posts: 1,228
Re: Updated advice for calibrating/georeferencing raster files

MAP2CMAPC (15GBP) will accept GeoPDF files and output .tif and .kap files. If you want to use the tifs in the PhotoLayer plugin (transparency) use tif latitude/longitude not mercator. The loading of the initial pdf file takes time as these are large files.

cando

Mike
Attached Thumbnails
Click image for larger version

Name:	map2cmapc.jpg
Views:	125
Size:	447.0 KB
ID:	164572  
Rasbats is offline   Reply With Quote
Old 22-02-2018, 10:44   #13
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Updated advice for calibrating/georeferencing raster files

Jammer wrote:
Quote:
I will do this.
There are several pages on the wiki that document individual paths of conversion that have worked for people over time, such as https://opencpn.org/wiki/dokuwiki/do...manualdf2kap
The whole section, IMO, should be updated to focus on modern tools.
Believe it or not Contributed by [egodsey] on Cruisers Forum contributed this fairly recently. I am pleased that you would like to update it! We always appreciate better methods.

Jammer if you'd like to become a Opencpn Wiki Editor/Manager just PM me with your email address and preferred user name.
rgleason is offline   Reply With Quote
Reply

Tags
cal, enc


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
re calibrating raster charts catsketcher OpenCPN 13 24-03-2017 08:03
Predictwind´s .pwr files to .grb files? andreas.mehlin Navigation 0 16-02-2017 07:03
Updated / Completed mo/po Files Netsurfer OpenCPN 1 27-05-2010 14:05
Problem with PLY and REF Points when Georeferencing BSB Charts draagedo OpenCPN 21 24-02-2010 05:57
Re-calibrating Xantrex Link 1000 JDM2007 Electrical: Batteries, Generators & Solar 14 06-11-2007 21:42

Advertise Here


All times are GMT -7. The time now is 19:41.


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.