Getting started with the Konect CLI tools
Overview
The Konect CLI (Command Line Interface) is a lightweight tool that allows users to export project data from Konect directly via the command line. This guide covers how to set up the CLI environment and use it to export KPK files.
Prerequisites
Before using the Konect CLI, ensure the following requirements are met:
The Konect CLI tool is installed at C:\konect\konect-cli
GDAL is installed on the machine and the GDAL_DATA environment variable is configured (see setup steps below)
A valid Konect API key
Setting Up the Environment
A batch file is used to configure the environment before running the CLI tool. This ensures the GDAL folder exists and the required GDAL_DATA environment variable is defined at runtime.
Create a batch file in the following location:
C:\konect\konect-cli\setup_env.bat
The batch file should contain the following content. It checks whether the GDAL folder exists and creates it if missing, then sets the GDAL_DATA environment variable for the current session:
@echo off
SET GDAL_DIR=C:\konect\konect-cli\gdal
if not exist "%GDAL_DIR%" mkdir "%GDAL_DIR%"
SET GDAL_DATA=%GDAL_DIR%
echo GDAL environment configured.
Run this batch file before executing any Konect CLI commands to ensure the environment is correctly configured.
Exporting a Dataset (KPK Export)
Place the export script in the directory where the CLI tool is installed:
C:\konect\konect-cli
To export a dataset, run the following command. Note: the API key has been redacted below — substitute your actual API key when running the command.
konect kpkexport -k [API_KEY_REDACTED] -e "Demo" -d "ROAD DEFECTS" -f "C:\konect\Exported KPK Files\NT Road Defects.KPK"
The parameters used in this command are:
-k – Your Konect API key (keep this confidential; do not include it in shared documentation)
-e – The environment name (e.g. Demo)
-d – The name of the dataset to export (e.g. ROAD DEFECTS)
-f – The full output file path for the exported KPK file
Exporting a Project and Dataset Together
To export the project along with a dataset, modify the command to include the project name using the -p flag:
konect kpkexport -k [API_KEY_REDACTED] -e "Demo" -p "NT Road Project" -d "ROAD DEFECTS" -f "C:\konect\Exported KPK Files\NT Road Defects.KPK"
The additional parameter used here is:
-p – The name of the project to include in the export (e.g. NT Road Project)
This command exports both the specified project and its associated dataset into a single KPK file at the path provided.
Notes
Always run setup_env.bat before running any export commands to ensure the GDAL environment is correctly initialised.
Do not share your API key in any documentation, screenshots, or scripts that may be distributed externally. Always redact it or replace it with a placeholder such as YOUR_API_KEY.
Ensure the output folder (e.g. C:\konect\Exported KPK Files) exists before running the export command, or the CLI will return an error.