Fetching contributors…
Cannot retrieve contributors at this time
128 lines (89 sloc) 7.01 KB

POSM Admin Scripts

The core of POSM Admin is a suite of bash scripts that do the administrative tasks handling data deployment, operation, and backup of the POSM Server.

The following are the categories of tasks POSM Admin handles:

POSM Deployment

The area of interest (AOI) a POSM is concerned with encompasses the general region in which the POSM is to be deployed to in the field. If your mission is to map the northern border of Libera, for example, your POSM should be deployed with that entire region surrounding the border in question.

You can use a custom instance of the HOT Export tool to fetch the OSM data you need for your POSM deployment. Once that export is completed, you can pass the url of the POSM Bundle to

An example of a POSM Bundle URL:

With this url, you can run

Takes as a single argument the URL to a HOT Export tar.gz.

/opt/admin/posm-admin/scripts/ <export.tar.gz>


  1. Fetch HOT Export.
  2. Move HOT Export to AOI directory.
    • Extracts the name of the AOI from the manifest.json. Moves the contents into /opt/data/aoi/<aoi-name>.
    • Uses
  3. Drop and Create API DB.
  4. Init API DB.
  5. Populate API DB.
    • Uses osmosis to populate the API DB from the AOI's OSM PBF. Does other administrative tasks.
    • Uses
  6. Dump API DB to PB
    • Dumps the entire contents of the API DB to an OSM PBF. Used for backup and populating the Render DB.
    • Uses
  7. Reset and Populate Render DB.
  8. Reset and Configure Tessera and Field Papers.
    • Updates the configs of Tessera and Field Papers to have reflect the OSM data and MBTiles that have been loaded.
    • Uses tessera-fp-reset.js

OpenMapKit Field Papers Atlas Deployment

After a bit of experimentation, we have found that the typical area of a Field Paper Atlas is also an ideal bounds for OSM XML and MBTiles to be sent to an OpenMapKit deployment. Therefore, we have a script that will take the bounds of an atlas from a Field Paper and create an OpenMapKit deployment.

A deployment is written to /opt/data/deployments/<field paper atlas slug>.

A given deployment contains:

  1. manifest.json containing the name, title, and description of the atlas.
  2. Buildings OSM XML
  4. POSM Carto MBTiles (Cut directly from Mapnik)
  5. Extract of other AOI MBTiles

A given AOI may have MBTiles files, such as Satellite imagery. This file tends to be large. We cut an extract of that MBTiles by the bounds of the Field Papers atlas.

This script will be run automatically when a field papers atlas is created (#132). For now, you can manually run this script as follows:

/opt/admin/posm-admin/scripts/omk-atlas.js -a <aoi directory> -u <field paper atlas map.geojson url>

For example:

/opt/admin/posm-admin/scripts/omk-atlas.js -a /opt/data/aoi/huaquillas -u http://posm.local/fp/atlases/3bun4nml.geojson

Update Render DB

The OSM API database has the source OSM data that can be imported, edited, and submitted to OpenStreetMap. The Render database contains data that is a derivative of what is found in the API DB. This is needed for Mapnik to cut tiles in a timely fashion. We utilize osm2pgsql to do this conversion.

This action is done initially in, and it is then re-run at :00 and :30 of every hour as a cron job.

You many also manually re-run the update script as follows:


Reset AOI Deployment

To be discussed. See #144.

Changeset Replay Tool

Under construction.

Backup & Restore

Current backups are manual. See #141.

Mapillary Backup

To be discussed. See #147.