Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Exif Geolocation (Latitude/Longitude) Data on iOS #751

Open
dancherb opened this issue Jul 3, 2018 · 15 comments · May be fixed by #1882
Open

No Exif Geolocation (Latitude/Longitude) Data on iOS #751

dancherb opened this issue Jul 3, 2018 · 15 comments · May be fixed by #1882

Comments

@dancherb
Copy link

dancherb commented Jul 3, 2018

RN 0.55.3
react-native-image-crop-picker 0.20.3

On Android I receive an exif data object that includes the following:

GPSLatitudeRef: 'N',
GPSLatitude: '38/1,54/1,3540/100',
GPSLongitude: '1/1,26/1,1920/100',
GPSLongitudeRef: 'E'

On iOS, when trying the same images and freshly taken ones (that work with another module, react-native-image-picker), no geolocation data is returned.

@dancherb
Copy link
Author

dancherb commented Jul 4, 2018

@ivpusic @nico1510

@drewandre
Copy link

drewandre commented Sep 5, 2018

I'm also having this problem -- I see GPS data when uploading from the camera roll (with exif option enabled), but no GPS data when uploading right from the ImagePicker camera. @dancherb is this similar to the issue you are having?

@BigPun86
Copy link

same here, any progress?

@haifahrul
Copy link

@BigPun86 @drewandre @dancherb
I also found this issue, any idea to handle this?

@drewandre
Copy link

@haifahrul I didn't find a solution, no.

@lighthx
Copy link

lighthx commented Mar 19, 2019

met too

@sam17896
Copy link

Any progress on this ?

@gino8080
Copy link

any news? would be very usefull

@dcoellarb
Copy link

any updates on this?

@ravisojitra
Copy link

@sam17896 @gino8080 @dcoellarb @lighthx @drewandre
This is how i converted it to latitude and longitude.

const convertDMSToDD = function (degrees, minutes, seconds, direction) {
    var dd = degrees + minutes / 60 + seconds / 3600;
    if (direction == "S" || direction == "W") {
        dd = dd * -1;
    }
    return dd;
};

if (item.exif) {
let latitude =
    item.exif.GPSLatitude ||
    (item.exif["{GPS}"] && item.exif["{GPS}"].Latitude);
let longitude =
    item.exif.GPSLongitude ||
    (item.exif["{GPS}"] && item.exif["{GPS}"].Longitude);

if (latitude && longitude) {
    if (
    latitude.toString().includes("/") ||
    latitude.toString().includes(",")
    ) {
    let splittedLatitude = latitude.split(",").map((d) => eval(d));
    let splittedLongitude = longitude.split(",").map((d) => eval(d));

    if (
        splittedLatitude &&
        splittedLatitude.length &&
        splittedLongitude &&
        splittedLongitude.length
    ) {
        let finalLatitude = convertDMSToDD(
        ...splittedLatitude,
        item.exif.GPSLatitudeRef
        );
        let finalLongitude = convertDMSToDD(
        ...splittedLongitude,
        item.exif.GPSLongitudeRef
        );
        if (finalLatitude && finalLongitude) {
        let selectedLocation = {
            lat: finalLatitude,
            lng: finalLongitude,
        };
        console.log(selectedLocation);
        }
    }
    }
}
}`

@jvence
Copy link

jvence commented Mar 5, 2021

We're not getting any GPS info on iO using "react-native-image-crop-picker": "^0.36.0" and "react-native": "0.63.4"

I think iOS has a new method to pick a photo using PHPicker. See this blog: https://www.felixlarsen.com/blog/photo-metadata-phpickerview and assuming that location permission is on then we should be able to get the EXIF metadata

Any ideas how to get this working on IOS

@jvence
Copy link

jvence commented Mar 5, 2021

I think I've solved this. If you disable cropping, you will get the GPS info. After looking at the code, I've realized that cropping creates a new image which does not include the GPS info.

@alexg-93
Copy link

even when cropping is off on v0.37.3 and rn v0.67.4 the gps location is missing on IOS
any solution?

@chuchuva
Copy link

The Geolocation data is there on iOS, it just sits under a different property:

{
  "creationDate": "1670047414",
  ...
  "exif": {
    ...
    "{Exif}": {
      ...
    },
    "{GPS}": {
      "Altitude": 2.3358781324002402,
      ...
      "Latitude": 37.87813833333333,
      "LatitudeRef": "S",
      "Longitude": 144.81051666666667,
      "LongitudeRef": "E",
      "Speed": 0.6834079021992564,
      "SpeedRef": "K",
      "TimeStamp": "00:00:00"
    },
    ...
  },
  "filename": "IMG_0007.JPG",
  ...
}

Geolocation data for the same image on Android:

{
  "exif": {
    "DateTime": "2022:12:03 17:03:33",
    ...
    "GPSAltitude": "66089/28293",
    "GPSAltitudeRef": "0",
    "GPSDateStamp": "2.2.0.0.",
    "GPSLatitude": "37/1,52/1,413/10",
    "GPSLatitudeRef": "S",
    "GPSLongitude": "144/1,48/1,1893/50",
    "GPSLongitudeRef": "E",
    "GPSProcessingMethod": null,
    "GPSTimeStamp": "00:00:00",
    ...
    "Latitude": -37.87813949584961,
    "Longitude": 144.81051635742188,
    ...
  },
  "path": "file:///data/user/0/com.trailnavigator.android/cache/react-native-image-crop-picker/IMG_5511.jpg",
  ...
}

chuchuva added a commit to chuchuva/react-native-image-crop-picker that referenced this issue Dec 19, 2022
Copy Latitude and Longitude to `exif` property similar to Android.

fixes ivpusic#751
@chuchuva chuchuva linked a pull request Dec 19, 2022 that will close this issue
@chuchuva
Copy link

chuchuva commented Jan 9, 2023

This pull request should fix it: #1882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.