I was trying to
import some old GPX files from a few years ago, in order to clean them up, so they are more presentable to share with others. (mainly adding the "Don't show if you zoom out, more than xxx")
This is an extension, in the waypoint gpx, which will automatically hide the waypoint if you zoom out more than 1:5 million). Helpful when you have a lot of waypoints (marks) in a small area:
[opencpn:scale_min_max UseScale="true" ScaleMin="5000000" ScaleMax="0" /]
Normally I open the gpx with a text editor and search and replace something like:
[opencpn:viz_name>1{/opencpn:viz_name]
with
[opencpn:viz_name]1[/opencpn:viz_name][opencpn:scale_min_max UseScale="true" ScaleMin="5000000" ScaleMax="0" /]
But my gpx files were from a non-OpenCPN source or so old
OpenCPN didn't include those extensions in a normal waypoint.
So my plan was to
import them into an empty
OpenCPN database, and export them again, which adds the OpenCPN extensions.
But I tried and tried and neither file would import, and there was NOTHING in the OpenCPN log (or in a pop-up) that indicated the exact problem. Just a generic error message in the log that said "there was an error importing file filename. I also tried importing it as a Temporary Layer, and the layer showed up in the list with 0 items (and no error message).
I remembered an old GPX utility program, and opened the file with that. And lo and behold, it told me the exact line and column of the error, and an idea of what the error was.
One file had a non-UTF8 symbol in it (I think it was a smart quote) AND a random letter I had typed in somewhere it didn't belong while trying to play with the file. The other had [gpx] as the last line instead of [/gpx]
So, if you are having trouble importing a gpx and trying to figure out what the problem is GPX Editor might help you out. It is a tiny file, no installer, just run it from wherever. Can download it here:
https://sourceforge.net/projects/gpxeditor/
Developers... the source is there, would be nice if OpenCPN's import function would at least give you a clue (and would be nice to get an error message on the
screen vs just nothing imports).
Note: Cruiser's forum apparently uses pointy brackets as code within the forum, so anything in gpx format with the pointy brackets disappears (even if you put CODE or HTML tags around it). So if you are trying to do this yourself in a gpx file, replace the square brackets above with pointy brackets.
Hope this helps someone else.
Sherry sv Soggy Paws