Umap GeoJson Export API Support

Upload of Umap files exported manually via the Umap web interface has been supported by my MapOSMatic instance for quite a while, and the MapOSMatic API has also supported submitting a Umap file via an URL instead of uploading an actual file.

There’s also a (so far inofficial) export URL for exporting an Umap for exporting a map directly, without manual browser interaction.

See this Umap Github issue for a more detailed description.

The basic idea is that for a map with Id 123 the stable web access URL would be:

and the inofficial map export URL

Unfortunately the export file retrieved this URL is not yet complete though, as unlike the manualy exported file unsing “Export all data” in the web interface, it only contain the maps meta data, and references to the actual data layers, but not the actual layer data itself.

So when processing a file exported this way, we first need to check the “urls” dictionary from the map properties for the datalayer_view URL path, and combine this with the protocol and host part from the maps own export URL.

For the original Umap instance the datalayer_view looks like this:


and so the full URL template becomes{pk}/

The {pk} placeholder needs to be replaced with the Ids from the datalayers list entries, which e.g. look like this:

"name": "Layer 1",
"id": 123456,
"displayOnLoad": true

So we need to download actual layers data from URLs like

which returns JSON data we need to append to the layers list to form a complete export file.

Once we fetched and merged all data layers we can then process the resulting JSON document the same way as the JSON exported from the web frontend.

This should allow a more direct integration between Umap and MapOSMatic servers, to automate the process of creating printed representations of maps generated with Umap.

An API request to render an umap with Id 123 would then simply look like this:

    "umap_url": ""

In actual PHP code for example launching a map rendering job for this umap would look like this:

require_once 'HTTP/Request2.php';

header("Content-type: text/plain");

define('BASE_URL', '');

$data = ['umap_url' => ''];

$request = new HTTP_Request2(BASE_URL . "jobs");

        ->addPostParameter('job', json_encode($data));

$response = $request->send();
$status   = $response->getStatus();

if ($status < 200 || $status > 299) {

$reply = json_decode($response->getBody());
echo "Result URL: ".$reply->interactive."\n";

2 thoughts on “Umap GeoJson Export API Support”

Leave a Reply

Your email address will not be published. Required fields are marked *