private string AggregateAtomPayloadFromWkt(String spatialTypeName, String[] wktData, String edmName) { StringBuilder payload = new StringBuilder(); payload.Append(@"<entry xml:base=""http://pqianvm2:34688/TheTest/"" xmlns=""http://www.w3.org/2005/Atom"" xmlns:d=""http://docs.oasis-open.org/odata/ns/data"" xmlns:m=""http://docs.oasis-open.org/odata/ns/metadata"" xmlns:georss=""http://www.georss.org/georss"" xmlns:gml=""http://www.opengis.net/gml""> <id>http://pqianvm2:34688/TheTest/Entities(0)</id> <category term=""#AstoriaUnitTests.Tests.EntityType"" scheme=""http://docs.oasis-open.org/odata/ns/scheme"" /> <link rel=""edit"" title=""EntityType"" href=""Entities(0)"" /> <title /> <updated>2011-10-21T22:47:02Z</updated> <author> <name /> </author> <content type=""application/xml""> <m:properties> <d:ID m:type=""Edm.Int32"">0</d:ID>"); XmlWriter writer = XmlWriter.Create(payload, new XmlWriterSettings() { ConformanceLevel = ConformanceLevel.Fragment }); var gmlWriter = gmlFormatter.CreateWriter(writer); for (int i = 0; i < wktData.Length; ++i) { payload.AppendFormat("<d:{0}{1} m:type=\"{2}\">", spatialTypeName, i, edmName); wktFormatter.Read <Geometry>(new StringReader(wktData[i]), gmlWriter); writer.Flush(); payload.AppendFormat("</d:{0}{1}>", spatialTypeName, i); } payload.Append("</m:properties></content></entry>"); return(payload.ToString()); }
/// <summary> /// Convert GeoJson to GML /// </summary> /// <param name="source">GeoJson Dictionary</param> /// <param name="target">XmlWriter that outputs Gml</param> private static void GeoJsonToGml(Dictionary <string, object> source, XmlWriter target) { GeoJsonObjectFormatter sourceFormatter = GeoJsonObjectFormatter.Create(); GmlFormatter targetFormatter = GmlFormatter.Create(); var converted = ConvertFromDispatch(source); sourceFormatter.Read <Geography>(converted).SendTo(targetFormatter.CreateWriter(target)); }