picture GPS coordinates [resolved]

All your problems with Audio, Video and Images.

picture GPS coordinates [resolved]

Postby beran » Sat Dec 05, 2009 9:39 pm

Hi!

I’m designing my first Android Application.

The goal of this application is to order automatically the mobile pictures.

I would like to use the GPS coordinates of the pictures stocked in the sdcard.

Is there any way to access the GPS coordinates of the pictures took with the camera application?

(Excuse my bad English)
Thanks a lot!
Last edited by beran on Sun Dec 06, 2009 4:39 pm, edited 1 time in total.
beran
Freshman
Freshman
 
Posts: 3
Joined: Sat Dec 05, 2009 9:37 pm
Location: France

Top

Postby qlimax » Sat Dec 05, 2009 10:42 pm

¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby beran » Sun Dec 06, 2009 2:53 pm



Thanks Glimax !

It really helped me !

I tried this code :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int latitude = 0;
  2.  
  3. ArrayList<Double> latitudeList = new ArrayList<Double>();
  4.  
  5. latitude = SystemInformation.cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.LATITUDE);
  6.  
  7. if (SystemInformation.cursor.moveToFirst()) {
  8.                         do {
  9.                                 …
  10.                                 latitudeList.add(SystemInformation.cursor.getDouble(latitude));
  11.                         } while (SystemInformation.cursor.moveToNext());
  12.  
  13. globalList.add(latitudeList);
  14. }
  15.  
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


It doesn’t works… I have an exception because the system don’t find the latitude column.
I’m not sure that the native camera application saves GPS data.
beran
Freshman
Freshman
 
Posts: 3
Joined: Sat Dec 05, 2009 9:37 pm
Location: France

Postby qlimax » Sun Dec 06, 2009 3:57 pm

The following code works for me....
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. TextView tv=(TextView)findViewById(R.id.results);
  2.        
  3.         String[] proj={Media.LATITUDE,Media.LONGITUDE}; // from android.provider.MediaStore.Images.Media
  4.        
  5.         Uri images=Media.EXTERNAL_CONTENT_URI;
  6.        
  7.         Cursor cur=managedQuery(images, proj, null, null, null);
  8.        
  9.         tv.append("Number of results: "+cur.getCount()+"n");
  10.         if (cur.moveToFirst()) {
  11.  
  12.            
  13.             int latCol = cur.getColumnIndex(Media.LATITUDE);
  14.             int lonCol = cur.getColumnIndex(Media.LONGITUDE);
  15.              
  16.        
  17.             do {
  18.                
  19.                 double lat = cur.getDouble(latCol);
  20.                 double lon = cur.getDouble(lonCol);
  21.                 tv.append(""+lat+" ; "+lon+"n");
  22.                
  23.              
  24.                
  25.  
  26.             } while (cur.moveToNext());
  27.  
  28.         }
Parsed in 0.042 seconds, using GeSHi 1.0.8.4



on the emulator i have take 3 shots.

and the result is that:
Code: Select all
Number of results:3
0.0 ; 0.0
0.0 ; 0.0
0.0 ; 0.0


so, basically it works...

let me know.
bye ;)
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby beran » Sun Dec 06, 2009 4:38 pm

Hi Qlimax!

Thank you so much for your code! :D

It works very well!

Bye!
beran
Freshman
Freshman
 
Posts: 3
Joined: Sat Dec 05, 2009 9:37 pm
Location: France

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 19 guests