Reading Local KML files in javascript

3576
2
08-24-2017 02:20 AM
akshayloya
Occasional Contributor II

Do we have any tool or widget available or api's to read local kml file instead of from some URL? I desperately need it it. Couldn't find the reference anywhere.

Kindly help.

Regards,

Akshay Loya

0 Kudos
2 Replies
ThomasSolow
Occasional Contributor III

I don't know of any Esri software that does this.  My understanding is that all KML parsing is handled on the backend.

There are open source libraries to convert KML into geoJSON, such as: GitHub - mapbox/togeojson: convert KML and GPX to GeoJSON, without the fuss (haven't tried it)

Once you have geoJSON you can turn that into a feature collection easily enough.

LefterisKoumis
Occasional Contributor III

Beginning with Web appbuilder 2.7 you can read local KML through the AddData widget. So, refer to the AddFromFilePane.js how is done.