Save, in the photo, the coordinates of the place where it was taken

Asked

Viewed 2,122 times

1

I would like that in my application when taking a photo, that this photo stores the location coordinates in the details of the photo, this would be possible?


Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE.);
intent.putExtra(String.valueOf(MediaStore.EXTRA_OUTPUT), uri);
startActivityForResult(intent, IMAGE_CAPTURE);

this way that I make the call from the camera, at first how to pick up the location still do not know

  • i did so, I took the photo, at the time of the photo picked up the location, and in a table saved photoName, lat_photo, long_photo and more needed pictures. ai dps have assembled a list of the images, and displays on the maps right above the location. vc knows how to pick up the location, use the camera’s input and everything else?

1 answer

5


Regarding data storage in the image:

Take a look at these links might help:

There is a class: Exifinterface that allows the insertion of Tags with meta information inside a JPEG image, depending on what you want to create is worth storing this information in the image itself.

In relation to obtaining the location:

Add the following permissions to your xml manifest:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Follow a code that gets the location simply without the need to listen through a Calback, anything from a look at Android guide to get location.

        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        Location location = (Location) lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

        double longitude = location.getLongitude();
        double latitude = location.getLatitude();

Anything you post comments, Abs.

  • 1

    Estou Conseguindo pegar a localização, então deveria adicionalá&#xA;ExifInterface exif = new ExifInterface(/sdcard/photo/photoname.jpg);&#xA;exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE,String.valueOf(latitudeValueInDecimal));&#xA;exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE,String.valueOf(longitudeValueInDecimal));&#xA;exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF,"N");&#xA;exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF,"W");&#xA;exif.saveAttributes();&#xA;e a onde tem o caminho, step the path of my photo, modifying its location, this?

  • I followed the example on the link: http://stackoverflow.com/questions/13587070/geotagging-photos-after-using-camera-intent, there is a correct format to add the location on the tag. Here the Exif mechanism is explained a little better: http://stackoverflow.com/a/10685694/1408832.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.