Skip to content

Uncaught TypeError when loading trkseg with only one trkpt #115

@Nzara

Description

@Nzara
leaflet-omnivore.js:1019 Uncaught TypeError: Cannot read property 'line' of undefined
    at getTrack (leaflet-omnivore.js:1019)
    at Object.gpx (leaflet-omnivore.js:991)
    at gpxParse (leaflet-omnivore.js:213)
    at XMLHttpRequest.onload (leaflet-omnivore.js:114)
    at XMLHttpRequest.loaded (leaflet-omnivore.js:395)

after omnivore.gpx("x.gpx")

The file contains a trkseq with only only one trkpnt. Unfortunately this problem stops reading all other segments too.

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gte="http://www.gpstrackeditor.com/xmlschemas/General/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" targetNamespace="http://www.topografix.com/GPX/1/1" elementFormDefault="qualified" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
	<name>Name</name>
</metadata>
<trk>
	<name>a</name>
	<trkseg>
		<trkpt lat="47.632548" lon="13.002907">
			<ele>628.00</ele>
			<time>2011-09-10T10:59:03Z</time>
		</trkpt>
		<trkpt lat="47.632547" lon="13.003172">
			<ele>627.50</ele>
			<time>2011-09-10T10:59:06Z</time>
		</trkpt>
	</trkseg>
	<trkseg>
		<trkpt lat="47.632492" lon="13.003522">
			<ele>626.50</ele>
			<time>2011-09-10T10:59:10Z</time>
		</trkpt>
	</trkseg>
	<trkseg>
		<trkpt lat="47.632450" lon="13.003592">
			<ele>626.00</ele>
			<time>2011-09-10T10:59:11Z</time>
		</trkpt>
		<trkpt lat="47.632410" lon="13.003725">
			<ele>626.50</ele>
			<time>2011-09-10T10:59:13Z</time>
		</trkpt>
	</trkseg>
</trk>
</gpx>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions