Dav Yaginuma;
Husband, Father, Hacker, Burner, Thinker, Maker;
San Francisco.
homepage 2.0
homepage 1.0
about
spacer
spacer
spacer
Photo Albums
spacer
Filthy Lucre
Recent Flickr
Upcoming.org Events
More of dav's events
spacer
aku-aku: v.. To move a tall, flat bottomed object (such as a bookshelf) by swiveling it alternatively on its corners in a "walking" fashion. [After the book by Thor Heyerdahl theorising the statues of Easter Island were moved in this fashion.] source: LangMaker.com. Aku Aku also has another meaning to the islanders: a spiritual guide.
« goa gil report | Main Page | Matrix Reloaded, The (2003) »
gps tagged jpegs
Posted by dav at 2003 May 24 12:27 PM
File under: Geek

spacer

If you click on the image above, you will be shown a map which indicates where (in Tokyo) the photo was taken.

Mie's cellphone can tag each photo she takes with the latitude/longitude coordinates. Last night she tried sending a geotagged jpeg for the first time, so this morning I started researching how to get the coordinates out of the jpeg. It turns out that the data is stored in EXIF headers.

First I opened up the jpeg in a hex editor to look at the binary data. I could see some information in there, but nothing that was obviously GPS data.

Next I used a windows program called Photo Studio which displayed all of the EXIF information including the GPS coordinates. So I knew the coordinates were in there.

Next I looked around for tools or programmer's libraries that would allow me to read this data from my blogpost.pl script (the script that lets Mie post the photos to her blog). There were a number available but it was a pain to find something that worked.

  1. The perl Image::Info module can read some of the EXIF data, but for some reason it fails to parse the GPS EXIF data.
  2. I found a python script called exifdump.py that also failed to output the GPS data.
  3. I found a python library called EXIF.py which was able to parse the GPS coordinates, however it was python 2.x code and my server only has python 1.5. It would have been a pain to upgrade because of dependency issues, so I kept looking.
  4. I fooled around with trying to write a quick C program to extract just the GPS data. That got tedious though, so I decided to look around some more for a pre-built tool.
  5. Finally, I found a java library/util called metadata-extractor which seems to parse every bit of data it can from the jpeg, including all of the GPS data!

Now I was in business. I hacked in a call to the java util in blogpost.pl and also some code which causes each geo-coded image to be hot linked to a japanese version of mapquest called mapfan. A better system would take a look at the coordinates and link to whatever map system was appropriate (mapquest or tiger for US and European locations) but for right now the only person using geo-tagged jpegs with my blogpost.pl (that I know of) is Mie, and her phone only works in Japan.

I'm thinking that maybe what would be best is to fix Image::Info perl module so that it gets the GPS data, then make a moveable type plugin which automatically handles any geo-tagged jpegs (rather than handling it in the blospost.pl). The plugin could also decide what map service to link to.

But I've got to get ready to go to a wedding, so that's it for now...

Comments:

Very nice! Location-tagged media -- this is the motherlode..

(But there's no image in that entry.. and it says "if you click on the image above...")

Posted by: sean on May 25, 2003 05:39 PM

I found this a couple of days ago and remembered UltraBob's neighborhood project. Kewl work w/ Mie's moblog!

mapserver.gis.umn.edu/

Posted by: chriskk on May 25, 2003 08:57 PM

www.multimap.com is good for here in Europe, BTW. I'm not sure about how it works with GPS coordinates though. Anyway, this is totally rad.

Posted by: Shaun on May 28, 2003 01:52 AM

This is seriously cool. I had no idea JPEGs could store such information. Is it a special feature of the phone Mie is using, to add that data to the photos, or is it using some sort of add-on? I'd love to have it for my Nokia 7650.

Also: is it possible to have a look at the perl-script you are mentioning? At the moment I email pictures from my phone to the web using a perl-script of my own to another publishing system than Movable Type. Would be neat to be able to send to MT as well.

Posted by: Manne on June 5, 2003 04:34 PM

Hey guys, thanks for the kinds words and info.

Manne, it is basically just a hack that is using that java GPS-info-extractor thing I mentioned in the post. I'm calling it from blogpost.pl, the script I wrote that is part of the sytem which tuns emails from Mie's cellphone into a blog post. The source for blogpost.pl is available, just search on it, it's in one of my entries. I also posted the cgi scripts actually set up the map page here.

Posted by: Dav Coleman on June 6, 2003 12:24 PM

Dav, the link on image above seems to be broken now. The Japanese error message says something like "this type of link method is not permitted".

Posted by: Stuart Woodward on July 4, 2003 03:07 AM

MapFan apparently doesn't like to play nicely anymore. I'll switch it to @navi when I get back home (I'm at Narita airport now). BTW, it was great meeting/hanging out with you in Tokyo!

Posted by: Dav on July 8, 2003 10:10 PM

Adding GPS data to EXIF tags seems enevitable if your camera supports it.

My online jpeg galley used pyexif to read tags
(such as time and date) from my jpegs. If this is not present or not correct the database of gallery metadata can override this.

One this I would like to know: if a camera is GPS
capable, does it also set the timezone of each image? (clearly this is possible)

It is quite annoying to have to add both peices of metadata seperately, when one is so clearly defined by the other.

Does anyone know of a GPS->timezone library?
Seems like it should be part of the standard
python data classes.

Posted by: sam clegg on July 10, 2003 01:33 AM

I'm not aware of timezone even being part of the exif spec, and it isn't in the data provided by mie's phone. Here's what is provided:

Filename: 2003-05-25_061254_5953_0.jpg
EXIF ColorSpace: 1
EXIF ComponentsConfiguration: YCbCr
EXIF DateTimeOriginal: 2003:05:25 22:09:13
EXIF ExifImageLength: 176
EXIF ExifImage
EXIF ExifVersion: [48, 50, 50, 48]
EXIF FlashPixVersion: [48, 49, 48, 48]
GPS GPSAltitude: 84
GPS GPSAltitudeRef: 0
GPS GPSLatitude: [35, 39, 253/5]
GPS GPSLatitudeRef: N
GPS GPSLongitude: [139, 42, 2843/100]
GPS GPSLongitudeRef: E
GPS GPSMapDatum: WGS-84
GPS GPSTimeStamp: [22, 11, 0]
GPS GPSVersionID: [2, 2, 0, 0]
GPS Tag 0x001B: [65, 83, 67, 73, 73, 0, 0, 0, 65, 70, 76, 84, 45,70, 73, 88]
GPS Tag 0x001D: 2003:05:25
Image ExifOffset: 180
Image GPSInfo: 290
Image ImageDescription: 030525_2209~01
Image Make: KDDI-TS
Image Model: A5301T
Image Orientation: 1
Image ResolutionUnit: Pixels/Inch
Image XResolution: 72
Image YCbCrPositioning: 2
Image YResolution: 72
Includes JPEG thumbnail: No
Includes TIFF thumbnail: No

A GPS-Timezone library should be fairly trivial to write. Maybe we should offer it as a web service on headmap...

Posted by: Dav Coleman on July 10, 2003 10:30 PM

Can someone please let me know what phone it is that Mie uses, that has GPS and a camera in it. I know about phones with one or the other, but not both. Thanks, Ivan (ivan@ivanpope.com)

Posted by: Ivan Pope on July 23, 2003 02:00 AM

Cool stuff dude! What kind of camera is that, with a GPS inside??

BTW, check out OziExplorer [www.oziexplorer.com/] to map it onto real maps, e.g. Nasa's
Earth Science Applications Directorate MrSID Image Server:
https://zulu.ssc.nasa.gov/mrsid/

Posted by: Zoran on August 15, 2003 09:00 AM

very interested! I don't know any cell phone which has camera and gps rx in one piece? what's hardware is it? please. pleeeeese.

Posted by: |JG.| on October 25, 2003 10:30 AM

www.geosnapper.com

Ive been using it for over a year for just this purpose. Uploade your photo and it will automatically extract the GPS info and plot it on a map.

Posted by: Jake on October 27, 2003 11:07 AM

Jake -- what phone are you using to take GPS photos with?

Posted by: Martin Little on October 30, 2003 03:41 AM

That is so cool! This is the audience we're looking for! Who is 'we'? Check out the World-Wide Media eXchange: wwmx.org.

Could someone send us a location-tagged photo taken by a phone camera?

Thanks!
The WWMX Team

Posted by: WWMX on October 31, 2003 02:54 PM

I'm not sure why Image::Info doesn't work for you, but in case you're still looking for a Perl utility to extract GPS information, Image::ExifTool works with the JPG you posted. It can be downloaded from owl.phy.queensu.ca/~phil/exiftool/ . The following is a dump of the exiftool output for your image:

---- ExifTool ----
ExifTool Version Number : 3.14
---- File ----
File Name : 2003-05-24_115510_28166_0.jpg
File Size : 8KB
File Type : JPG
Image Width : 144
Image Height : 176
---- EXIF ----
Image Description : 030524_2221~01
Make : KDDI-TS
Camera Model Name : A5301T
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Y Cb Cr Positioning : Co-sited
Exif Version : 0220
Shooting Date/Time : 2003:05:24 22:21:01
Components Configuration : YCbCr
Flash Pix Version : 0100
Color Space : sRGB
Exif Image Width : 144
Exif Image Length : 176
---- GPS ----
GPS Version ID : 2 2 0 0
GPS Latitude Ref : North
GPS Latitude : 35 36 57.67
GPS Longitude Ref : East
GPS Longitude : 139 41 50.34
GPS Altitude Ref : 0
GPS Altitude : 78
GPS Time Stamp : 22 29 14
GPS Map Datum : WGS-84
GPS Processing Method : ASCII
GPS Date Stamp : 2003:05:24
---- Composite ----
Image Size : 144x176

Posted by: Phil Harvey on February 27, 2004 10:49 AM

I work on WiFiMaps.com -- we're also using UMN Mapserver, for drawing detailed street level maps of Wi-Fi coverage. We've started investigating this technique, in not only encoding the lat/long into the maps we generate, but also for accepting JPEGs, and plotting their locations on our maps. Check out our progress at WiFiMaps.com

Posted by: drewzhrodague on September 23, 2004 03:45 PM

Wow, this is certainly interesting...
I've been playing around with these things lately because i want to be able to take a photo from my photo, add the gps information, then email it to my server and have that parsed up and added to my weblog with the geo data + map added...

however, have you found anything that works well with PHP? my Perl skills aren't so great anymore...

a lot of people have been asking what kinds of phones have camera and gps... well i think almost ALL phones in Japan (and i'd guess South Korea as well, and i've seen some phones in Taiwan) have Cameras and GPS built into them (which is really great for things like navigation services, etc..) I'm sure that most countries with an active mobilephone culture will have phones with gps and cameras in them soon, if they don't already now.
So it's only a matter of time =)

I tried the perl EXIF Tool like Phil Harvey's comment but unlike his results, my image has a GPS Position uses "deg", single quote, and double quote notation... does this mean that there is no consistency between how it's encoded between phones
yours being KDDI-Toshiba A5301T while mine is KDDI-Hitachi W41H

GPS Version ID : 2.2.0.0
GPS Latitude Ref : North
GPS Latitude : 34 deg 39' 7.78"
GPS Longitude Ref : East
GPS Longitude : 135 deg 33' 18.15"
GPS Map Datum : WGS-84
GPS Processing Method : GPS-FIX
GPS Position : 34 deg 39' 7.78" N, 135 deg 33' 18.15" E

but definitely some very interesting results to play around with =)

Posted by: DerekNobuyuki on August 1, 2006 01:33 AM

close2me (www.close2me.com) also tags camera phone pics with location information and shares it with other users as they enter the area in which the pic was taken.

Posted by: clementinesunshine on October 8, 2006 12:41 AM

Awesome!

Posted by: crespowu on May 20, 2008 11:41 PM

Post a new comment:

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?


To view older entries, see all entries or monthly archives in sidebar.
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.