本文整理汇总了C#中DotSpatial.Projections.ProjectionInfo.ToEsriString方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectionInfo.ToEsriString方法的具体用法?C# ProjectionInfo.ToEsriString怎么用?C# ProjectionInfo.ToEsriString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotSpatial.Projections.ProjectionInfo
的用法示例。
在下文中一共展示了ProjectionInfo.ToEsriString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reproject
public override void Reproject(ProjectionInfo targetProjection)
{
var ctFac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
var csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
var csTarget = csFac.CreateFromWkt(targetProjection.ToEsriString());
foreach (var layer in EnumerateLayers(_map))
{
var lLayer = layer as SharpMap.Layers.Layer;
if (lLayer == null) continue;
GeoAPI.CoordinateSystems.ICoordinateSystem csSource = null;
if (lLayer.CoordinateTransformation != null)
{
csSource = lLayer.CoordinateTransformation.SourceCS;
}
if (!string.IsNullOrEmpty(layer.Proj4Projection))
{
csSource = csFac.CreateFromWkt(ProjectionInfo.FromProj4String(layer.Proj4Projection).ToEsriString());
}
else if (layer.SRID != 0)
{
csSource = csFac.CreateFromWkt(ProjectionInfo.FromEpsgCode(layer.SRID).ToEsriString());
}
var ctF = ctFac.CreateFromCoordinateSystems(csSource, csTarget);
var ctR = ctFac.CreateFromCoordinateSystems(csTarget, csSource);
lLayer.CoordinateTransformation = ctF;
lLayer.ReverseCoordinateTransformation = ctR;
}
throw new InvalidOperationException("Cannot Setup CoordinateTransformation as long as ProjectionInfo does not maintain SRID values.");
}
示例2: Equals
/// <summary>
/// Gets a boolean that is true if the Esri WKT string created by the projections matches.
/// There are multiple ways to write the same projection, but the output Esri WKT string
/// should be a good indicator of whether or not they are the same.
/// </summary>
/// <param name="other">
/// The other projection to compare with.
/// </param>
/// <returns>
/// Boolean, true if the projections are the same.
/// </returns>
public bool Equals(ProjectionInfo other)
{
if (other == null)
{
return false;
}
return ToEsriString().Equals(other.ToEsriString()) || ToProj4String().Equals(other.ToProj4String());
}