I am trying to see if it is possible to upload a KML layer to display on the map. I have looked into using
KMLLayer, but that requires a public URL to load in, and I can't use the file path of the file for security reasons (and because modern browsers change it to "c:\fakepath\file.kml" anyways for that very reason).
I tried to see if I can do client side conversion from KML to GeoJSON with
gtran-kml and from GeoJSON to ArcGIS Geometry with
arcgis-to-geojson-utils, but whenever I try to load the modules with
require after installing them with
npm, I keep on getting a module defined error in the console. I saw that it was trying to pull the module from the ArcGIS API. So I tried looking through the
require.config file to see if it was set to the API, and it doesn't appear so. Using
./gtran-kml instead of
gtran-kml went to the root URL, but still gave the same error being thrown by ArcGIS's
init.js file. I don't know if this is an issue with
npm, with not installing in the correct directory, with not calling modules correctly (I used
var a = require('gtran-kml') then
a.fnName to use it), or all three.