public ActionResult DigitizeMap(HttpPostedFileBase file, long eventId) { if (file != null && file.ContentLength > 0) { try { XmlReader reader = XmlReader.Create(file.InputStream); XDocument xDoc = System.Xml.Linq.XDocument.Load(reader); KMLParser kmlParser = new KMLParser(); kmlParser.Parse(xDoc, eventId); ViewBag.Message = "File is uploaded and parsed successfully"; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { ViewBag.Message = "You have not specified a file."; } var model = events.GetAll(); ViewBag.year = model.Max(x => x.year); ViewBag.eventId = eventId; return(View(model)); }
private void RenderKML() { var path = NSBundle.MainBundle.PathForResource("KML_Sample", "kml"); var url = new NSUrl(path, isDir: false); var parser = new KMLParser(url); parser.Parse(); var renderer = new GeometryRenderer(mapView, parser.Placemarks, parser.Styles); renderer.Render(); }
public ActionResult DigitizeMap_parse(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { try { XmlReader reader = XmlReader.Create(file.InputStream); XDocument xDoc = System.Xml.Linq.XDocument.Load(reader); kmlParser.Parse(xDoc); ViewBag.Message = "File is uploaded and parsed successfully"; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { ViewBag.Message = "You have not specified a file."; } return(View()); }
public ActionResult DigitizeMap(HttpPostedFileBase file, long eventId) { long sessionID = sessionService.GetSessionID(this.HttpContext, true, true); if (file != null && file.ContentLength > 0) { try { XmlReader reader = XmlReader.Create(file.InputStream); XDocument xDoc = System.Xml.Linq.XDocument.Load(reader); KMLParser kmlParser = new KMLParser(); kmlParser.Parse(xDoc, eventId); ViewBag.Message = "File is uploaded and parsed successfully"; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { ViewBag.Message = "You have not specified a file."; } var model = events.GetAll(); if (eventId == -1) { eventId = model.Where(x => x.year == (DateTime.Now.Year + 1)).First <ipmevent>().ID; } ViewBag.eventId = eventId; var year = model.Where(m => m.ID == eventId).First <ipmevent>().year; ViewBag.year = year; return(View(model)); }