Import Media

Import Media using the OpenDataBio R package

Importing Media via API

The method below can be done either through the API using the R package or through the web interface. Test and use whichever is faster to upload the image files.

library(opendatabio)
base_url = "https://opendb.inpa.gov.br/api"
token = "GZ1iXcmRvIFQ"
cfg = odb_config(base_url = base_url)

# path to the folder where the images are stored
folder = 'imagesParaOdb'

# list the file names
filenames = dir(folder, full.names = FALSE)

# read the attribute table
attributes = read.table('arquivoAtributos.csv', sep = ',', header = TRUE, as.is = TRUE, na.strings = c("", "NA", "-"))

# are all files listed in the attribute table?
print(paste(sum(filenames %in% attributes$filename), "of", length(filenames), "files are listed in the attribute table"))

# import to ODB
odb_upload_media_zip(folder = folder, attribute_table = attributes, odb_cfg = cfg)
Last modified June 8, 2025: Added examples and Media apis (8232be9)