Giter Club home page Giter Club logo

android-gpx-parser's Introduction

Android Arsenal

Android GPX Parser

Table of Contents:

  1. Description
  2. Module Structures
  3. Projects using this library
  4. Download
  5. Dependencies
  6. Usage
  7. License

Description

A library to parse GPX files, built for Android. The reference schema is the Topografix GPX 1.1.
In addition, it parses the speed extension, when provided as a double number.

GPX is an XML file format to represent GPS data: coordinates, routes, waypoints, and more.

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

Module Structure

  1. App: an example usage of the library.
  2. Parser: the library itself.

Projects using this library:

To have your project listed here, please 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.

If using 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 verions of Gradle:

// 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.3.1'
}

Dependencies

The following is an open github repo that has date and time handling. Keep in mind that the following dependency also has dependencies of its own.

Usage

In Java:

GPXParser parser = new GPXParser(); // consider injection
Gpx parsedGpx = null;
try {
    InputStream in = getAssets().open("test.gpx");
    parsedGpx = parser.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
}

In Kotlin:

val parser = GPXParser() // consider injection
try {
    val input: InputStream = getAssets().open("test.gpx")
    val parsedGpx: Gpx? = parser.parse(input) // consider using a background thread
    parsedGpx?.let {
        // do something with the parsed track
        // see included example app and tests
    } ?: {
        // error parsing track
    }
} catch (e: IOException) {
    // do something with this exception
    e.printStackTrace()
} catch (e: XmlPullParserException) {
    // do something with this exception
    e.printStackTrace()
}

License

Copyright 2015 - 2023 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.

android-gpx-parser's People

Contributors

ticofab avatar neevasethi avatar stustirling avatar tkorri avatar gabrielezereik avatar abinpaul1 avatar pygmalion69 avatar savked avatar sebaslogen avatar msbit avatar vincenzovitale-tomtom avatar andreasflosdorf avatar herberlin avatar

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.