I want to upload a jpeg or some raster image into a C# form and then on entering the latitude and longitudes I need to be able to create an GEOTIFF file of the same image. How can this be done in C#.NET?
you had asked me to use GDAL libraries i did add references,
i'm using Visual studio 2010, i have included library files,
i have computed llx lly lux luy also, but how to tag it to an image, is there any inbuilt function or anything?
this is the code i have used
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OSGeo.GDAL;
using OSGeo.OGR;
using OSGeo.OSR;
namespace geo_tagging
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
int orx = pictureBox1.Image.Height;
int ory = pictureBox1.Image.Height;
int ctrx, ctry, lux, luy, llx, lly, bufx, bufy;
bufx = orx / 108000;
bufy = ory / 108000;
ctrx = int.Parse(textBox2.Text);
ctry = int.Parse(textBox3.Text);
lux = ctrx - bufx;
luy = ctry - bufy;
llx = ctrx + bufx;
lly = ctry + bufy;
Gdal.GCPsToGeoTransform(
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
PictureBox PictureBox1 = new PictureBox();
string Chosen_File = "";
Chosen_File = dlg.FileName;
textBox1.Text = dlg.FileName;
pictureBox1.Image = Image.FromFile(Chosen_File);
int X = pictureBox1.Image.Height;
int Y = pictureBox1.Image.Width;
label2.Text = X.ToString();
label4.Text = Y.ToString();
}
dlg.Dispose();
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text="";
textBox2.Text="";
textBox3.Text="";
pictureBox1.Image.Dispose();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
PictureBox PictureBox1 = new PictureBox();
string Chosen_File = "";
Chosen_File = dlg.FileName;
textBox1.Text = dlg.FileName;
pictureBox1.Image = Image.FromFile(Chosen_File);
int X = pictureBox1.Image.Height;
int Y = pictureBox1.Image.Width;
label2.Text = X.ToString();
label4.Text = Y.ToString();
}
dlg.Dispose();
}
private void textBox1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
}
}
never mind got it guys, we need to use a exe file to call it as a process and pass arguments into it!
thanks for the help
Best Answer
does the code at http://www.gdal.org/warptut.html give you any clues? I don't speak C# so I can't tell if it will help or not.