本文整理汇总了C#中DotSpatial.Projections.ProjectionInfo.ParseEsriString方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectionInfo.ParseEsriString方法的具体用法?C# ProjectionInfo.ParseEsriString怎么用?C# ProjectionInfo.ParseEsriString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotSpatial.Projections.ProjectionInfo
的用法示例。
在下文中一共展示了ProjectionInfo.ParseEsriString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BUT_shptopoly_Click
private void BUT_shptopoly_Click(object sender, EventArgs e)
{
using (OpenFileDialog fd = new OpenFileDialog())
{
fd.Filter = "Shape file|*.shp";
DialogResult result = fd.ShowDialog();
string file = fd.FileName;
ProjectionInfo pStart = new ProjectionInfo();
ProjectionInfo pESRIEnd = KnownCoordinateSystems.Geographic.World.WGS1984;
bool reproject = false;
if (File.Exists(file))
{
string prjfile = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".prj";
if (File.Exists(prjfile))
{
using (
StreamReader re =
File.OpenText(Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".prj"))
{
pStart.ParseEsriString(re.ReadLine());
reproject = true;
}
}
IFeatureSet fs = FeatureSet.Open(file);
fs.FillAttributes();
int rows = fs.NumRows();
DataTable dtOriginal = fs.DataTable;
for (int row = 0; row < dtOriginal.Rows.Count; row++)
{
object[] original = dtOriginal.Rows[row].ItemArray;
}
foreach (DataColumn col in dtOriginal.Columns)
{
Console.WriteLine(col.ColumnName + " " + col.DataType.ToString());
}
int a = 1;
string path = Path.GetDirectoryName(file);
foreach (var feature in fs.Features)
{
StringBuilder sb = new StringBuilder();
sb.Append("#Shap to Poly - Mission Planner\r\n");
foreach (var point in feature.Coordinates)
{
if (reproject)
{
double[] xyarray = {point.X, point.Y};
double[] zarray = {point.Z};
Reproject.ReprojectPoints(xyarray, zarray, pStart, pESRIEnd, 0, 1);
point.X = xyarray[0];
point.Y = xyarray[1];
point.Z = zarray[0];
}
sb.Append(point.Y.ToString(CultureInfo.InvariantCulture) + "\t" +
point.X.ToString(CultureInfo.InvariantCulture) + "\r\n");
}
log.Info("writting poly to " + path + Path.DirectorySeparatorChar + "poly-" + a + ".poly");
File.WriteAllText(path + Path.DirectorySeparatorChar + "poly-" + a + ".poly", sb.ToString());
a++;
}
}
}
}
示例2: button24_Click
private void button24_Click(object sender, EventArgs e)
{
using (OpenFileDialog fd = new OpenFileDialog())
{
fd.Filter = "Shape 文件|*.shp";
DialogResult result = fd.ShowDialog();
string file = fd.FileName;
ProjectionInfo pStart = new ProjectionInfo();
ProjectionInfo pESRIEnd = KnownCoordinateSystems.Geographic.World.WGS1984;
bool reproject = false;
// Poly Clear
drawnpolygonsoverlay.Markers.Clear();
drawnpolygonsoverlay.Polygons.Clear();
drawnpolygon.Points.Clear();
if (File.Exists(file))
{
string prjfile = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".prj";
if (File.Exists(prjfile))
{
using (
StreamReader re =
File.OpenText(Path.GetDirectoryName(file) + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".prj"))
{
pStart.ParseEsriString(re.ReadLine());
reproject = true;
}
}
try
{
IFeatureSet fs = FeatureSet.Open(file);
fs.FillAttributes();
int rows = fs.NumRows();
DataTable dtOriginal = fs.DataTable;
for (int row = 0; row < dtOriginal.Rows.Count; row++)
{
object[] original = dtOriginal.Rows[row].ItemArray;
}
string path = Path.GetDirectoryName(file);
foreach (var feature in fs.Features)
{
foreach (var point in feature.Coordinates)
{
if (reproject)
{
double[] xyarray = { point.X, point.Y };
double[] zarray = { point.Z };
Reproject.ReprojectPoints(xyarray, zarray, pStart, pESRIEnd, 0, 1);
point.X = xyarray[0];
point.Y = xyarray[1];
point.Z = zarray[0];
}
drawnpolygon.Points.Add(new PointLatLng(point.Y, point.X));
addpolygonmarkergrid(drawnpolygon.Points.Count.ToString(), point.X, point.Y, 0);
}
// remove loop close
if (drawnpolygon.Points.Count > 1 &&
drawnpolygon.Points[0] == drawnpolygon.Points[drawnpolygon.Points.Count - 1])
{
drawnpolygon.Points.RemoveAt(drawnpolygon.Points.Count - 1);
}
drawnpolygonsoverlay.Polygons.Add(drawnpolygon);
gMapControl1.UpdatePolygonLocalPosition(drawnpolygon);
gMapControl1.Invalidate();
gMapControl1.ZoomAndCenterMarkers(drawnpolygonsoverlay.Id);
}
}
catch (Exception ex)
{
CustomMessageBox.Show(Strings.ERROR + "\n" + ex, Strings.ERROR);
}
}
}
}