Class GPXDocument

java.lang.Object
com.here.NativeBase
com.here.sdk.navigation.GPXDocument

public final class GPXDocument extends NativeBase

Use the GPXDocument to load the GPX file. Only track data is used from the GPX file format (see trkType at https://www.topografix.com/GPX/1/1/#type_trkType). Any unknown elements in the file are ignored. Any known element with an invalid value returns an error. Elevation values are ignored.

  • Constructor Details

    • GPXDocument

      public GPXDocument(@NonNull String gpxFilePath, @NonNull GPXOptions options) throws InstantiationErrorException

      Create a GPX document from a file.

      Parameters:
      gpxFilePath -

      The path to the GPX file.

      options -

      The options to customize reading.

      Throws:
      InstantiationErrorException -

      Indicates what went wrong when the instantiation was attempted.

    • GPXDocument

      public GPXDocument(@NonNull List<GPXTrack> tracks)

      Create a GPX document from a list of GPX tracks.

      Parameters:
      tracks -

      The list of tracks.

  • Method Details

    • fromString

      @NonNull public static GPXDocument fromString(@NonNull String content, @NonNull GPXOptions options) throws InstantiationErrorException

      Create a GPX document from a string.

      Parameters:
      content -

      The content of a GPX file as string.

      options -

      The options to customize reading.

      Returns:

      An GPXDocument instance.

      Throws:
      InstantiationErrorException -

      Indicates what went wrong when the instantiation was attempted.

    • save

      public boolean save(@NonNull String gpxFilePath)

      Saves the document to a file. For saving the getTracks() modification before writing to a file, use GPXTrackWriter.

      Parameters:
      gpxFilePath -

      The file path where the GPX document will be saved.

      Returns:

      True if the document has been saved successfully. False if an error has been happened during saving.

    • addTrack

      public void addTrack(@NonNull GPXTrack trackToAdd)

      Add track to GPX document.

      Parameters:
      trackToAdd -

      track to add to GPX document

    • getTracks

      @NonNull public List<GPXTrack> getTracks()

      Gets the tracks stored in this GPX document.

      Returns:

      The tracks stored in this GPX document.