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 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"?>
<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>

and the tcx like this

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<TrainingCenterDatabase xmlns="" xmlns:xsi="" xsi:schemaLocation=" ... basev2.xsd">

<CourseFolder Name="Courses">

<AverageHeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
<MaximumHeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
<HeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">

<Author xsi:type="Application_t">
<Name>Garmin Training Center(TM)</Name>
<Time>Mar 15 2007, 12:31:45</Time>


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 which may well do what you want.