我是地理信息系统的新手。
在我的项目(一个窗口应用程序)中,我试图以PictureBox(一个区域的无人机图像)加载一个关于950+ MB的GeoTIFF格式的图像。这个图像被数字化(标记每所房子的赏金,并贴上房屋编号)和以Shapefile格式导入的数据。我使用以下代码提取XY坐标数据。我将原来的图像大小缩小到大约40-45 MB,并转换成JPG格式。
现在,我必须将XY坐标数据绘制到我的windows应用程序中的新缩减图像上。
我应该如何实现这个场景?我到底该怎么做?我无法加载有关950+ MB的原始图像?
从Shapefile获取XY坐标的代码
private void ReadShapeFile(string path)
{
ShapeFile.MapFilesInMemory = true;
// open the shapefile
EGIS.ShapeFileLib.ShapeFile sf = new EGIS.ShapeFileLib.ShapeFile(path);
try
{
sf.RenderSettings = new EGIS.ShapeFileLib.RenderSettings(path, "", this.Font);
EGIS.ShapeFileLib.DbfReader dbfr = sf.RenderSettings.DbfReader;
using (System.IO.StreamWriter writer = new System.IO.StreamWriter("output.txt"))
{
EGIS.ShapeFileLib.ShapeFileEnumerator sfEnum = sf.GetShapeFileEnumerator();
int recordIndex = 0;
while (sfEnum.MoveNext())
{
string rec = "";
string NoOfCord = "";
string coord = "";
rec = string.Format("Record:{0}", recordIndex);
writer.WriteLine(string.Format("Record:{0}", recordIndex));
System.Collections.ObjectModel.ReadOnlyCollection<PointD[]> pointRecords = sfEnum.Current;
foreach (PointD[] pts in pointRecords)
{
writer.Write(string.Format("[NumPoints:{0}]", pts.Length));
NoOfCord = string.Format("[NumPoints:{0}]", pts.Length);
for (int n = 0; n < pts.Length; ++n)
{
if (n > 0) writer.Write(',');
writer.Write(pts[n].ToString());
if (n > 0) coord += ",";
coord += pts[n].ToString();
}
writer.WriteLine();
}
AddDataToDataTable(recordIndex, rec, NoOfCord, coord);
++recordIndex;
}
sfEnum.Dispose();
}
MessageBox.Show("Data Loaded Successfully");
}
catch (Exception ex) { Debug.WriteLine("Error Message - " + enl + ex.Message + enl + "Error StackTrace - " + enl + ex.StackTrace + enl); }
finally
{
sf.Close();
sf.Dispose();
}
}发布于 2018-09-14 09:35:14
First:加载巨大的图像需要金字塔或瓷砖切割;如果您想要应用程序显示完整的图像,请剪切瓷砖或构建金字塔,然后在dotspatial或神差地图库中的映射控制中显示。
第二:如果您没有裁剪图像,则处理后的图像将具有与原始图像相同的真实范围。您可以计算图像中任何像素的真实位置;还可以将真实位置(lat/lon或投影坐标)转换为图像坐标参考(左上角为(0,0))。
https://stackoverflow.com/questions/51627888
复制相似问题