npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gx-begone

v0.1.0

Published

Convert Google's proprietary gx-prefixed KML format (output my My Tracks) to standard KML.

Downloads

4

Readme

gx-begone

Convert Google's proprietary gx-prefixed KML format (output by My Tracks) to standard KML.

Usage

Both of these conversion solutions use the xsltproc command-line xslt-processing tool. Depending on how nice you want the output to be, you may also want xmllint or json for NodeJS.

gx:KML → KML

To turn my.kml into my_better.kml:

xsltproc gx-begone.xslt /path/to/my.kml | xmllint --format - > my_better.kml

The command-line tool xmllint is used to make the output nicer, but you can leave it off if you don't care about that.

gx:KML → GeoJSON

To turn my.kml into my.geojson, run the following commands from the root directory of this repo:

npm install                # install json nodejs tool
xsltproc gx-to-geojson.xslt /path/to/my.kml | nodejs ./node_modules/.bin/json > my.json

The json command line tool is used to prettify the json output of gx-to-geojson.xslt.

Note that you will need NodeJS installed on your system to use the above json prettifier.

Ta da! Now you can view your GeoJSON or KML in QGIS or transform it into other formats using ogr2ogr.

The Problem

Google introduced KML several years ago to store data for display in Google Earth and Google Maps. Since it was adapted as an international standard by the Open Geospatial Consortium (OGC) in 2008, lots of open tools have been developed for viewing KML and converting it to other popular formats. In particular, the conversion tool ogr2ogr can convert standard KML to a wide range of other formats.

However, with Google Earth 5.0, released in 2009/2010, Google introduced a new "gx" namespace not part of the OGC standard.

Google Earth saves KML documents using elements from this new "gx" namespace, as does Google's My Tracks Android application. As of July 2014, Google's extended namespace is not supported by other open tools, so these files can only be opened in Google Earth and Google Maps.

What a pain.

The Solution

This repository provides two xslt files for transforming Google-prefixed KML produced by My Tracks to standard KML and GeoJSON. Be warned: this conversion is lossy: the KML files output by My Tracks include timestamp data and velocity data that standard KML does not yet have a good way of recording.

Conversion loss: * gx:KML -> KML converter only extracts the path (it loses the timestamps and velocity data) * gx:KML -> GeoJSON converter extracts path and timestamps (it places the timestamps in an array in the "properties" object of the "GeoJSON Feature", and loses the velocity data.)

If you need this data, send me a message asking me to include this in the conversion, or submit a pull request.

Javascript Converter

I spent some time working on a Javascript converter using xmldom and xpath. I put that aside in favor of the quicker xslt-based approach, but if you're interested, you can view the code in the javascript branch in this repo.