GPS and images are a dynamic duo. GPS modules are becoming cheaper and cheaper which means that we would see more gadgets embedded with a GPS as a standard. Cameras and phones are probably the ones that would be on the front line of GPS embedding early adoption. Currently there is the Nokia's N95 cell phone and there might be soon to see camera's with embedded GPS modules (??) and some funny looking , cumbersome integrations .
So having these two modules is a blessing for geotaggers.
What is geotagging you ask?
Taken from wikipedia
Geotagging, is the process of adding geographical identification metadata to various media such as websites, RSS feeds, or images and is a form of geospatial metadata. This data usually consists of latitude and longitude coordinates, though it can also include altitude, bearing, and place names.
And if you're lucky enough to have a GPS that can track export it's data , you can embed the GPS coordinated into the JPEG images. Which means that on top of storing things like the camera model and time of picture taken , it can also store the specific location where the picture was taken. And to take it even further , there are image loading web services that locate on a map pictures that were embedded with their respective GPS coordinates . Panoramio.com is my favorite, Flickr used to support this by simply putting the latitude and longitude as tags , but it looks like it is no longer supported. Use Panoramio , it does the job.
Here is for example all of the geotagged images around Rome's Pantheon (from Panoramio).
It appears that it is very simple to read and write these GPS settings from within the JPEG image using .Net's System.Drawing.Image class.
The data stored in JPEG images complies with the EXIF data format. We can use the Image class to read and write data from and to the JPEG image.
here is an example:
Image Pic = Image.FromFile(Filename); PropertyItems = Pic.PropertyItems; PropertyItems.Id = 0x0002; //index of the EXIF TAG PropertyItems.Type = 5;// PropertyItems.Len = length; PropertyItems.Value =new byte[length]; Pic.SetPropertyItem(PropertyItems);
And that's pretty much it, there are a few more tweaks to save the image.
I'm publishing here a small C# file with a static function to perform a simple action to embed GPS latitude, longitude (Which can be taken from the gps log according to time that the picture was taken).
It is pretty much straight forward.
It can be used like so
WriteLongLat("c:/temp/house_gps.jpg", 33, 0, 48.46, 35, 5, 38.12);
where the first parameter represents the file name to be embedded and the other parameters represent the lon and lat degrees, minutes, and seconds..
Feel free to use this as will (LGPL) license.
Update : There is an updated post about the attached example here GPS Coordinates in JPEG Example