Importing GPX files into Base Camp

Former Member
Former Member
I have some feedback to hopefully improve your Base Camp application.

I have written an application to take our coordinate file and convert it to a waypoint or track GPX file. In my attempt to get the GPX file to import into Base Camp I discovered a couple problems I really wish you could address in a future version:
1) If there is an error importing the file it would be helpful to identify the line number and/or xml element where the error occured "Unknown error opening import file" is not useful to try to determine WHERE in the GPX file the error occurs.
2) This one took over an hour to figure out:
<gpxx:DisplayColor>green</gpxx:DisplayColor>
Notice that lower case "green" is one cause for unknown error. Your Base Camp application will generate an error unless it is proper case "Green". Please consider fixing the code in Base Camp to mitigate this error or identify the specific error when displaying error information to the user.

My experience with importing GPX files into Base Camp is that its really picky and just does not display enough diagonstic information. I do like the application however and it handles our basic needs.

Thanks,
Terry
  • Former Member
    0 Former Member
    You can just use any XML validator to find out which line is the culprit.

    http://www.validome.org/xml/ is one, but there are tons out there (on- and offline).

    This is not to dismiss your suggestion, we could definitely give a line number to make this easier on the user. But... :) if you are developing an application that tries to emit valid XML, you should validate it (either in your own app or with an outside tool).
  • Former Member
    0 Former Member
    But does the XML parser in Basecamp behave exactly the same way as the XML validators?

    For instance, would the XML validator you suggest catch the lower case versus proper case use of the colour argument that Terry cited?

    By the way, I just did a quick test and Mapsource (6.16.3) is just as picky and unhelpful. I created a couple of tracks using the track editing tools, changed the colours - one to Blue and the other to Green, and saved as a GPX file. I loaded the GPX file into my text editor (Notepad++) and changed the colour names to lower case. Then I tried to open the file with Mapsource. It failed pretty much the same way as Basecamp "unable to import file".

    ..... Ah, woops, I just answered my own question from above. The validator you linked will not catch the colour name error. Using the same file I just described that Basecamp and Mapsource choke on, the Valdome XML validator in your link declares that "The Document is valid".

    So the Valdome validator in your link does not behave in the same way as the XML parsers in Basecamp and Mapsource in at least this instance.

    I tested one of the other forms of the validator from one of the buttons on the page you linked. It declares that the document is invalid. But it fails because there is no DOCTYPE declaration. It still does not pick up on the case in the colour names.

    I'm not knocking the idea of using a validator in general. But unless the validator is known to use the exact parsing code as the parser you are trying to write to, it's not all that useful for more than ballparking.

    Since these two validators are checking for standards conformance, wouldn't it be safe to say that the standards say nothing about the case of arguments in things like Color tags?

    ...ken...
  • Former Member
    0 Former Member
    You are right, the validators do not check XML extensions (because there is no schema location for the gpx extension in the gpx file) which is unfortunate.

    Still, we don't make anything up. Our parser parses it and checks for validity just like the schema describes it. In your case, http://www8.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd describes what format we expect to color to be in.

    As I said before, I am not saying this to undermine the request to give better feedback when the import fails. We will investigate if we can do this.

    But we read strict XML according to the provided schemas. Which is why it shouldn't matter which validator you use provided it adheres to the standards and you provide all the schemas to validate against (which is what was missing in this case).

    I attached a gpx file that contains a wrong color and the schema location and Validome (or any other decent validator) will flag it as invalid.
  • Former Member
    0 Former Member
    Terry,

    Apologies for the confusion. We have a hidden feature for advanced users like you who author GPX files. This feature does exactly what you are asking for :)

    Run BaseCamp from the command prompt with the /Debug parameter and it will write out an error log file with the information you are asking for. The error log has the line number in the GPX file where the error was encountered and the reason why our XML validator rejected the file.

    I tried out the use-case you mentioned with the lower case 'green'. In this case, the error log says "value 'green' not in enumeration" at which point, you would look at the schema at the location @falagar pointed out, which defines the enumeration with the capital 'G'
    <xsd:simpleType name="DisplayColor_t">
    <xsd:restriction base="xsd:token">
    ...
    <xsd:enumeration value="Green"/>
    ...
    </xsd:restriction>
    </xsd:simpleType>


    To turn on advanced debugging
    1. open command window
    2. browse to location of BaseCamp.exe
    3. launch BaseCamp by typing "BaseCamp.exe /Debug"
    4. When you quit BaseCamp, a file named Debug.txt will be written out in the same path with the GPX import error details.
  • Former Member
    0 Former Member
    Importing GPX files into Base Camp

    Thanks to all who posted or replied. NeoLite your suggestion was exactly what I was hoping for. I learned some new stuff today and it was all helpful.

    Best Regards,
    Terry
  • Former Member
    0 Former Member
    How can this debug mode be started in the OS X version?

    Terry,

    Apologies for the confusion. We have a hidden feature for advanced users like you who author GPX files. This feature does exactly what you are asking for :)

    Run BaseCamp from the command prompt with the /Debug parameter and it will write out an error log file with the information you are asking for. The error log has the line number in the GPX file where the error was encountered and the reason why our XML validator rejected the file.

    I tried out the use-case you mentioned with the lower case 'green'. In this case, the error log says "value 'green' not in enumeration" at which point, you would look at the schema at the location @falagar pointed out, which defines the enumeration with the capital 'G'
    <xsd:simpleType name="DisplayColor_t">
    <xsd:restriction base="xsd:token">
    ...
    <xsd:enumeration value="Green"/>
    ...
    </xsd:restriction>
    </xsd:simpleType>


    To turn on advanced debugging
    1. open command window
    2. browse to location of BaseCamp.exe
    3. launch BaseCamp by typing "BaseCamp.exe /Debug"
    4. When you quit BaseCamp, a file named Debug.txt will be written out in the same path with the GPX import error details.
  • Former Member
    0 Former Member
    That would be a question that is better asked on the Mac forum.
  • Former Member
    0 Former Member
    Hi All,

    I have encountered a problem that has me beaten. I am trying to access all of the log files from my Nuvi 1450 using Basecamp on my PC. There are 20 files plus the current one and all files except number 15 have loaded and opened without any issues. However, file 15 - as usual the most important one - will not open. I have tried using Notepad and can see the file. If I try to open it with Excel I finish up with an error message - '<' cannot be used in an attribute value - Line 1, Position 2289 - <trkpt late="-27.254925" - then it displays 3 lines that follow this point in the file.

    I am not an XML programmer so I am a bit lost. I then went and tried to validate using validator.nu and this returned a Fatal Error - attribute values must not contain '<' - At line 1 column894025.

    In both cases - Excel/Notepad or the Source as produced by validator.nu - how do I locate the offending code and fix it?

    How do I fix this file please?


    Hello Don,

    In Notepad do a find for that number 27.254925 from the error message.
    Look at the other trkpt late= entries and make 27.254925 look the same reguarding < and " etc.
  • Former Member
    0 Former Member
    Using NotePad or WordPad....
    After making changes do a Save As....
    The file name will have name.gpx or name.tcx already showing....
    I always add a -number or a word like -fix to the name (ie: name-01.gpx) but be sure to keep the .gpx or .tcx....
    That way you keep the original file unchanged....
    Save As Type should be Text Document....
    Click Save and you will have the file you want as a gpx or tcx, whatever you started with.

    Also the data should say <trkpt lat= and not late there should be no e.
  • If you can post it here someone might help out :)