CityCyclingEdinburgh Forum » Infrastructure

.GPX editing help needed

(5 posts)
  • Started 6 years ago by dessert rat
  • Latest reply from Frenchy

No tags yet.


  1. dessert rat
    Member

    I know when I've reached the limits of my technical expertise.

    What I want to do doesn't seem to be hard - but clearly not as simple as it should or I'm not as clever as I thought i was.

    'all' i want is to be able to chop off (the end parts) of a .gpx.

    any gurus out there ?

    Posted 6 years ago #
  2. EdinburghCycleCam
    Member

    Aren't .gpx files just text files that you can open in Notepad or similar, and delete the latter parts?

    EDIT: Yup. Just grabbed one of my GPX files from Strava, you can delete the last few <trkpt> tags, using either the <time> element or the lat / long to see when you want to start.


    E.g, the end of my file is:
    <trkpt lat="55.9501000" lon="-3.1765830">
    <ele>46.0</ele>
    <time>2018-07-30T12:30:13Z</time>
    </trkpt>
    <trkpt lat="55.9501340" lon="-3.1766100">
    <ele>46.1</ele>
    <time>2018-07-30T12:30:14Z</time>
    </trkpt>
    <trkpt lat="55.9501620" lon="-3.1766330">
    <ele>46.1</ele>
    <time>2018-07-30T12:30:15Z</time>
    </trkpt>
    </trkseg>
    </trk>
    </gpx>

    You could delete all of that down to the closing trkseg tag to remove the last 3 sample points.

    Posted 6 years ago #
  3. urchaidh
    Member

    What @ECC says, just make sure you everything from the start of the opening '<trkpt...>' tag all the way to the end corresponding closing '</trkpt>' tag for each point you want to remove.

    If the track is already on Strava you can crop and split tracks on their web interface - look for a wee spanner icon.

    Posted 6 years ago #
  4. acsimpson
    Member

    If it's not clear from the previous instructions the part you need to leave at the end of the file is these lines:

    </trkseg>
    </trk>
    </gpx>

    Although it's not relevant for this request I seem to remember that if you are removing the first points that you need to update the time in the headers.

    Posted 6 years ago #
  5. Frenchy
    Member

    Depending on the data in the file, a simple option is uploading it to Strava, using the crop feature and then exporting the resulting GPX file. This will only work if the initial file has time data as well as location data.

    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.


Video embedded using Easy Video Embed plugin