Free Support Forum - aspose.com

Reading GPX waypoints with Timestamp of each waypoint


#1

Can you share if we can read way points along with the specified time stamp against each way point in a gpx file? If yes, please share sample code along with some test gpx file.


#2

@kashif.iqbal

If the GPX file contains waypoints, then it’s possible to read them this way:

var layer = VectorLayer.Open("waypoints.gpx", Drivers.Gpx);
foreach (var feature in layer)
{
    var time = feature.GetValue("time");
    var location = (IPoint)feature.Geometry;
    Console.WriteLine($"[{time}] : {location.X} {location.Y}");
}

For the file waypoints.gpx, this prints

[2018-06-10 9:45:34] : 9.86062421614008 54.9328621088893
[2018-06-10 9:46:03] : 9.86092208681491 54.9329323732085
[2018-06-10 9:46:13] : 9.86187816543752 54.9332774352119
[2018-06-10 9:46:58] : 9.86243984967986 54.9334232616792

Support for reading attributes of individual elements of tracks or routes (as opposed to waypoints) is not implemented now, but planned for future releases. The ID of this issue is GISNET-334. We will keep you updated on the status of implementation of this feature.


#3

Thanks @egoraspose for the information. I couldn’t find any information from your website about support for KMZ. Am I missing something?


#4

@kashif.iqbal,

KMZ is KML compressed with ZIP. You can either

  1. extract the KML file from the archive, or
  2. open a stream to the KML file inside the archive and pass the stream to Aspose.GIS (more details here)