jenetics / jpx

JPX - Java GPX library
Apache License 2.0
202 stars 30 forks source link

Course value isn't written to GPX file. #69

Closed ArneKoeckeritz closed 6 years ago

ArneKoeckeritz commented 6 years ago

I have a class in my Android app which is writing a GPX file out of the location stream from the device location sensor. And there is a counterpart class which is reading the GPX file and creates a location stream out of it.

public final void onLocationChanged(final Location pLocation)
{
    final WayPoint.Builder wayPointBuilder = WayPoint.builder();
    wayPointBuilder.time(pLocation.getTime());
    wayPointBuilder.ele(pLocation.getAltitude());
    wayPointBuilder.speed(pLocation.getSpeed());
    wayPointBuilder.pdop((double) pLocation.getAccuracy());
    wayPointBuilder.course(pLocation.getBearing());
    wayPointBuilder.lat(pLocation.getLatitude());
    wayPointBuilder.lon(pLocation.getLongitude());

    mSegmentBuilder.addPoint(wayPointBuilder.build());
}

But there is a problem. The course data is not written into the GPX file which looks like a bug. Anything i can contribute ?

jenetics commented 6 years ago

The JPX library allows you to read/write GPX files in version 1.0 and 1.1. I'm using the same data structures for both version. But the course value is only read/written in version 1.0. If you are using the default writer, you are writing the GPX file in version 1.1, which doesn't write the course value.

jenetics commented 6 years ago

I might add an implementation note to the Javadoc.

ArneKoeckeritz commented 6 years ago

Good info i will use V1.0. Thank you.