/android-gpx-parser

A library to parse XML Gpx files, built for Android.

Primary LanguageJavaApache License 2.0Apache-2.0

Android GPX Parser

A library to parse XML Gpx files, built for Android. The reference schema is the Topografix GPX 1.1.

Android Arsenal

Projects using this library:

To have your project listed here, send me an email or open a PR.

Download

Add the Jitpack repository to your root build file. The way you do this depends on the Gradle plugin you are using:

// for gradle plugin 7.0.0 or newer (default for new apps since Android Studio Artic Fox)
// in settings.gradle
dependencyResolutionManagement {
    ...
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
// for older versions, in project-level build.gradle
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Finally, in your dependencies list

dependencies {
    implementation 'com.github.ticofab:android-gpx-parser:2.0.1'
}

Dependencies

Usage

Get a parser instance:

GPXParser mParser = new GPXParser(); // consider injection

Then, given an InputStream:

Gpx parsedGpx = null;
try {
    InputStream in = getAssets().open("test.gpx");
    parsedGpx = mParser.parse(in); // consider using a background thread
} catch (IOException | XmlPullParserException e) {
    // do something with this exception
    e.printStackTrace();
}
if (parsedGpx == null) {
    // error parsing track
} else {
    // do something with the parsed track
    // see included example app and tests
}

Contribute

Contributions are welcome! Please check the issues and open a pull request when done: you will have made the world a better place.

License

Copyright 2015 - 2021 Fabio Tiriticco - Fabway

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.