public string KML([System.Web.Http.FromBody] UploadData uploadData) { KMLCreator kmlCreator = new KMLCreator(); byte[] bytes = kmlCreator.Create(uploadData.data); string[] fileInfo = byteArrayToFileInfo(bytes, "kml"); return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]); }
public string KML(string json) { KMLCreator kmlCreator = new KMLCreator(); byte[] bytes = kmlCreator.Create(json); string[] fileInfo = byteArrayToFileInfo(bytes, "kml"); return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]); }
public string KML(string json) { _log.DebugFormat("Received json: {0}", json); // try to decode input string to see if it is base64 encoded try { byte[] decoded = Convert.FromBase64String(json); json = System.Text.Encoding.UTF8.GetString(decoded); _log.DebugFormat("json after decode: {0}", json); } catch (Exception e) { _log.DebugFormat("Could not decode base64. Will treat as non-base64 encoded: {0}", e.Message); } KMLCreator kmlCreator = new KMLCreator(); byte[] bytes = kmlCreator.Create(json); string[] fileInfo = byteArrayToFileInfo(bytes, "kml"); return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]); }
public ActionResult KML(string json) { KMLCreator kmlCreator = new KMLCreator(); return(File(kmlCreator.Create(json), "application/vnd.google-earth.kml+xml", "kartexport.kml")); }