How to use OCM packager tool with HERE Mobile SDK
Offline Map Package Not Created – OCM Packager Error in HERE Mobile SDK 4.x on Linux
Applies To
· HERE Mobile SDK for Android, version 4.x
· OCM Packager Tool
· HERE Platform: OCM (Offline Cache Manager)
Symptoms / Triggers
· OCM Packager fails to create map packages on Linux
· Error messages related to missing dependencies (e.g., libssl-dev, libcurl4-openssl-dev, libboost-all-dev)
· Map package folder is empty after running the packager
· Permission denied when running ./bin/ocm-packager
· 403 Access Denied or OAuth related error in logs
Summary
The OCM-Packager may fail to create map packages for the HERE Mobile SDK due to incorrect setup of dependencies, file permissions or incorrect credentials. Ensure proper installation of dependencies, correct JSON configuration and valid credentials in credentials.properties file.
Quick Solution
To successfully use the OCM-Packager with the HERE Mobile SDK (4.x), ensure that:
1. All required Linux dependencies are installed (e.g., libssl-dev, libboost-all-dev).
2. The configuration JSON file is correctly placed in the packager root directory.
3. The credentials.properties file is correctly generated and accessible.
4. The ./bin/ocm-packager has execute permissions (e.g., chmod +x ./bin/ocm-packager).
Root Cause
The OCM-Packager is sensitive to missing system dependencies, incorrect JSON configuration, or invalid authentication credentials. The HERE Mobile SDK expects map data to be structured in a specific hierarchy (v1/<access_key_id>/ocm-map/) that must be mirrored when deploying.
Impact
Failure to address the above issues will prevent the OCM Packager from producing valid offline map packages, resulting in missing or incorrect map data in the SDK.
Step by step instructions
1.Install Required Linux Dependencies
External libraries are needed to run the ocm-packager on Linux.
· On Ubuntu:<br /><br />**sudo apt-get update && sudo apt-get --yes install libssl-dev libcurl4-openssl-dev libboost-all-dev**<br /><br />
· On CentOS 8 Stream:<br /><br />**sudo yum install dnf**<br /><br />**sudo dnf install -y git epel-release <br />sudo yum install boost-devel <br />sudo yum install libcurl-devel.x86_64 <br />sudo yum install openssl-devel**<br /><br />
For Ubuntu and CentOS 8 stream: Please download the file from this link and extract the same.
For Windows: Please download the file from this link and extract the same.
Once downloaded and extracted, please run command - sudo su, this will give you root access.
In the root of the folder you will find following files:
2. Set Up JSON Configuration File
· Create a berlin.json in the OCM-Packager folder with the proper structure (example below).
· Ensure the file includes the regionList and relevant layerGroups.
Example berlin.json:
{<br /><br />"storage": "protectedCache",<br /><br />"mapPackage": {<br /><br />"catalogs": [{<br /><br />"hrn": "hrn:here:data::olp-here:ocm"<br /><br />}],<br /><br />"layerGroups": ["routing", "rendering", "detailed_rendering", "navigation", "interop", "pedestrian_offline_routing", "truck", "traffic", "landmarks", "search", "index", "configuration", "car_offline_routing", "truck_offline_routing", "long_truck_offline_routing", "traffic_patterns"],<br /><br />"regionList": [20187401]<br /><br />}<br /><br />}
Please download the detailed regionList from this link
To prepare map package, use the following execution parameters:
| Parameter| Description| Note|
|-------------------|-----------|------------|
| --credentials PATH| Read credentials from the provided file. If the credentials file located in the HOME directory inside .here folder, this option can be omitted.| For more details, refer to Get Credentials.|
| --configuration PATH| Read configuration of required package from the provided file.| -|
| -o [ --output-path ] PATH| The PATH to the folder to save map data or zip archive to.| -|
| -z [ --zip-filename ] ZIP_FILENAME| Archive the loaded data to ZIP_FILENAME.| The data will not be archived if this parameter is not set.|
| -p [ --print-regions ]| Print a list of regions for specified catalog and exit successfully.| Catalog HRN is required for this operation.|
| -c [ --catalog-hrn ] HRN| HERE Resource Name of the catalog to download the regions list from.| -|
| --catalog-version VERSION| The version of the catalog to download the regions list from.| The latest version is used if not provided.|
| `-l [ --log-level ]
Updated 3 days ago