问题
I am New to GIS platform.
In my project (A windows application) I'm trying to load an image in PictureBox(A drone image of an area) is in GeoTIFF format about 950+ MB's. This image digitized(mark boundries of every house and labelled with house no) and data imported in Shapefile. I extracted XY coordinate data using following code. I reduced the original image size to about 40-45 MB's and converted in JPG format.
Now I have to plot that XY coordinate data in my windows application on the new reduced image.
How should I achieve this scenario? What exactly should I do? I am not able to load the Original image about 950+ MB's?
Code For getting XY coordinates from Shapefile
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();
}
}
回答1:
First: loading huge image needs pyramid or tile cutting; if you want your application to show the full image, please cut tile or build pyramid and then show it in mapcontrol which in the dotspatial or sharpmap libraries.
Second: if you have not cropped your images, the proccessed image would have the same real extent with original image. You can caculate the real position of any pixel in the image; you can also transform the real position (lat/lon or projection coordinate) to the image coordinate reference (which top-left is (0,0)).
来源:https://stackoverflow.com/questions/51627888/load-arcgis-digitized-image