GPX to KML: custom icons (symbols)

View: New views
10 Messages — Rating Filter:   Alert me  

GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Hi everybody,
here is what I'm trying to do: I have created a bunch of custom icons (symbols) for my Garmin GPSMAP 62s (using this info http://garmin.blogs.com/softwareupdates/2010/03/personalize-your-map-with-custom-symbols.html). I'd like to convert my *.gpx waypoint files to Google *.kml in such way that when I open kml in Google Earth (GE) I would see same icons there.

My custom garmin icons are files with names like "\CustomSymbols\my_parking.bmp". This results in waypoints in gpx that have <sym>my_parking</sym> symbol tag. I know that KML and GE support custom icons. If I edit style in KML file produced by GPSBabel like this:

    <!-- Normal waypoint style -->
    <Style id="waypoint_n">
      <IconStyle>
        <Icon>
          <href>/Home/CustomSymbols/my_parking.bmp</href>
        </Icon>
      </IconStyle>
    </Style>

I can see my way points in GE with custom icon. But what I really need is a way to have separate style for each custom icon I've created and for GPSBabel to assign proper style dependent on <sym> value in GPX.

What would be the best way to approach this? Is this something that can be setup in configurations files for GPSBabel or it requires coding? I'm willing to do the coding if no other option and would really appreciate if someone can tell me which source files this would belong too...

Thank you.

Re: GPX to KML: custom icons (symbols)

by tsteven4 :: Rate this Message:

| View Threaded | Show Only this Message

Hi Vosxod,

Out of the box gpsbabel does not support this, and it must be done by
modifying the code.  I regularly do this with a custom version of
gpsbabel.  The module that needs modification is kml.c.  However, I did
not go to the trouble of generalizing my icon handling, so it is
unlikely to be useful to anybody else.  However, with a little more work
I could make gbsbabel read a configuration file to drive the icon
association in the kml writer.

Steve

On 1/11/2012 6:53 PM, Vosxod wrote:

> Hi everybody,
> here is what I'm trying to do: I have created a bunch of custom icons
> (symbols) for my Garmin GPSMAP 62s (using this info
> http://garmin.blogs.com/softwareupdates/2010/03/personalize-your-map-with-custom-symbols.html).
> I'd like to convert my *.gpx waypoint files to Google *.kml in such way that
> when I open kml in Google Earth (GE) I would see same icons there.
>
> My custom garmin icons are files with names like
> "\CustomSymbols\my_parking.bmp". This results in waypoints in gpx that have
> <sym>my_parking</sym>  symbol tag. I know that KML and GE support custom
> icons. If I edit style in KML file produced by GPSBabel like this:
>
>      <!-- Normal waypoint style -->
>      <Style id="waypoint_n">
>        <IconStyle>
>          <Icon>
>            <href>/Home/CustomSymbols/my_parking.bmp</href>
>          </Icon>
>        </IconStyle>
>      </Style>
>
> I can see my way points in GE with custom icon. But what I really need is a
> way to have separate style for each custom icon I've created and for
> GPSBabel to assign proper style dependent on<sym>  value in GPX.
>
> What would be the best way to approach this? Is this something that can be
> setup in configurations files for GPSBabel or it requires coding? I'm
> willing to do the coding if no other option and would really appreciate if
> someone can tell me which source files this would belong too...
>
> Thank you.

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@...
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc

Re: GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Hi Steve,
while I agree that not many people would go to trouble creating their own custom icons I think quite a few people would like to see standard Garmin icons when they open their waypoints in GE. Not just the same 'flag' icon, like every conversion tool of the web does right now, including GPSBabel. I've see quite a few people asking to see proper icons on various web forums...

Technically mapping standard Garmin 'Picnic Area' icon to a 'waypoint_picnic_area' style would not be any different that mapping 'my_picnic_area' custom icon. I looked everywhere I could and no other tool does this obvious thing. If you (or anyone) could create such mapping and make if config-file-driven (i.e. have a simple text config that says that GPX 'blah' icon should map to KML 'blah' style with 'blah.png' or 'blah.bmp' picture) I would gladly help (maybe I can work on mapping config file for standard icons or icons themselves).

tsteven4 wrote:
Hi Vosxod,

Out of the box gpsbabel does not support this, and it must be done by
modifying the code.  I regularly do this with a custom version of
gpsbabel.  The module that needs modification is kml.c.  However, I did
not go to the trouble of generalizing my icon handling, so it is
unlikely to be useful to anybody else.  However, with a little more work
I could make gbsbabel read a configuration file to drive the icon
association in the kml writer.

Steve

Re: GPX to KML: custom icons (symbols)

by Gerhard.Lesch :: Rate this Message:

| View Threaded | Show Only this Message

I am glad that there are other people also fiddling with Garmin icons!
I have a Garmin GSP60, a solid bare bones machine that suits and serves
me fine.  It has space "reserved" for custom icons, but until now I
could not find a way to poke my custom Mapsource icons into that space
"reserved" for custom icons.  Any help from you?

Gerhard Lesch
Selfoon / Mobile +27(0) 83 286 1194
Kantoor / Office +27(0) 12 315 2840

-----Original Message-----
From: Vosxod [mailto:open56123@...]
Sent: 12 January 2012 16:45
To: gpsbabel-misc@...
Subject: Re: [Gpsbabel-misc] GPX to KML: custom icons (symbols)


Hi Steve,
while I agree that not many people would go to trouble creating their
own custom icons I think quite a few people would like to see standard
Garmin icons when they open their waypoints in GE. Not just the same
'flag' icon, like every conversion tool of the web does right now,
including GPSBabel.
I've see quite a few people asking to see proper icons on various web
forums...

Technically mapping standard Garmin 'Picnic Area' icon to a
'waypoint_picnic_area' style would not be any different that mapping
'my_picnic_area' custom icon. I looked everywhere I could and no other
tool does this obvious thing. If you (or anyone) could create such
mapping and make if config-file-driven (i.e. have a simple text config
that says that GPX 'blah' icon should map to KML 'blah' style with
'blah.png' or 'blah.bmp'
picture) I would gladly help (maybe I can work on mapping config file
for standard icons or icons themselves).


tsteven4 wrote:
>
> Hi Vosxod,
>
> Out of the box gpsbabel does not support this, and it must be done by
> modifying the code.  I regularly do this with a custom version of
> gpsbabel.  The module that needs modification is kml.c.  However, I
> did not go to the trouble of generalizing my icon handling, so it is
> unlikely to be useful to anybody else.  However, with a little more
> work I could make gbsbabel read a configuration file to drive the icon

> association in the kml writer.
>
> Steve
>

--
View this message in context:
http://old.nabble.com/GPX-to-KML%3A-custom-icons-%28symbols%29-tp3312406
0p33128196.html
Sent from the GPSBabel - General mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@...
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@...
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc

Re: GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Aha!
I think we are closer than we think to my dream! :) There is a place in the code that maps waypoint to the style (kml.ca line 1127, just under // Icon - but only if it looks like a URL. comment). In there it checks if waypointp->icon_descr resembles a URL and if so it just makes a waypoint with direct link to URL instead of referring to the style. Great! I even tried to hack my test gpx file to have    

<sym>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</sym>

GPSBabel created perfect KML that points to the same picture just for this one waypoint!

Sooo, most elegant way to do this, I think, would be to have two more parameters for KML:

opt_localicons, boolean
opt_localicons_path, string

and change same place in the code (the if statement) to say that if opt_localicons then also put a URL style icon with opt_localicons_path + waypointp->icon_descr as a URL string! That's it :)

I would do this right now myself but I dont have a setup yet. Working on WinXP machine here and probably need to get GNU C to build GPSBabel...

tsteven4 wrote:
...The module that needs modification is kml.c.

Re: GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Stay with us Gerhard, we are pretty close to get it done!

Re: GPX to KML: custom icons (symbols)

by Robert Lipe-4 :: Rate this Message:

| View Threaded | Show Only this Message



On Thu, Jan 12, 2012 at 9:19 AM, Vosxod <open56123@...> wrote:

Aha!
I think we are closer than we think to my dream! :) There is a place in the
code that maps waypoint to the style (kml.ca line 1127, just under // Icon -
but only if it looks like a URL. comment). In there it checks if
waypointp->icon_descr resembles a URL and if so it just makes a waypoint
with direct link to URL instead of referring to the style. Great! I even
tried to hack my test gpx file to have

<sym>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</sym>

GPSBabel created perfect KML that points to the same picture just for this
one waypoint!

Sooo, most elegant way to do this, I think, would be to have two more
parameters for KML:

I don't think so.  If you insist on making KML that works only on your machine, provide a valid URI to it.

file:///Home/CustomSymbols/my_parking.bmp  

should filter through to the KML correctly.


Arbitrary mappings of icons is really hard.   For things that have fixed icon sets, we try to map Magellan's "Home" to Garmin's "Residence", for example.   But custom icons in KML where they can be any ole picture (that's sized sensibly) or Garmin's "Custom 0" which could be a picture of a fish or a picture of a house make things very wacky.   Even though you named your icon "my_parking.bmp", we don't really have a way to divine that it's not a picture of a fish in that bitmap that to http://maps.google.com/mapfiles/kml/shapes/$WHATEVER is a better idea.


With that said, if Garmin had a web-accessible version of their icons online in a size that was usable in Earth and in a static place, I'd totally make our KML writer generate references to those.   But I don't want to run afoul of their copyrighted artwork.

RJL

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@...
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc

Re: GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Robert Lipe-4 wrote:
I don't think so.  If you insist on making KML that works only on your
machine, provide a valid URI to it.

file:///Home/CustomSymbols/my_parking.bmp

should filter through to the KML correctly.
Yes, that was my intent. And indeed this works well, so I would need to do one extra step - wrap my symbols in my *.gmx files in file:/// URI. I certainly can do that with text tools.

Robert Lipe-4 wrote:
Arbitrary mappings of icons is really hard.   ...   Even though you
named your icon "my_parking.bmp", we don't really have a way to divine that
it's not a picture of a fish in that bitmap ...
I understand. So why go there? Leave this for local user to resolve. The user would know what is his my_whater icon is. And would deal with copyrights-and-what-not issues. All these two additional parameters would do is to tell GPSBabel that resulting KML waypoint should interpret icon_descr as a file name and use second parameter as a wrapper (could even be wild card expression like 'file:///mypath/%s.bmp').

Re: GPX to KML: custom icons (symbols)

by Vosxod :: Rate this Message:

| View Threaded | Show Only this Message

Robert Lipe-4 wrote:
How is this different that what we do now automatically?

If it looks like a URI, we treat it as a URI.  Otherwise it's just words.   No flag needed, right?

"Fish" is a Placemark named "Fish"
"file://path/to/my/icon.png" is a Placemark with that as an icon.


It's also worth a callout that if you plan to share the resulting KML with anyone, references to files on your local drive will be a problem.  Google Earth can slurp those up and include them when it saves as a *.KMZ, but we can't.
The difference is that Garmin produces GPX with <sym>my_parking</sym> in it, not <sym>file:///mypath/my_parking.bmp</sym>. So without additional editing GPSBabel will not make a link to a local icon file and GE will not show it. I do not intend to share KMLs with anyone, but if I wanted to I'd share source *.GPX that would not have reference to local icons.

Re: GPX to KML: custom icons (symbols)

by Robert Lipe-4 :: Rate this Message:

| View Threaded | Show Only this Message

The difference is that Garmin produces GPX with <sym>my_parking</sym> in it,
not <sym>file:///mypath/my_parking.bmp</sym>. So without additional editing
GPSBabel will not make a link to a local icon file and GE will not show it.

Ah, yes.  In that case that editing is indeed necessary.

something like sed -e 's#<sym>\(.*\)</sym>#<sym>file://whatever/\\1.bmp<sym># ' would automate that easily enough.


This seems specialized enough that I'd rather not add an option to our KML writer to handle this for you.  As mentioned above, though, since it's open source, you're welcome to do it in your own copy as you seem to be all over the code in question.

RJL

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@...
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc