Giter Site home page Giter Site logo

latitude2gpx's Introduction

latitude2gpx

A Clojure library designed to take KML files generated Google Location History (previously known as Google Latitude) and turns them into GPX tracklogs.

Example

Input

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
    <Document>
        <name>Location history from 07/17/2013 to 08/16/2013</name>
        <open>1</open>
        <description/>
        <StyleMap id="multiTrack">
            <Pair>
                <key>normal</key>
                <styleUrl>#multiTrack_n</styleUrl>
            </Pair>
            <Pair>
                <key>highlight</key>
                <styleUrl>#multiTrack_h</styleUrl>
            </Pair>
        </StyleMap>
        <Style id="multiTrack_n">
            <IconStyle>
                <Icon>
                    <href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
                </Icon>
            </IconStyle>
            <LineStyle>
                <color>99ffac59</color>
                <width>6</width>
            </LineStyle>
        </Style>
        <Style id="multiTrack_h">
            <IconStyle>
                <scale>1.2</scale>
                <Icon>
                    <href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
                </Icon>
            </IconStyle>
            <LineStyle>
                <color>99ffac59</color>
                <width>8</width>
            </LineStyle>
        </Style>
        <Placemark>
            <name>Latitude User</name>
            <description>Location history for Latitude User from 07/17/2013 to 08/16/2013</description>
            <styleUrl>#multiTrack</styleUrl>
            <gx:Track>
                <altitudeMode>clampToGround</altitudeMode>
                <when>2013-07-16T16:01:54.272-07:00</when>
                <gx:coord>-1.121163 52.6527182 0</gx:coord>
                <when>2013-07-16T16:02:54.544-07:00</when>
                <gx:coord>-1.122447 52.6536466 0</gx:coord>
                <when>2013-07-16T16:03:55.214-07:00</when>
                <gx:coord>-1.1211383 52.6588637 0</gx:coord>
                <when>2013-07-16T16:05:14.345-07:00</when>
                <gx:coord>-1.1097693 52.6654192 0</gx:coord>
            </gx:Track>
        </Placemark>
    </Document>
</kml>

Output

<?xml version="1.0"?>
<gpx creator="latitude2gpx" version="1.0" schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2013-08-19 10:45:00.319+0100</time>
<trk>
    <trkseg>
        <trkpt lon="-1.121163" lat="52.6527182">
            <ele>0</ele>
            <time>2013-07-16T16:01:54.272-07:00</time>
        </trkpt>
        <trkpt lon="-1.122447" lat="52.6536466">
            <ele>0</ele>
            <time>2013-07-16T16:02:54.544-07:00</time>
        </trkpt>
        <trkpt lon="-1.1211383" lat="52.6588637">
            <ele>0</ele>
            <time>2013-07-16T16:03:55.214-07:00</time>
        </trkpt>
        <trkpt lon="-1.1097693" lat="52.6654192">
            <ele>0</ele>
            <time>2013-07-16T16:05:14.345-07:00</time>
        </trkpt>
    </trkseg>
</trk>
</gpx>

Usage

Leiningen

If you're using Leinigen then you can clone this repo and just type lein run

Standalone

If you want to distribute this standalone then you can use lein uberjar to create a jar file that users can call by typing java -cp latitude2gpx-VERSION.jar

Options

 Switches               Default  Desc                              
 --------               -------  ----                              
 -h, --no-help, --help  false    Show help                         
 -i, --input                     REQUIRED: Input latitude KML FILE 
 -o, --output                    REQUIRED: Output GPX FILE    

License

Copyright © 2013 Ravi Kotecha

Distributed under the Eclipse Public License, the same as Clojure.

latitude2gpx's People

Contributors

r4vi avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

nksg martinluck

latitude2gpx's Issues

Latitude format has changed

This tool doesn't work anymore because the latitude format has changed. They still give us KML but in the form of tracks with a start and end time and a series of points.

This is not as useful as the old format or each point + time.

I'm not sure how to fix, we could interpolate the times of the track each point but I'm not sure that'll be accurate enough.

I see you've forked @martinluck - are you planning on fixing it? I'm happy to take changes back from your repo if just add you as a contributor here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.