Java Parser for reading and writing GPX files
using base from gpxparser
Follows GPX schema version 1.1
Gradle
compile 'me.himanshusoni.gpxparser:gpx-parser:1.13'
// or
implementation 'me.himanshusoni.gpxparser:gpx-parser:1.13'
Maven
<dependency>
<groupId>me.himanshusoni.gpxparser</groupId>
<artifactId>gpx-parser</artifactId>
<version>1.13</version>
<type>pom</type>
</dependency>
Jar
Download Jar and include to your classpath.
To read GPX file:
GPXParser p = new GPXParser();
FileInputStream in = new FileInputStream("inFile.gpx");
GPX gpx = p.parseGPX(in);
To write to GPX file:
GPXWriter writer = new GPXWriter();
FileOutputStream out = new FileOutputStream("outFile.gpx");
writer.writeGPX(gpx, out);
out.close();