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


C# FeatureSet.Reproject方法代码示例

本文整理汇总了C#中DotSpatial.Data.FeatureSet.Reproject方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureSet.Reproject方法的具体用法?C# FeatureSet.Reproject怎么用?C# FeatureSet.Reproject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotSpatial.Data.FeatureSet的用法示例。


在下文中一共展示了FeatureSet.Reproject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Project

 public static System.Data.Entity.Spatial.DbGeometry Project(System.Data.Entity.Spatial.DbGeometry source,
     ProjectionInfo pStart, ProjectionInfo pEnd)
 {
     var wkt = source.WellKnownValue.WellKnownText;
     var wktReader = new WKTReader();
     var geometry = wktReader.Read(wkt);
     var featureSet = new FeatureSet();
     featureSet.Features.Add(geometry.ToDotSpatial());
     featureSet.Projection = pStart;
     featureSet.Reproject(pEnd);
     var projected =
         (featureSet.Features.First().BasicGeometry as IGeometry).ToGeoAPI();
     var wktWriter = new WKTWriter();
     var projectedWkt = wktWriter.Write(projected);
     return System.Data.Entity.Spatial.DbGeometry.FromText(projectedWkt);
 }
开发者ID:shaahink,项目名称:GeoToolkit,代码行数:16,代码来源:DbGeometryHelper.cs

示例3: CalculateProductForm_Shown

        private void CalculateProductForm_Shown(object sender, EventArgs e)
        {
            if (_field != null)
            {

                label1.Text = "Reading Polygon..";
                var polygonFile = Path.Combine(_field.Folder, "input_polygon.shp");
                var polygonFeatures = FeatureSet.Open(polygonFile).Features;

                label1.Text = "Reading Grid..";
                var gridFile = Path.Combine(_field.Folder, "grid_points.shp");
                var featuresDataset = FeatureSet.Open(gridFile);


                progressBar1.Maximum = polygonFeatures.Count;
                progressBar1.Value = 0;

                var newPolygonLayer = new FeatureSet(FeatureType.Polygon);
                var tbl = new DataTable();

                tbl.Columns.Add("Z");
                tbl.Columns.Add("AreaM2");
                tbl.Columns.Add("Hectare");

                int pCount = 1;

                foreach (Feature poly in polygonFeatures)
                {

                    label1.Text = "Caculating Product Value for plot:" + pCount;

                    var extent = poly.Envelope.ToExtent();

                    var fe = featuresDataset.CopySubset(featuresDataset.SelectIndices(extent));

                    double zTotalCount = 0;

                    for (int i = 0; i < fe.Features.Count; i++)
                    {
                        if (poly.Contains(fe.Features[i]))
                        {
                            var z = double.Parse(Convert.ToString(fe.DataTable.Rows[i]["Z"]));
                            zTotalCount += z;
                        }
                    }

                    tbl.Rows.Add(Math.Round(zTotalCount / 25, 2), Math.Round(poly.Area(), 2), Math.Round(poly.Area() / 10000, 0));

                    newPolygonLayer.AddFeature(poly);

                    progressBar1.Value = progressBar1.Value + 1;
                    pCount++;
                }


                newPolygonLayer.DataTable = tbl;
                newPolygonLayer.Projection = _map.Projection;
                newPolygonLayer.Reproject(_map.Projection);

                var newPolyFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TempFiles", "Temp-Product" + DateTime.Now.Ticks + ".shp");

                newPolygonLayer.SaveAs(newPolyFile, true);
                
                
                var layer = _map.Layers.Add(newPolyFile);

                layer.ContextMenuItems.Add(
                    new DotSpatial.Symbology.SymbologyMenuItem("Save Product File", new EventHandler((s, ev) => SaveProductFileClick(s, ev, (IMapPolygonLayer)layer))));

                label1.Text = "Completed";

            }
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:73,代码来源:CalculateProductForm.cs


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