Skip to content Skip to main navigation Skip to footer

The role of JSON in managing and accessing media files in GIS Cloud

With the introduction of Collected Media Folders, we’ve made organising and accessing your project-specific files easier. To ensure the functionality of the Collected Media Folders feature and to further improve how media files work within GIS Cloud, there was one major prerequisite: all collected and attached media files are now saved and logged in the same format – a JSON object/string.

The JSON format and how it’s used in GIS Cloud

JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of name–value pairs and arrays.

When you export a layer from GIS Cloud and open it in an external application, in the fields where you store your media files, you will not see the file name of the collected or attached media or a direct link. Instead, you will see a JSON string that contains various information about the media file itself, the layer, and the feature it is associated with.

The string, in its raw form, will look something like the example below:

___json[{“”pathname””:””/Collected Media/map_2653974/layer_6494255/mdc_photo_mdc_095ac9_cdv_photo_1713281520_1713281541067.jpg””,””rid””:33403061,””lid””:””6494255″”,””fid””:””1288″”,””field””:””photo_1″”,””title””:””mdc_photo_mdc_095ac9_cdv_photo_1713281520_1713281541067.jpg””,””ext””:””jpg””,””panorama””:false,””isDir””:false}]

Since JSON is a structured format, let’s break it down on this example of an image collected with the MDC app:

[
  {
    "pathname": "/Collected Media/map_2653974/layer_6494255/mdc_photo_mdc_095ac9_cdv_photo_1713281520_1713281541067.jpg",
    "rid": 33403061,
    "lid": "6494255",
    "fid": "1288",
    "field": "photo_1",
    "title": "mdc_photo_mdc_095ac9_cdv_photo_1713281520_1713281541067.jpg",
    "ext": "jpg",
    "panorama": false,
    "isDir": false
  }
]
  • “pathname” – full path to the media file in your GIS Cloud storage, in the File Manager
  • “rid” – the resource ID of the file in GIS Cloud
  • “lid” –  the ID of the layer into which the image was collected
  • “fid” – the ID of the exact feature into which the image was collected
  • “field” – name of the field in the database table where images are collected
  • “title” – name of the image in your storage
  • “ext” – file extension, for collected images most common is “jpg”
  • “panorama” – is the image panoramic, values can true or false
  • “isDir” – is the attached content a folder, values can be true or false

The information stored in the JSON object ensures data interoperability, meaning that you can export data from GIS Cloud, make changes to the data and import it back into GIS Cloud. The information stored in the JSON will ensure that the features in your layer and the collected and attached media files in your GIS Cloud storage are successfully linked automatically.

Exporting data

When exporting data from GIS Cloud, be mindful of the limitations of some data formats, for example, the shapefile format.

The shapefile format has a preset maximum number of characters for attribute fields, which means that larger JSON strings which contain information about multiple media files attached to a single feature may be cut short during the export process.

Re-uploading a shapefile with incomplete JSON strings will result in the inability to open the collected and attached media files.

As a general recommendation, it is best to export data in formats that do not have a strict character number limitation, for example, CSV.

Integrating data with third-party apps and systems

When integrating with third-party apps and systems, it may be necessary to use only specific information about the collected or attached media files, most commonly the file name. This involves parsing the JSON and extracting only the necessary information for use in the third-party app.

Since the JSON contains a large amount of information, it may be necessary to include an extra step in the third-party app integration workflows, which include the use of image file paths or names. Before specific data can be saved in a third-party app, the JSON must be processed to extract the relevant details. 

Was This Article Helpful?