Skip to main content

Singapore OneMap CLI — search, geocode, routing, themes, demographics. Output: text (default), JSON (-f json), or raw API (-f raw-json).

Project description

onemap-sg-cli

CLI and Python library for OneMap Singapore APIs — search, geocode, routing, thematic layers, demographics, and URA property data.

Install

pip install onemap-sg-cli

Or with pipx:

pipx install onemap-sg-cli

Or with uvx (no install needed):

uvx onemap-sg-cli search "Orchard Road"

Setup

Set environment variables (or create a .env file):

export ONEMAP_EMAIL="your@email.com"
export ONEMAP_EMAIL_PASSWORD="your_password"

# Optional: URA property data
export URA_ACCESS_KEY="your_ura_key"

Get credentials:

CLI Usage

# Search
onemap search "Orchard Road"

# Route finding — accepts addresses, postal codes, or lat,lon
onemap route transit "Chinese Garden MRT" "One Raffles Quay"
onemap route transit "Chinese Garden MRT" "One Raffles Quay" --time "09:00"

# Output formats
onemap -f json route transit "Chinese Garden MRT" "One Raffles Quay"
onemap -f raw-json route transit "Chinese Garden MRT" "One Raffles Quay"

# Coordinate conversion
onemap convert wgs84-to-svy21 1.342 103.732

# Demographics
onemap pop age "Bedok" 2020

# Nearby transport
onemap nearby mrt 1.342 103.732 --radius 2000

# Static map
onemap map default --lat 1.342 --lon 103.732 -o map.png

See onemap --help for full command list.

Output Formats

Three output modes via -f / --format:

# Text (default) — human-readable
$ onemap route transit "Chinese Garden MRT" "One Raffles Quay"
Duration: 33.5 min  |  Transfers: 0
  Walk 22.35m
  EW (CHINESE GARDEN MRT STATION  RAFFLES PLACE MRT STATION)
  Walk 425.65m

# JSON (-f json) — simplified, structured
$ onemap -f json route transit "Chinese Garden MRT" "One Raffles Quay"
{"duration_min": 33.5, "transfers": 0, "legs": [...]}

# Raw JSON (-f raw-json) — full API response
$ onemap -f raw-json route transit "Chinese Garden MRT" "One Raffles Quay"
{"requestParameters": {...}, "plan": {...}, ...}

Python Library

import asyncio
import onemap_sg

result = asyncio.run(onemap_sg.search("Orchard Road"))
route = asyncio.run(onemap_sg.route_public_transport(
    1.342, 103.732, 1.281, 103.852,
    departure_time="2026-06-08T09:00:00+08:00", mode="TRANSIT",
))

Agent Instructions

One-line install for any AI agent:

# Auto-detect & install to all found agents (recommended)
curl -sSL https://raw.githubusercontent.com/samuelncui/onemap-sg-cli/main/install-agent.sh | bash

# Install to all agents unconditionally
curl -sSL https://raw.githubusercontent.com/samuelncui/onemap-sg-cli/main/install-agent.sh | bash -s all

# Specific agent
curl -sSL https://raw.githubusercontent.com/samuelncui/onemap-sg-cli/main/install-agent.sh | bash -s hermes

Supported: hermes, cursor, claude, cline, copilot, windsurf, aider, agents. Default: auto-detect all.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onemap_sg_cli-0.2.1.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onemap_sg_cli-0.2.1-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file onemap_sg_cli-0.2.1.tar.gz.

File metadata

  • Download URL: onemap_sg_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onemap_sg_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d0df7e2b549ca49cb6128841418160f6eefdd1d0eb50b3717ebf19212686b65a
MD5 1432e004d648c18dee1ed6a7777444d3
BLAKE2b-256 b51b2b35ef0b0ec9fb775146f8a3d4fc1af61b59ac694942b0bb03471255eddc

See more details on using hashes here.

Provenance

The following attestation bundles were made for onemap_sg_cli-0.2.1.tar.gz:

Publisher: workflow.yml on samuelncui/onemap-sg-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onemap_sg_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: onemap_sg_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onemap_sg_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd641c24d57906888bba8597e56483476df94faa9d9e3e6bc0cf49362baac69
MD5 33a4f536cb3edb54da65c66c6ae63efe
BLAKE2b-256 b243cbbeefdc4f7a3ee9c2d47c3b6c6d2390e3590ee8f8c78b41a10ad0808dcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for onemap_sg_cli-0.2.1-py3-none-any.whl:

Publisher: workflow.yml on samuelncui/onemap-sg-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page