GPSLocation #

Version info
This request parameter has been added in the the 2020-05-01 release.

An image file from a phone or camera often contains metadata that specifies where the photo was taken. You can use the GPSLocation request parameter to check if the location is within a certain area.

The location associated with an image file cannot be relied on to be accurate. It is easy to change the location in an existing photo and if, for example the phone taking the picture had a bad GPS fix, then the value may be inaccurate to begin with. The image could also simply not contain location information at all.

We recommend that this check is only used to suggest that the user may want to take a new picture in the correct general area and not to directly accept or reject photos.

The parameter should be provided as an encoded JSON object that contains a specific location, encoded using its latitude and longitude, and a maximum allowed distance in meters. Both latitude and longitude are required parameters, but distance is optional and defaults to 1000 meters (approximately half a mile).


{"latitude": 51.923968, "longitude": 4.492662, "distance": 1000}

This would check if the photo was taken within 1000 meters of the specified location in the Netherlands. The response will contain the specified location as expectedGPSLocation and the actual location of the photo in metaData - if it contained that information:

    "expectedGPSLocation": {
        "distance": 1000.0,
        "latitude": 51.923968,
        "longitude": 4.492662
    "metaData": {
        "GPSInfo": {
            "GPSAltitude": null,
            "GPSLatitude": 51.9239681694474,
            "GPSLongitude": 3.492662314260368

If the location is further away than the specified maximum distance then the response will also include a message:

    "messages": [
            "code": "no_match_gps_location",
            "message": "The GPS location of the image does not match the expected GPS location",
            "messageId": "m-reFTJEpL"

A different message will be included if the image did not contain location information at all:

    "messages": [
            "code": "no_valid_gps_location",
            "message": "An expected GPS location has been provided, but no valid GPS information could be extracted from the image.",
            "messageId": "<messageId>"

Example request #

curl -X 'POST' \
  '' \
  -H 'subscription-key: <your subscription key>' \
  -F 'image=@test_image.jpg' \
  -F 'GPSLocation={"latitude":51.923968,"longitude":3.492662,"distance":1000}'
from pathlib import Path
from pprint import pprint

import requests

GPSLocation = json.dumps({"latitude": 51.923968, "longitude": 3.492662, "distance": 1000})

response =
    headers={"subscription-key": "<your subscription key>"},
    files={"image": ("test_image.jpg", Path("test_image.jpg").read_bytes())},
    data={"GPSLocation": GPSLocation},