Quantcast

GPSBabel Saves Name Instead of Description

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

GPSBabel Saves Name Instead of Description

Jon Rosen
I’m exporting records to a KML file and am unable to suppress labels.  I’m running the latest version of GPSBabel on OS X 10.12.3 and using the Unicsv format for the input file and KML for the export file.  

The problem seems to be that GPSBabel is generating a <name> tag instead of <description>. I’ve tried labels=0 for the output and the fields=lat+lon+description option for the input. 

This the string. There are variables for some of the paths because I’m running this as a shell script from within a FileMaker application. But, I get the same results if I run it directly from the command line. 

"/Applications/GPSBabelFE.app/Contents/MacOS/gpsbabel -i unicsv,fields=lat+lon+description -f " & $Filepath & " -o kml,deficon=http://maps.google.ca/mapfiles/kml/pal4/icon57.png,labels=0 -F " & $Output_Path & " -o gpx,labels=0 -F " & $Output_Path2)

I can’t find any other information and I am stymied. The file is useless in Google Earth because the labels obfuscate the points. Your suggestions would be appreciated.

Thanks,

Jon


Here’s a sample of the output from the KML file:

<?xml version="1.0" encoding="UTF-8"?>
  <Document>
    <name>GPS device</name>
    <snippet>Created Fri Feb 17 12:51:48 2017</snippet>
    <LookAt>
      <longitude>-88.744287</longitude>
      <latitude>29.898215</latitude>
      <range>2529510.966711</range>
    </LookAt>
    <!-- Normal waypoint style -->
    <Style id="waypoint_n">
      <IconStyle>
        <Icon>
        </Icon>
      </IconStyle>
    </Style>
    <!-- Highlighted waypoint style -->
    <Style id="waypoint_h">
      <IconStyle>
        <scale>1.2</scale>
        <Icon>
        </Icon>
      </IconStyle>
    </Style>
    <StyleMap id="waypoint">
      <Pair>
        <key>normal</key>
        <styleUrl>#waypoint_n</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#waypoint_h</styleUrl>
      </Pair>
    </StyleMap>
    <Folder>
      <name>Waypoints</name>
      <Placemark>
        <name>061802 Debbie Curtin Park Walkway and Site Improvements $75.00</name>
        <Style>
          <IconStyle>
            <Icon>
            </Icon>
          </IconStyle>
        </Style>
        <Point>
          <coordinates>-80.370053,25.554610</coordinates>
        </Point>
      </Placemark>
      <Placemark>
        <name>061804 Seventh Avenue Transit Village II $55.00</name>
        <Style>
          <IconStyle>
            <Icon>
            </Icon>
          </IconStyle>
        </Style>
        <Point>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: GPSBabel Saves Name Instead of Description

Robert Lipe-4
This is working as intended, it's just bad for your case. Here's a "teach a man to fish" way to get around it.


"labels" has no power here. From the doc:

labels option

Display labels on track and routepoints (default = 1).

When this option is zero, no labels are added for track and route points. This option defaults to one, so labels are added by default.


The mapping of an arbitrary number of input fields containing text to an arbitrary number of output fields is one of the challenges I had to solve early in the design of GPSBabel. KML, for example, has name, description, <snippet> and a few more. GPX has name, descriptino, comment, a GPS of an early era might allow only six digit names but 200 character comments.  A lot of formats don't allow you to have something without a name, so we work really hard to populate our internal "shortname" field when we can and use it as the primary name for, well, anything. There are some cases - and KML has plenty of them like cascading styles and javascript and video embedded in the name and we just can't really decompose those gracefully to fit into a consumer GPS.

How does it work? Well, GPSBabel is open source so even if you can't write code, you can open it up and see how it makes these decisions. The KML writer for waypoints ("placemarks" in KML) writes the "name" field at:

https://github.com/gpsbabel/gpsbabel/blob/master/kml.cc#L1589

You can peek into the writeOptionalTextElement to see that this stops us from writing empty <name></name> pairs when we have nothing. But you can see we always try to fill one. Next is a test for HasUrlLink and we can tell your stuff isn't doing URLs. So we follow into the else and see we write a "description" if we have a description that isn't equal to our shortname. So how do we get it into <description>? A reasonable shot would be to reshape the input csv:

lat, lon, description
12, 34,  blah

     <Placemark>
        <name>blah</name>
        <styleUrl>#waypoint</styleUrl>

Well, rats. That didn't work. We were foiled by code in between the unicsv reader and kml writer that tries really really hard to ensure that shortname gets filled. (That code is in waypt_add in waypt.cc if you want to look for it.) So let's put something in the name field and the thing you want in description.

lat, lon, name, description
12, 34, ".", blah

      <Placemark>
        <name>.</name>
        <description>blah</description>
        <styleUrl>#waypoint</styleUrl>

Unfortunately for you, we're too clever to let you put something like a non-breaking unicode space or something there as we'll still simpify that to empty space.

If you don't want to modify GPSBabel, you could also machine edit the KML we generate. A naive sed call would also rename the <name> in <Folder>; you'd have to be context aware.

However, from a cartographic view, even with clever icons, you probably want SOME kind of a label that shows with the markers on the map. I'd consider

lat, long, name, description
12, 34, "Debbie Curtain", "061802 Debbie Curtin Park Walkway and Site Improvements $75.00"

to be a better UX as it makes it possible for a viewer of the map to see what it is without clicking on it. That also makes it possible to see and easily click on it in Earth in the left hand panel.


OTOH, if you really have control of the CSV and that "." distracts you, editing kml.cc to change the tag that's written makes it less useful in the general case, but perfect for yours. If you already have xcode on your system, it's literally changing that one line and rebuilding it. It would take minutes. Less time than I spent typing this...


On Fri, Feb 17, 2017 at 3:02 PM, Jon Rosen <[hidden email]> wrote:
I’m exporting records to a KML file and am unable to suppress labels.  I’m running the latest version of GPSBabel on OS X 10.12.3 and using the Unicsv format for the input file and KML for the export file.  

The problem seems to be that GPSBabel is generating a <name> tag instead of <description>. I’ve tried labels=0 for the output and the fields=lat+lon+description option for the input. 

This the string. There are variables for some of the paths because I’m running this as a shell script from within a FileMaker application. But, I get the same results if I run it directly from the command line. 

"/Applications/GPSBabelFE.app/Contents/MacOS/gpsbabel -i unicsv,fields=lat+lon+description -f " & $Filepath & " -o kml,deficon=http://maps.google.ca/mapfiles/kml/pal4/icon57.png,labels=0 -F " & $Output_Path & " -o gpx,labels=0 -F " & $Output_Path2)

I can’t find any other information and I am stymied. The file is useless in Google Earth because the labels obfuscate the points. Your suggestions would be appreciated.

Thanks,

Jon


Here’s a sample of the output from the KML file:

<?xml version="1.0" encoding="UTF-8"?>
  <Document>
    <name>GPS device</name>
    <snippet>Created Fri Feb 17 12:51:48 2017</snippet>
    <LookAt>
      <longitude>-88.744287</longitude>
      <latitude>29.898215</latitude>
      <range>2529510.966711</range>
    </LookAt>
    <!-- Normal waypoint style -->
    <Style id="waypoint_n">
      <IconStyle>
        <Icon>
        </Icon>
      </IconStyle>
    </Style>
    <!-- Highlighted waypoint style -->
    <Style id="waypoint_h">
      <IconStyle>
        <scale>1.2</scale>
        <Icon>
        </Icon>
      </IconStyle>
    </Style>
    <StyleMap id="waypoint">
      <Pair>
        <key>normal</key>
        <styleUrl>#waypoint_n</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#waypoint_h</styleUrl>
      </Pair>
    </StyleMap>
    <Folder>
      <name>Waypoints</name>
      <Placemark>
        <name>061802 Debbie Curtin Park Walkway and Site Improvements $75.00</name>
        <Style>
          <IconStyle>
            <Icon>
            </Icon>
          </IconStyle>
        </Style>
        <Point>
          <coordinates>-80.370053,25.554610</coordinates>
        </Point>
      </Placemark>
      <Placemark>
        <name>061804 Seventh Avenue Transit Village II $55.00</name>
        <Style>
          <IconStyle>
            <Icon>
            </Icon>
          </IconStyle>
        </Style>
        <Point>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Loading...