I have a KML file with a bunch of (lat,lon) pairs. I can retrieve the pairs by importing the KML file as "Data" and drilling down into it:
Import["mykml.kml","Data"][[1,2,2,1,1]]
This yields a GeoPosition
object with the (lat,lon) points. Passing this to GeoDistance
calculates the length of the path, which is what I'm after.
Now I want to CloudDeploy
a FormFunction
so other folks can run GeoDistance
on their own KML files; something like
form = FormFunction["yourfile" -> "KML", GeoDistance[#yourfile] &]
CloudDeploy[form, Permissions -> "Public"]
The problem is that the FormFunction
imports the KML file without the extra "Data"
specifier, so that #yourfile
is some map object instead of a data structure I can drill down into.
How can I tell FormFunction
to import the "Data"
in the KML file, and not perform the default importing action?