private string createGeoObject(NetTopologySuite.Features.IAttributesTable atr, NetTopologySuite.Geometries.Geometry geo) { var jsonObj = new { gml_id = atr.GetOptionalValue("gml_id"), id_lokalId = atr.GetOptionalValue("id_lokalid"), geo = geo.ToString() }; var jsonDoc = JsonConvert.SerializeObject(jsonObj); return(jsonDoc); }
private JObject createGeoObject(NetTopologySuite.Features.IAttributesTable atr, NetTopologySuite.Geometries.Geometry geo, string geoType) { string jsonDoc = ""; if (geoType == "vejmidte") { var jsonObj = new { gml_id = atr.GetOptionalValue("gml_id"), id_lokalId = atr.GetOptionalValue("id_lokalid"), roadCategory = atr.GetOptionalValue("vejkategori"), trafficType = atr.GetOptionalValue("trafikart"), geo = geo.ToString(), type = geoType }; jsonDoc = JsonConvert.SerializeObject(jsonObj); } else if (geoType == "bebyggelse") { var jsonObj = new { gml_id = atr.GetOptionalValue("gml_id"), id_lokalId = atr.GetOptionalValue("id_lokalid"), areaType = atr.GetOptionalValue("bebyggelsestype"), name = atr.GetOptionalValue("navn_1_skrivemaade"), population = atr.GetOptionalValue("indbyggertal"), geo = geo.ToString(), type = geoType }; jsonDoc = JsonConvert.SerializeObject(jsonObj); } else if (geoType == "soe") { var jsonObj = new { gml_id = atr.GetOptionalValue("gml_id"), id_lokalId = atr.GetOptionalValue("id_lokalid"), lakeType = atr.GetOptionalValue("soetype"), minimumSize = atr.GetOptionalValue("underminimumsoe"), geo = geo.ToString(), type = geoType }; jsonDoc = JsonConvert.SerializeObject(jsonObj); } else { var jsonObj = new { gml_id = atr.GetOptionalValue("gml_id"), id_lokalId = atr.GetOptionalValue("id_lokalid"), geo = geo.ToString(), type = geoType }; jsonDoc = JsonConvert.SerializeObject(jsonObj); } //_logger.LogInformation(jsonDoc); var geoObject = JObject.Parse(jsonDoc); return(geoObject); }