geometry文件导出后的xml,在另一台电脑上反向生成geometry
点线面都有自己对应的生成器(MapPointBuilderEx,PolylineBuilderEx,PolygonBuilderEx),我们使用对应生成器中的Fromxml/Fromjson方法反向生成对应的几何。
点
MapPoint minPointImport = MapPointBuilderEx.FromXml(xml);
线
Polyline importPolyline2 = PolylineBuilderEx.FromJson(outputString);
包络线
Envelope envelopeImport = EnvelopeBuilderEx.FromXml(xml);
面
var geometryBag = PolygonBuilderEx.FromXml(mfGeometryXmlNew);
Polygon mfPolygon = geometryBag as Polygon;
其他
const string jsonString = "{\"geometries\":[{\"x\":1,\"y\":2},{\"rings\":[[[0,0],[0,4],[3,4],[3,0],[0,0]]]}],\"spatialReference\":{\"wkid\":4326,\"latestWkid\":4326}}";
//At 2.x - GeometryBag geometryBag = GeometryBagBuilder.FromJson(jsonString);
var geometryBag = GeometryBagBuilderEx.FromJson(jsonString);
string xml = geometryBag.ToXml();
//At 2.x - GeometryBag xmlString = GeometryBagBuilder.FromXML(xml);
var xmlString = GeometryBagBuilderEx.FromXml(xml);