Page 1 of 1

Calculate altitude differences per Kilometer

PostPosted: Sat May 14, 2011 4:35 am
by neilj
I am trying to develop a pacing chart for runners in php. For this i require the difference in the altitude for each kilometer.

I have used a website www.logyourun.com to trace a route of the Comrades Marathon, an 89km race from Durban to Pietermaritzburg in KwaZulu Natal, South Africa. It is the most important race in the South African running calendar.

From the site I can download 2 files as GPX (Google Earth and others) or TCX (Garmin training center)

The gpx looks like this

<?xml version="1.0"?>
<gpx
version="1.0"
creator="LogYourRun http://www.logyourrun.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<name>ComradesMarath</name><trkseg>
<trkpt lat="-29.85818" lon="31.02515"></trkpt>
<trkpt lat="-29.85981" lon="31.02209"></trkpt>
<trkpt lat="-29.86025" lon="31.01924"></trkpt>
<trkpt lat="-29.86082" lon="31.01580"></trkpt>
.
.
<trkpt lat="-29.61087" lon="30.38074"></trkpt>
<trkpt lat="-29.61084" lon="30.38092"></trkpt>
</trkseg></trk>
</gpx>

and the tcx like this

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/Traini ... basev2.xsd">

<Folders>
<Courses>
<CourseFolder Name="Courses">
<CourseNameRef>
<Id>ComradesMarath</Id>
</CourseNameRef>
</CourseFolder>
</Courses>
</Folders>

<Courses>
<Course>
<Name>ComradesMarath</Name>
<Lap>
<TotalTimeSeconds>1310.400000</TotalTimeSeconds>
<DistanceMeters>87999.8955264</DistanceMeters>
<BeginPosition>
<LatitudeDegrees>-29.85902</LatitudeDegrees>
<LongitudeDegrees>31.02680</LongitudeDegrees>
</BeginPosition>
<EndPosition>
<LatitudeDegrees>-29.61090</LatitudeDegrees>
<LongitudeDegrees>30.38081</LongitudeDegrees>
</EndPosition>
<AverageHeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
<Value>154</Value>
</AverageHeartRateBpm>
<MaximumHeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
<Value>169</Value>
</MaximumHeartRateBpm>
<Intensity>Active</Intensity>
<Cadence>7</Cadence>
</Lap>
<Track>
<Trackpoint>
<Time>2007-01-01T21:16:42Z</Time>
<Position>
<LatitudeDegrees>-29.85902</LatitudeDegrees>
<LongitudeDegrees>31.02680</LongitudeDegrees>
</Position>
<AltitudeMeters>210.185425</AltitudeMeters>
<DistanceMeters>2.011867</DistanceMeters>
<HeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
<Value>120</Value>
</HeartRateBpm>
<SensorState>Absent</SensorState>
</Trackpoint>
.
.
</Track>
</Course>
</Courses>

<Author xsi:type="Application_t">
<Name>Garmin Training Center(TM)</Name>
<Build>
<Version>
<VersionMajor>3</VersionMajor>
<VersionMinor>2</VersionMinor>
<BuildMajor>3</BuildMajor>
<BuildMinor>0</BuildMinor>
</Version>
<Type>Release</Type>
<Time>Mar 15 2007, 12:31:45</Time>
<Builder>SQA</Builder>
</Build>
<LangID>EN</LangID>
<PartNumber>000-A0000-00</PartNumber>
</Author>

</TrainingCenterDatabase>

I need to plot the run and then extract the altitude for each kilometer from the start.

Can anyone help with this.

PostPosted: Sat May 14, 2011 7:10 am
by MartyBartfast
Cant help with the php, but if you don't want to reinvent the wheel have a look at http://www.gpsvisualizer.com/ which may well do what you want.