Location from photo into a separate field

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Location from photo into a separate field

Viewing 2 reply threads
  • Author
    Posts
  • August 26, 2024 at 10:37 AM #51061

    Antonio Volpon
    Participant

    Greetings,

    I’d like to be able to add a field (type location) that automatically gets the gps coordinates from a photo I upload. Basically, the idea is to display the photo and under it, a “location: ” field that is updated with the IPTC data from the photo.

    Is it something achievable in some ways? Of course I know I can populate the field by hand, but that would be suboptimal.

    Many thanks,

    Antonio

    August 26, 2024 at 2:09 PM #51062

    JScottA
    Participant

    Here is the response from the TF5 assistant GPT…your mileage may vary!

     

    The feature you’re asking about—automatically extracting GPS coordinates from a photo’s IPTC data and populating a “Location” field in Tap Forms—can be approached with a combination of Tap Forms’ scripting capabilities and manual steps.

    ### Steps to Achieve This:
    1. **Upload the Photo**:
    – First, you need to upload your photo into a “Photo” field within your Tap Forms record.

    2. **Extract GPS Data**:
    – Tap Forms does not have a built-in function to automatically extract IPTC metadata directly from a photo. However, you can achieve this using a script that interacts with the photo’s metadata.
    – Unfortunately, Tap Forms’ built-in scripting capabilities do not directly support extracting IPTC data from an image file. For this, you would typically need to use an external tool or script (e.g., Python, ExifTool) to extract the GPS coordinates from the image and then paste them manually into the Location field in Tap Forms.

    3. **Manual Entry or Script Execution**:
    – Once you’ve extracted the GPS coordinates using an external tool, you can either enter the coordinates manually into a “Location” field or develop a custom script in Tap Forms that populates the field automatically if you have the data in another field (e.g., a text field containing the coordinates).

    ### Example of How to Use a Script in Tap Forms:
    – You can create a script field in Tap Forms to populate the “Location” field based on input data. Here’s a simple example:
    `javascript
    // Example script to set a location from a manually inputted string
    var lat = record.getFieldValue(‘latitude_field_id’);
    var lon = record.getFieldValue(‘longitude_field_id’);

    // Assuming you have separate fields for latitude and longitude
    if (lat && lon) {
    var locationField = ‘location_field_id’;
    var location = lat + ‘,’ + lon;
    record.setFieldValue(locationField, location);
    }
    `
    Replace 'latitude_field_id', 'longitude_field_id', and 'location_field_id' with the actual IDs of your fields.

    ### Conclusion:
    Unfortunately, you will need to use an external tool to extract the GPS data from the photo’s metadata because Tap Forms does not natively support this. However, once you have the GPS data, you can automate the population of the “Location” field using Tap Forms’ scripting capabilities. If you prefer not to use an external tool, manual entry remains the primary method within Tap Forms for this kind of data.

    For further details on scripting in Tap Forms, you can refer to the [Tap Forms Scripting 101](https://www.cattail.nu/tap_forms/tap_forms_scripting_101/index.html).

    August 28, 2024 at 7:28 PM #51083

    Brendan
    Keymaster

    At the moment Tap Forms doesn’t have this ability to extract the GPS location from the photo metadata. Unfortunately Apple has privacy restrictions that prevent me from getting that information. The only thing you could do is add a Location field to your form, then when you take a photo using Tap Forms on your Photo field, you’ll need to then activate the Location field and get your current location.

     

Viewing 2 reply threads

You must be logged in to reply to this topic.