Skip to content

Latest commit

 

History

History
62 lines (38 loc) · 1.84 KB

File metadata and controls

62 lines (38 loc) · 1.84 KB

ohm-import

Example script for importing data into OpenHistoricalMap using the OHM API.

Prerequisites

Setup

pip install -r requirements.txt

Usage

1. Register an OAuth2 application

Go to My Settings → OAuth 2 Applications on OpenHistoricalMap and register a new application. Take note of the Client ID and Client Secret.

OAuth 2 Applications

2. Generate an OAuth2 token

Run the token generator script:

python ohm_generate_token.py

The script will print an authorization URL. Open it in your browser, authorize the application, and copy the authorization code.

Authorization code

Paste the code back into the terminal to obtain your access token:

Open this link in your browser:
https://www.openhistoricalmap.org/oauth2/authorize?response_type=code&client_id=...
Paste the authorization code here: kF7_Xg-DAhA45n3jsI2dt8afz9bGSE1zNJq2bVyHgWc

Your access token:
eo9Dv-ko5fNOsjcM3TqLf7KXb86NwCIp9maTXPTFLQs

3. Upload data to OHM

Edit ohm_api.py and assign your access token to the TOKEN variable, then run:

python ohm_api.py

This script creates a changeset and uploads nodes to OpenHistoricalMap using the osmapi library. Here is an example changeset created with this script: changeset/231744.

Dependencies

Note: The tokens and credentials shown in this README are only examples and were revoked after running these tests.