本文整理汇总了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)));
}
示例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);
}
示例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";
}
}