Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location Data Google Photos API

When I query a photo in Google photos via the API, it doesn't return any location data that is associated with the image. I can see the location on the map when I view the information about the image in Google Photos, however the API doesn't give me these coordinates.

[mediaMetadata] => Google_Service_PhotosLibrary_MediaMetadata Object
        (
            [creationTime] => 2018-07-13T13:20:38Z
            [height] => 4032
            [photoType:protected] => Google_Service_PhotosLibrary_Photo
            [photoDataType:protected] => 
            [videoType:protected] => Google_Service_PhotosLibrary_Video
            [videoDataType:protected] => 
            [width] => 3024
            [internal_gapi_mappings:protected] => Array
                (
                )

            [modelData:protected] => Array
                (
                )

            [processed:protected] => Array
                (
                )

            [photo] => Google_Service_PhotosLibrary_Photo Object
                (
                    [apertureFNumber] => 1.8
                    [cameraMake] => Apple
                    [cameraModel] => iPhone 8
                    [exposureTime] => 
                    [focalLength] => 3.99
                    [isoEquivalent] => 50
                    [internal_gapi_mappings:protected] => Array
                        (
                        )

                    [modelData:protected] => Array
                        (
                        )

                    [processed:protected] => Array
                        (
                        )

                )

        )
like image 911
Andrew Schultz Avatar asked Jul 14 '18 08:07

Andrew Schultz


People also ask

Is there an API for Google Photos?

Using the Google Photos Library API your app can read, write, and share photos and videos in Google Photos. The Library API is a RESTful API with JSON payload. The structure of the API is based on the product concepts of Google Photos: Library: media stored in the user's Google Photos account.

Can Google identify a location from a picture?

Go to Reverse Image Search and upload any image – either from your desktop or another web page. If that photograph is of some popular destination, Google will mention the possible location of that image above the search results (see screenshot).

Can you store Google Places API data?

Note that the place ID, used to uniquely identify a place, is exempt from the caching restriction. You can therefore store place ID values indefinitely.


4 Answers

It appears that Google has no intention of sharing photos location.

The location field used to appear in the MediaMetadata fields as "Not yet available", but any reference in the Google Photos API, after release, was removed except for the docs about downloading an image, where it's stated: "If you want to download the image retaining all the EXIF metadata except the location metadata, concatenate the base URL with the d parameter".

like image 151
Alain1405 Avatar answered Dec 27 '22 15:12

Alain1405


Even though the PHP wrapper for this class includes the location fields it appears that the Google API is not currently populating this object. In the documentation for the mediaItems resource the field location states "Not yet available".

You can use the Google Drive API to get the location data though of a photo.

There is a ticket raised to track this feature implementation.

like image 26
Andrew Schultz Avatar answered Dec 27 '22 17:12

Andrew Schultz


I agree that it looks like Google don't want to provide this.

You can star this bug in their tracker to upvote the issue https://issuetracker.google.com/issues/80379228 but it has not yet got any response from Google.

like image 29
Giles Knap Avatar answered Dec 27 '22 17:12

Giles Knap


I solved that by using Google Drive sync. See my Android Application: https://play.google.com/store/apps/details?id=com.levionsoftware.photo_map_for_google_photos

My App has been approved and works very well, but it's annoying that they don't open the door. In many cases it wouldn't work as I did. And at the end it's only a workaround... EDIT: Some are having problems with that, because not all photos are synced to Google Drive...

like image 41
Denny Weinberg Avatar answered Dec 27 '22 15:12

Denny Weinberg