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


C# Projections.ProjectionInfo类代码示例

本文整理汇总了C#中DotSpatial.Projections.ProjectionInfo的典型用法代码示例。如果您正苦于以下问题:C# ProjectionInfo类的具体用法?C# ProjectionInfo怎么用?C# ProjectionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectionInfo类属于DotSpatial.Projections命名空间,在下文中一共展示了ProjectionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Project

 public static IGeometry Project(IGeometry geometry, ProjectionInfo pStart, ProjectionInfo pEnd)
 {
     var featureSet = new FeatureSet();
     featureSet.AddFeature(geometry.ToDotSpatial());
     featureSet.Projection = pStart;
     featureSet.Reproject(pEnd);
     return
         GeometryConverter.ToGeoAPI(
             ((featureSet.Features[0].BasicGeometry as DotSpatial.Topology.IGeometry)));
 }
开发者ID:shaahink,项目名称:GeoToolkit,代码行数:10,代码来源:GeoJsonHelper.cs

示例2: ReprojectAffine

        /// <summary>
        /// This method reprojects the affine transform coefficients.  This is used for projection on the fly,
        /// where image transforms can take advantage of an affine projection, but does not have the power of
        /// a full projective transform and gets less and less accurate as the image covers larger and larger
        /// areas.  Since most image layers represent small rectangular areas, this should not be a problem in
        /// most cases.  the affine array should be ordered as follows:
        /// X' = [0] + [1] * Column + [2] * Row
        /// Y' = [3] + [4] * Column + [5] * Row
        /// </summary>
        /// <param name="affine">The array of double affine coefficients.</param>
        /// <param name="numRows">The number of rows to use for the lower bounds.  Value of 0 or less will be set to 1.</param>
        /// <param name="numCols">The number of columns to use to get the right bounds.  Values of 0 or less will be set to 1.</param>
        /// <param name="source"></param>
        /// <param name="dest"></param>
        /// <returns>The transformed coefficients</returns>
        public static double[] ReprojectAffine(double[] affine, double numRows, double numCols, ProjectionInfo source, ProjectionInfo dest)
        {
            if (numRows <= 0) numRows = 1;
            if (numCols <= 0) numCols = 1;

            double[] vertices = new double[6];
            // Top left
            vertices[0] = affine[0];
            vertices[1] = affine[3];
            // Top right
            vertices[2] = affine[0] + affine[1] * numCols;
            vertices[3] = affine[3] + affine[4] * numCols;
            // Bottom Left
            vertices[4] = affine[0] + affine[2] * numRows;
            vertices[5] = affine[3] + affine[5] * numRows;
            double[] z = new double[3];
            ReprojectPoints(vertices, z, source, dest, 0, 3);
            double[] affineResult = new double[6];

            affineResult[0] = vertices[0];
            affineResult[1] = (vertices[2] - vertices[0]) / numCols;
            affineResult[2] = (vertices[4] - vertices[0]) / numRows;

            affineResult[3] = vertices[1];
            affineResult[4] = (vertices[3] - vertices[1]) / numCols;
            affineResult[5] = (vertices[5] - vertices[1]) / numRows;

            return affineResult;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:44,代码来源:Reproject.cs

示例3: ReprojectSqlServer

 public ReprojectSqlServer(ProjectionInfo source, int sourceSRID, ProjectionInfo target, int targetSRID)
 {
     _proj_source = source;
     _proj_target = target;
     _srid_source = sourceSRID;
     _srid_target = targetSRID;
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:7,代码来源:ReprojectSqlServer.cs

示例4: Reproject

 public static Coordinate Reproject(this Coordinate c, ProjectionInfo source, ProjectionInfo target)
 {
     var ordinates = new[] { c.X, c.Y };
     var z = new[] {double.IsNaN(c.Z) ? 0 : c.Z};
     Projections.Reproject.ReprojectPoints(ordinates, z, source, target, 0, 1);
     return new Coordinate(ordinates);
 }
开发者ID:haoas,项目名称:DotSpatial.Plugins,代码行数:7,代码来源:ReprojectExtensions.cs

示例5: CreateGridFromExtents

        /// <summary>
        /// This function creates the HDR of Gridfile
        /// </summary>
        /// <param name="inExtents"> Extension of grid</param>
        /// <param name="cellSize">Size cell of the grid</param>
        /// <param name="projection">Projection (the same that shapefile)</param>
        /// <param name="noDataValue">No value definition</param>
        /// <param name="outGridPath">Path of the output</param>
        /// <param name="outGrid">Name of the output grid</param>
        public static void CreateGridFromExtents(
            Extent inExtents, double cellSize, ProjectionInfo projection, double noDataValue, string outGridPath, out IRaster outGrid)
        {

            double height = Math.Abs(inExtents.MaxY - inExtents.MinY);
            double width = Math.Abs(inExtents.MaxX - inExtents.MinX);
            int numberRows = Convert.ToInt32(Math.Ceiling(height / cellSize)) + 1;
            int numberCols = Convert.ToInt32(Math.Ceiling(width / cellSize)) + 1;

            // outGrid = Raster.CreateRaster(@outGridPath, null, demRaster.NumColumns, demRaster.NumRows, 1, demRaster.DataType, rasterOptions);
            outGrid = Raster.CreateRaster(@outGridPath, null, numberCols, numberRows, 1, typeof(float), new String[] { });
            outGrid.NoDataValue = noDataValue;
            outGrid.Projection = projection;
            outGrid.CellHeight = cellSize;
            outGrid.CellWidth = cellSize;
            //if (inExtents.MinX < 0)
            //    outGrid.Xllcenter = inExtents.MinX + (cellSize / 2.0);
            //else
            outGrid.Xllcenter = inExtents.MinX;// -(cellSize / 2.0);

            //if (inExtents.MinY < 0)
            //    outGrid.Yllcenter = inExtents.MinY + (cellSize / 2.0);
            //else
            outGrid.Yllcenter = inExtents.MinY;// -(cellSize / 2.0);
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:34,代码来源:Clip2.cs

示例6: DotSpatialSpatialReference

        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        public DotSpatialSpatialReference(ProjectionInfo projectionInfo)
        {
            _oid = projectionInfo.ToProj4String();
            Definition = projectionInfo.ToProj4String();
            ProjectionInfo = projectionInfo;

        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:10,代码来源:DotSpatialSpatialReference.cs

示例7: ReprojectPoint

		private static double[] ReprojectPoint(double[] sourcePoint, double z, ProjectionInfo sourceProj, ProjectionInfo destProj)
		{
			// Calls the reproject function that will transform the input location to the output locaiton
			Reproject.ReprojectPoints(sourcePoint, new double[] { z }, sourceProj, destProj, 0, 1);

			return sourcePoint;
		}
开发者ID:xfischer,项目名称:SqlServerSpatial.Toolkit,代码行数:7,代码来源:SqlGeometryReprojection.cs

示例8: TransformBox

        /// <summary>
        /// Transforms a <see cref="SharpMap.Geometries.BoundingBox"/>
        /// </summary>
        /// <param name="box">Geometry to transform</param>
        /// <param name="from">Source Projection</param>
        /// <param name="to">Target Projection</param>
        /// <returns>Transformed BoundingBox</returns>
        public static BoundingBox TransformBox(BoundingBox box, ProjectionInfo from, ProjectionInfo to)
        {
            var corners = new[] { box.Left, box.Bottom, box.Left, box.Top, box.Right, box.Top, box.Right, box.Bottom };
            Reproject.ReprojectPoints(corners, null, from, to, 0, 4);

            return new BoundingBox(corners[0], corners[1], corners[4], corners[5]).Join(
                   new BoundingBox(corners[2], corners[3], corners[6], corners[7]));
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:GeometryTransformDotSpatial.cs

示例9: ProjectionParam

 /// <summary>
 /// Creates a new instance of a Projection Param with the specified name
 /// and the specified projection as the default projection that will
 /// appear if no changes are made.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="defaultProjection"></param>
 public ProjectionParam(string name, ProjectionInfo defaultProjection)
 {
     Name = name;
     Value = defaultProjection;
     ParamVisible = ShowParamInModel.No;
     ParamType = "DotSpatial String Param";
     DefaultSpecified = true;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:15,代码来源:ProjectionParam.cs

示例10: MapFrameProjectionDialog

 /// <summary>
 /// use the mapFrame with this dialog
 /// </summary>
 /// <param name="mapFrame"></param>
 public MapFrameProjectionDialog(IMapFrame mapFrame)
 {
     InitializeComponent();
     _mapFrame = mapFrame;
     _projection = new ProjectionInfo();
     _projection.CopyProperties(_mapFrame.Projection);
     UpdateProjectionStrings();
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:12,代码来源:MapFrameProjectionDialog.cs

示例11: Reproject

static Extent Reproject(Extent extent, ProjectionInfo source, ProjectionInfo target, int depth = 0)
{
    var xy = ToSequence(extent);
    DotSpatial.Projections.Reproject.ReprojectPoints(xy, null, source, target, 0, xy.Length / 2);
    var res = ToExtent(xy);

    return res;
}
开发者ID:haoas,项目名称:DotSpatial.Plugins,代码行数:8,代码来源:MainForm.cs

示例12: OpenFile

 public static ShapeFileModel OpenFile(string file, ProjectionInfo projection)
 {
     var res = new ShapeFileModel();
     res.File = file;
     res.Shape = Shapefile.OpenFile(file);
     if (projection != null) res.Shape.Reproject(projection);
     return res;
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:ShapeFileModel.cs

示例13: SetAreaRectangle

 public void SetAreaRectangle(Extent extent, ProjectionInfo rectangleProjection)
 {
     var xMin = extent.MinX;
     var yMin = extent.MinY;
     var xMax = extent.MaxX;
     var yMax = extent.MaxY;
     var box = new Box(xMin, xMax, yMin, yMax);
     SetAreaRectangle(box, rectangleProjection);
 }
开发者ID:CUAHSI,项目名称:HydroClient,代码行数:9,代码来源:AreaSettings.cs

示例14: TransformCoordinate

        /// <summary>
        /// Transforms a <see cref="GeoAPI.Geometries.Coordinate"/>.
        /// </summary>
        /// <param name="c">Point to transform</param>
        /// <param name="from">Source Projection</param>
        /// <param name="to">Target Projection</param>
        /// <returns>Transformed coordinate</returns>
        public static Coordinate TransformCoordinate(Coordinate c, ProjectionInfo from, ProjectionInfo to)
        {
            var xy = c.ToDoubleArray();
            double[] z = !Double.IsNaN(c.Z) ? new double[1] : null;

            Reproject.ReprojectPoints(xy, z, from, to, 0, 1);
            return new Coordinate(xy[0], xy[1]) {Z = z != null ? z[0] : Coordinate.NullOrdinate};

        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:16,代码来源:GeometryTransformDotSpatial.cs

示例15: ToGeoJson

 public static string ToGeoJson(System.Data.Entity.Spatial.DbGeometry location, ProjectionInfo pStart,
     ProjectionInfo pEnd)
 {
     var wktReader = new WKTReader();
     var geometry = wktReader.Read(location.WellKnownValue.WellKnownText);
     geometry = Project(geometry, pStart, pEnd);
     var geoJsonWriter = new GeoJsonWriter();
     return geoJsonWriter.Write(geometry);
 }
开发者ID:shaahink,项目名称:GeoToolkit,代码行数:9,代码来源:GeoJsonHelper.cs


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