Adding the geographical peaks to Google Earth

My current version of Google earth doesn’t show any peak. I describe below how I imported them from OpenStreetMap. Here is the end result:



  • Download an OSM file for the region you are interested in, for instance from geofabrik. I will use “provence-alpes-cote-d-azur.osm.bz2” here
  • Decompress it:
    bzip2 -d provence-alpes-cote-d-azur.osm.bz2
  • Extract the peaks with Osmosis:
    osmosis -q --rx provence-alpes-cote-d-azur.osm --tf accept-nodes natural=peak --tf reject-ways --tf reject-relations --wx provence-alpes-cote-d-azur-peaks.osm
  • Convert it to KML, removing the timestamps:
    gpsbabel -i osm -f provence-alpes-cote-d-azur-peaks.osm  -x transform,wpt=trk -o kml -F - | grep -vi 'timestamp.*when' > provence-alpes-cote-d-azur-peaks.kml

Finally, open the KML file in Google Earth.

Update 2012-12-04 : you can also modify the OSM file to include the elevation in the names, for a better overview in Google Earth. For that, you will need an XML processor. I use xsltproc here, from libxslt.

<?xml version="1.0"?>

<xsl:stylesheet  xmlns:xsl="" version="1.0">       
  <xsl:output indent="yes" method="xml"/>
  <xsl:template match="/">
    <xsl:apply-templates />
  <xsl:template match="@*|*|processing-instruction()|comment()">
      <xsl:apply-templates select="@*|node()"/>

  <xsl:template match="tag[@k='name']">
    <xsl:element name="tag">
      <xsl:attribute name="k">name</xsl:attribute>
      <xsl:attribute name="v">
        <xsl:value-of select="@v"/>
        <xsl:text> (</xsl:text>
        <xsl:value-of select="../tag[@k='ele']/@v"/>

Before you call gpsbabel, use this XSLT sheet to process the OSM file:

xsltproc peaks.xslt provence-alpes-cote-d-azur-peaks.osm   > provence-alpes-cote-d-azur-peaks-processed.osm

It’s of course possible to optimize this process. If you do, it would be nice to post your improvements here.

This entry was posted in GPS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s