mapbox / mapbox/togeojson

toGeoJSON.kml is not a function ?

Open
#152 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.3k
Forks
322
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am getting error "toGeoJSON.kml is not a function" in Widgets.js.
at this line

`var geojson = toGeoJSON.kml(dom);
`
```
define(
[
'libs/togeojson',
...
....
],
function (toGeoJSON,
...,
...) {
importGPXorKML: function (event) {
debugger;
var content = event.target.result;

try {
var dom = (new DOMParser()).parseFromString(content, 'text/xml');
}
catch (err) {
this.message("The input file is not a file " + this._current_file_extension + " valide.");
this.loading(false);
}
this._createResultLi();
if (this._current_file_extension == "gpx")
var geojson = toGeoJSON.gpx(dom);
else {
this.registerKmlStyles(dom);
var geojson = toGeoJSON.kml(dom);
}

this.addGeojson(geojson);
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start in Widgets.js at the AMD dependency on libs/togeojson and reproduce the KML path that calls toGeoJSON.kml(dom). Inspect how that dependency is loaded and what value it provides, then verify the KML import completes without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.