本文整理汇总了C#中Geometry.ToJson方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.ToJson方法的具体用法?C# Geometry.ToJson怎么用?C# Geometry.ToJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.ToJson方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInputLineFeaturesJson
private string CreateInputLineFeaturesJson(Geometry geometry, string oidField, string lengthField)
{
//below is an example geometry JSON string
string featureGeometryPathObject = geometry.ToJson();
string toRemove = featureGeometryPathObject.Substring(1, featureGeometryPathObject.IndexOf(',')); //extract the spatial reference property
featureGeometryPathObject = featureGeometryPathObject.Replace(toRemove, string.Empty);
string json = string.Empty;
json += ObjectBegin();
json += CreatePair("displayFieldName", AddDoubleQuotes(""));
json += Next();
json += CreatePair("geometryType", AddDoubleQuotes("esriGeometryPolyline"));
json += Next();
json += CreatePair("spatialReference",
ObjectBegin() +
CreatePair("wkid", "102100") +
Next() +
CreatePair("latestWkid", "3857") +
ObjectEnd());
json += Next();
json += CreatePair("fields",
ArrayBegin() +
ObjectBegin() +
CreatePair("name", AddDoubleQuotes(oidField)) +
Next() +
CreatePair("type", AddDoubleQuotes("esriFieldTypeOID")) +
ObjectEnd() +
Next() +
ObjectBegin() +
CreatePair("name", AddDoubleQuotes(lengthField)) +
Next() +
CreatePair("type", AddDoubleQuotes("esriFieldTypeDouble")) +
ObjectEnd() +
ArrayEnd());
json += Next();
json += CreatePair("features",
ArrayBegin() +
ObjectBegin() +
CreatePair("geometry", featureGeometryPathObject) +
ObjectEnd() +
ArrayEnd());
json += Next();
json += CreatePair("exceededTransferLimit", "false");
json += ObjectEnd();
return json;
}
开发者ID:Esri,项目名称:profileGraph-SearchFlickr-MultiSummary-opsdashboard-addin,代码行数:60,代码来源:ProfileService.cs