Skip to main content
March 15, 2023
Question

Metadata of a document

  • March 15, 2023
  • 16 replies
  • 0 views

Hi,

I want to know how to get metadata of an image (like geolocation containing latitude and longitude). Is there a way to get it at all?

    16 replies

    harshitb6843
    March 15, 2023

    AFAIK, there isn't a way to do that unless you send the image outside Appian via an integration to get these details. 

    mikes0011
    Brainy
    March 15, 2023

    It'd probably be... not *too* difficult, maybe, for someone to write a custom plug-in to do this analysis on relevant files - but that would be its own whole new thing, someone would need to be used to coding plugins (and have a setup that allows for it), etc.

    harshitb6843
    March 15, 2023

    How about using chatGPT for it? Generated this code from it. Not sure how much of it is correct [emoticon:c22324d72be24d45bf071047c6583446]

    import com.appiancorp.plugins.sdk.PluginContext;
    import com.appiancorp.plugins.sdk.ui.EmbeddedBrowser;
    import com.appiancorp.plugins.sdk.ui.TextValueComponent;
    
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    
    public class GeoLocationPlugin {
    
      public static void extractGeoLocation(PluginContext context, String filePath) {
        try {
          File imageFile = new File(filePath);
          BufferedImage image = ImageIO.read(imageFile);
          double latitude = extractLatitude(image);
          double longitude = extractLongitude(image);
          String location = String.format("%f,%f", latitude, longitude);
          TextValueComponent locationComponent = context.createTextValueComponent(location);
          EmbeddedBrowser browser = context.createEmbeddedBrowser(locationComponent);
          browser.setWidth(400);
          browser.setHeight(300);
          browser.setUrl(String.format("https://www.google.com/maps?q=%s", location));
          context.publishValue(locationComponent);
        } catch (IOException e) {
          context.logError("Failed to extract geo location from image", e);
        }
      }
    
      private static double extractLatitude(BufferedImage image) {
        // TODO: Implement the logic to extract the latitude from the image.
        // This may involve reading the EXIF metadata of the image, if available.
        return 0.0;
      }
    
      private static double extractLongitude(BufferedImage image) {
        // TODO: Implement the logic to extract the longitude from the image.
        // This may involve reading the EXIF metadata of the image, if available.
        return 0.0;
      }
    }
    

    March 15, 2023

    As Harshit mentioned, there is no possibility to get the metadata direct from the photo.

    But what you can get is the geolocation of the task with which the photo was uploaded. 
    https://docs.appian.com/suite/help/23.1/Configuring_the_User_Input_Task.html#capturing-task-submission-location

    So this can be utilized as a work around: Assigning a task where the user has to upload a photo taken with his camera on the spot.
    The geolocation will be available as an attribute in the task.

    Maybe that helps.

    adityag9712
    March 15, 2023

    You can get these details while working with task (Mobile)

    When the option Capture location on submission (only supported in Appian Mobile) is enabled, Submission Location result data is available in the Outputs section of the Data tab. Submission Location has the following fields:

    • location: The geographical location from where the task is submitted. This is only available when the task is submitted from Appian Mobile application. It has the following fields:
      • latitude: The latitude, measured in degrees.
      • longitude: The longitude, measured in degrees.
      • altitude: The altitude, measured in meters.
      • horizontalAccuracy: The radius of uncertainty for the location, expressed in meters.
      • verticalAccuracy: The uncertainty in the altitude value of the location, expressed in meters.
    • isAvailable: Indicates whether location is captured for the submitted task. Returns true if location is captured, false otherwise.
    • errorStatus: Indicates the reason for missing location. This field is only populated if the isAvailable is false. It can have one of the following values:
      • NOT_AUTHORIZED: Indicates that access to location services was denied by the user from the mobile application.
      • NOT_AVAILABLE: Indicates that the location could not be obtained.
      • NOT_SUPPORTED: Indicates that the task was submitted from web or from an older version of the mobile application.
      • DISABLED_BY_ADMINISTRATOR: Indicates that the system administrator has disabled the 'Enable Location Capture' option from the Appian Administrator Console.

    More Details here

    mikes0011
    Brainy
    March 15, 2023

    Captured geolocation of a task submission doesn't seem to be what the original poster was asking about.

    March 16, 2023

    exactly. I was asking about the geolocation of the image where it was taken. 

    abhayd3663
    March 15, 2023

    Using metadata-extractor libraries, a plugin can be developed in java which returns the metadata information.

    mikes0011
    Brainy
    May 22, 2023
    a plugin can be developed

    Turns out there is such a plug-in now.  It eluded my various search attempts until just now, weirdly.

    community.appian.com/.../get-file-metadata

    mikes0011
    Brainy
    May 22, 2023

    Somehow I only just found out today that there's a plug-in called "Get File Metadata" (which, for the record, is ONLY for image files, despite its name).  I thought I'd searched on the string "metadata" previously when looking for a plug-in that could read image dimensional information, but somehow I still missed it.

    I can confirm that this plug-in returns GPS values in (text) latitude and longitude, in a JSON-wrapped dictionary.  I've confirmed this by providing a GPS-tagged picture I took with my own phone.

    September 30, 2025

    Hi , 
    but I'm not getting the GPS location from this  plug-in called "Get File Metadata

    Instead of location , i 'm getting this whole image metadata
    How Can I fetch the image GPS location

    mikes0011
    Brainy
    September 30, 2025
    I'm not getting the GPS location

    It would be one of the metadata properties when run on a picture file that's in the correct format + had geolocation turned on.  If yours isn't showing that, I would assume one of those two things is not true in your case.  I don't remember where I put the test file that I used originally to show the above output, since it's been a few years now.

    Edit: to confirm, I just ran a new photo through the same thing, and here it is from the root of the returned image metadata:

    davidj137213
    September 30, 2025

    YOu can get that information in two ways.

    -Via Appian mobile when sending the task.

    -Via plugin  [mention:1aaf6f7ba63245b49f38a53ed5667c4c:f7d226abd59f475c9d224a79e3f0ec07] (this one does not require appian mobile) 

    September 30, 2025

    Thank You David,
    For the suggestion but I want to fetch the GPS location from the image in which this plugin will not used