创建空间参考

时间:2021-05-05 05:37:13

//创建空间参考
ISpatialReference pSpatialReference = GetSpatialReferenc(mTimeTrackPoint);
Dictionary<string,esriFieldType>pFieldStruct = new Dictionary<string,esriFieldType>();
//添加字段
string pStartTime = "StartTime";
string pEndTime = "EndTime";
pFieldStruct.Add(pStartTime, esriFieldType.esriFieldTypeString);
pFieldStruct.Add(pEndTime, esriFieldType.esriFieldTypeString);

/// <summary>
/// 获取要素类空间参考方法。
/// </summary>
/// <param name="pFeatureLayer">要获取空间参考的图层</param>
/// <returns>图层空间参考</returns>
private static ISpatialReference GetSpatialReferenc(IFeatureLayer pFeatureLayer)
{
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IGeoDataset pGeoDataset = pFeatureClass as IGeoDataset;
ISpatialReference pSpatialReference = pGeoDataset.SpatialReference;
return pSpatialReference;
}