Trouble with OsmAnd's "Smart" Merge of Favorites.gpxPosted: 2014-August-28
Years ago I was quite excited by an application for my Samsung Galaxy Player Android called OsmAnd. It is a free application (although you can buy a non-free version to support the project) that allows you to download OpenStreetMap data and use it like a GPS. It supports routing and talking directions like a commercial GPS, but, given its OpenStreetMap roots, if you find an error, you can edit it yourself and within days the changes will percolate to everyone's device.
One of the things I grew fond of was to directly edit the favorites.gpx file which contained all your "Favorite" places (now called "My Places" as of version 1.8). I could find a location in, say, Google Maps, then take the latitude and longitude and create an entry in favorites.gpx. The same time I upgraded to version 1.8, I stumbled upon a file with some old locations I had saved on my (now dead) Garmin GPS. I did some text manipulations and dropped them into the favorites.gpx file, but they wouldn't import.
I played around with it for a while, and found that OsmAnd could open GPX files, with which it would try to import the entries. When I did that with favorites.gpx, it would read the file and ignore my new entries, replacing favorites.gpx with a version that did not contain any of the new entries. I didn't notice at the time, but it popped up a cryptic error message that thankfully led me to the problem:
The error reads "Error reading GPX data Error parsing document. (position: line -1, column -1) caused by org.apache.harmony.xml.ExpatParser$ParseException: At line 4, column 16: not well-formed (invalid token)". Examining that line in the favorites.gpx, I had attempted to include an ampersand (&) in one of the entries (the first one, as it turned out). Rather than coding it as the SGML entity (&) I simply included it in the text which the parser (validly) didn't like. Unfortunately OsmAnd didn't handle the error very gracefully.
While I appreciate the new "smart merge" feature, I debate the use of the word "smart" in the way my poorly-formed gpx file was handled!
4,336 total views, 1 views today