当前位置: 首页>>代码示例>>C#>>正文


C# ProjectionInfo.ToEsriString方法代码示例

本文整理汇总了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.");
        }
开发者ID:haoas,项目名称:DotSpatial.Plugins,代码行数:35,代码来源:SharpMapLayer.cs

示例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());
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:20,代码来源:ProjectionInfo.cs


注:本文中的DotSpatial.Projections.ProjectionInfo.ToEsriString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。