public string GenerateGeoJsonStringFromEntities(IEnumerable <IDTOGeometryHolder> entities) { IList <FeatureWithID> features = new List <FeatureWithID>(); foreach (IDTOGeometryHolder entity in entities) { features.Add(getFeatureWithId(entity)); } TextWriter sw = new StringWriter(); GeoJSONWriter.WritewithID(features, sw); string geoJSONstring = sw.ToString(); return(geoJSONstring); }
public string GenereateGeoJsonStringfromEntities(IEnumerable <IAbschnittGISBase> entities) { IList <FeatureWithID> features = new List <FeatureWithID>(); foreach (IAbschnittGISBase entity in entities) { features.Add(getFeatureWithId(entity)); } TextWriter sw = new StringWriter(); GeoJSONWriter.WritewithID(features, sw); string geoJSONstring = sw.ToString(); return(geoJSONstring); }
public string GetAchsensegmentCollection(string achsensegmentIds) { var splitachsensegmentIds = achsensegmentIds.Split(','); List <FeatureWithID> achsensegmente = new List <FeatureWithID>(); StringWriter sw = new StringWriter(); foreach (string achsensegmentId in splitachsensegmentIds) { AchsenSegment aseg = GetEntityById(Guid.Parse(achsensegmentId)); FeatureWithID feat = new FeatureWithID(); IAttributesTable att = new AttributesTable(); List <FeatureWithID> strassenabschnitte = new List <FeatureWithID>(); foreach (AchsenReferenz achsenreferenz in aseg.AchsenReferenzen.Where(a => a.Erfassungsperiod == historizationService.GetCurrentErfassungsperiod())) { if (achsenreferenz.ReferenzGruppe.StrassenabschnittGIS != null) { FeatureWithID strabsfeat = new FeatureWithID(); IAttributesTable strabsatt = new AttributesTable(); strabsfeat.Id = achsenreferenz.ReferenzGruppe.StrassenabschnittGIS.Id.ToString(); strabsfeat.Geometry = achsenreferenz.ReferenzGruppe.StrassenabschnittGIS.Shape; strabsfeat.Attributes = strabsatt; if (!strassenabschnitte.Contains(strabsfeat)) { strassenabschnitte.Add(strabsfeat); } } } att.AddAttribute("AchsenId", aseg.Achse.Id); att.AddAttribute("AchsenName", aseg.Achse.Name); att.AddAttribute("IsInverted", aseg.IsInverted); att.AddAttribute("Strassenabschnitte", strassenabschnitte); feat.Geometry = aseg.Shape; feat.Id = aseg.Id.ToString(); feat.Attributes = att; achsensegmente.Add(feat); } GeoJSONWriter.WritewithID(achsensegmente, sw); sw.Flush(); return(sw.ToString()); }
public string GenereateGeoJsonStringfromAchsenSegment(IEnumerable <AchsenSegment> entities) { List <FeatureWithID> achsensegmente = new List <FeatureWithID>(); StringWriter sw = new StringWriter(); foreach (var aseg in entities) { FeatureWithID feat = new FeatureWithID(); IAttributesTable att = new AttributesTable(); att.AddAttribute(geoJSONAttribute_AchsenId, aseg.Achse.Id); att.AddAttribute(geoJSONAttribute_AchsenName, aseg.Achse.Name); att.AddAttribute(geoJSONAttribute_IsInverted, aseg.IsInverted); feat.Geometry = aseg.Shape; feat.Id = aseg.Id.ToString(); feat.Attributes = att; achsensegmente.Add(feat); } GeoJSONWriter.WritewithID(achsensegmente, sw); sw.Flush(); return(sw.ToString()); }