Problems to get Latitude/Longitude from a user picture

All your problems with Audio, Video and Images.

Problems to get Latitude/Longitude from a user picture

Postby SpeXoDroid » Mon Jul 11, 2011 2:04 pm

Hello everyone,
I'm SpeXoDroid, Android beginner, and this is my first post !
I have some problems to retrieve geolocation info from pictures I took with the camera.

First try :
At first, I used the Cursor structure to parse my photos, it used to work fine on a HTC Magic, but since I got a new HTC Desire S, all I get is 0.0 for my longitude/latitude, as if the pictures were not geolocated... However in the phone gallery, I can clearly see in the picture details, the correct latitude/longitude.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myCursor = this.managedQuery(Media.EXTERNAL_CONTENT_URI, null, null,
  2. null, null);
  3. while ( myCursor.moveToNext()){ Float latitude =
  4. myCursor.getFloat(myCursor.getColumnIndex("latitude")); //etc...
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Second try :
So I tried to read the EXIF infos of my pictures but I still have an error, apparently a problem of path.
Here is the code :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. File myFile = new File("/sdcard/DCIM/100MEDIA/IMAG0001.jpg");
  2. ExifInterface exif = new ExifInterface(myFile.getCanonicalPath());
  3. exif.getAttribute(ExifInterface.TAG_DATETIME);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


The first line causes an error : can’t open ‘/mnt/sdcard/DCIM/100MEDIA/IMAG0001.jpg’
I tried several different paths, it's strange, all the examples I found on the web were using this path...
A little help would be great! :)
Thanks in advance.

SpeXoDroid
SpeXoDroid
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jul 11, 2011 1:56 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 15 guests