# OpenStreetMap Geocoder & POI Finder (`gochujang/osm-geocoder`) Actor

Free geocoding powered by OpenStreetMap. Convert addresses to coordinates, coordinates to addresses (reverse), and find nearby POIs (restaurants, cafes, hospitals, etc.) within a radius — no API key required. Batch-ready with 1 req/sec rate-limit compliance.

- **URL**: https://apify.com/gochujang/osm-geocoder.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 location geocodeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OpenStreetMap Geocoder & POI Finder

Free, key-free geocoding and point-of-interest search powered by **OpenStreetMap** (Nominatim + Overpass API).

### What it does

| Mode | Input | Output |
|------|-------|--------|
| `geocode` | Address strings | Lat/lon, display name, bounding box, OSM metadata |
| `reverse` | Lat/lon pairs | Full address, place type, OSM metadata |
| `poi` | Lat/lon + amenity types | Nearby POIs with name, distance, contact info |

### Why use this?

- **Zero API key** — Nominatim and Overpass are fully open
- **Batch-ready** — pass dozens of addresses or coordinates at once
- **Rate-limit compliant** — built-in 1 req/sec throttle for Nominatim
- **Rich output** — bounding boxes, address components, OSM IDs, tags
- **POI details** — opening hours, phone, website, cuisine, distance in meters

### Modes

#### `geocode` — Address → Coordinates

```json
{
  "mode": "geocode",
  "addresses": ["Seoul Station, Korea", "Eiffel Tower, Paris"],
  "maxResults": 3
}
```

Output per result:

```json
{
  "input": "Seoul Station, Korea",
  "lat": 37.5547,
  "lon": 126.9706,
  "display_name": "Seoul Station, Jung-gu, Seoul, ...",
  "type": "station",
  "class": "railway",
  "importance": 0.75432,
  "bbox": { "north": 37.5560, "south": 37.5535, "east": 126.9725, "west": 126.9688 },
  "address_details": { "city": "Seoul", "country": "South Korea", ... },
  "source": "OpenStreetMap/Nominatim"
}
```

#### `reverse` — Coordinates → Address

```json
{
  "mode": "reverse",
  "coordinates": [
    { "lat": 37.5547, "lon": 126.9706 },
    { "lat": 48.8584, "lon": 2.2945 }
  ]
}
```

#### `poi` — Find Nearby Points of Interest

```json
{
  "mode": "poi",
  "coordinates": [{ "lat": 37.5547, "lon": 126.9706 }],
  "poiTypes": ["restaurant", "cafe", "pharmacy"],
  "poiRadius": 500,
  "maxResults": 10
}
```

Output per result:

```json
{
  "input_lat": 37.5547,
  "input_lon": 126.9706,
  "poi_type": "restaurant",
  "radius_m": 500,
  "count": 7,
  "pois": [
    {
      "name": "Myeongdong Kyoja",
      "lat": 37.5601,
      "lon": 126.9854,
      "distance_m": 142,
      "amenity": "restaurant",
      "cuisine": "korean",
      "opening_hours": "Mo-Su 10:30-21:30",
      "phone": "+82-2-776-5348",
      "website": null,
      "address": { "street": "Myeongdong 10-gil", "city": "Seoul", ... }
    }
  ]
}
```

### Supported POI Types

Any valid OSM `amenity` tag. Common values:

`restaurant`, `cafe`, `bar`, `fast_food`, `hospital`, `pharmacy`, `clinic`, `atm`, `bank`, `school`, `university`, `library`, `fuel`, `parking`, `bus_station`, `subway_entrance`, `hotel`, `cinema`, `theatre`, `museum`, `place_of_worship`, `post_office`

Full list: [OSM Amenity tags](https://wiki.openstreetmap.org/wiki/Key:amenity)

### Pricing

| Event | Price |
|-------|-------|
| Actor start | $0.005 |
| Per geocoded location / POI found | $0.002 |

A batch of 100 addresses costs ~$0.20 + $0.005 start fee.

### Technical Notes

- **Nominatim rate limit**: 1 request/second enforced via `asyncio.Semaphore(1)` + 1-second sleep
- **Overpass API**: no rate limit but queries are parallelized per (coordinate × poi_type) pair
- **User-Agent**: `ApifyOSMGeocoder/0.1 (contact@apify.com)` — required by Nominatim ToS
- **Max results**: 1–20 per query (default 5)
- **POI radius**: 50–5000 meters (default 500)

### Data Source

Data © [OpenStreetMap contributors](https://www.openstreetmap.org/copyright), ODbL license.

***

### Related actors

- [Wikipedia Article Scraper](https://apify.com/gochujang/wikipedia-article-scraper) — Wikipedia data for locations found via OSM geocoding (same Wikimedia infrastructure)
- [World Bank Data Scraper](https://apify.com/gochujang/world-bank-data) — Country-level development indicators for geographic analysis built with OSM data
- [Image OCR Extractor](https://apify.com/gochujang/image-ocr-extractor) — Extract addresses from images or PDFs before geocoding them with this actor

### Feedback

If this actor helps your geographic data pipeline, a review helps others find it: [Leave a review on Apify Store](https://apify.com/gochujang/osm-geocoder#reviews)

***

**Keywords:** OpenStreetMap geocoder, OSM geocoding API, address to coordinates, batch geocoding, Nominatim API scraper, reverse geocoding, latitude longitude lookup, free geocoding tool, address validation API, geographic coordinate extractor, postal address geocoder, place name search, OSM data extractor, geolocation API, bulk address geocoding

# Actor input Schema

## `mode` (type: `string`):

Operation mode: 'geocode' (address → coordinates), 'reverse' (coordinates → address), 'poi' (find nearby points of interest).

## `addresses` (type: `array`):

List of addresses or place names to geocode. Used in 'geocode' mode.

## `coordinates` (type: `array`):

List of {lat, lon} objects. Used in 'reverse' and 'poi' modes.

## `poiTypes` (type: `array`):

OSM amenity types to search for (e.g. restaurant, cafe, hospital, pharmacy, atm, school, parking). See: https://wiki.openstreetmap.org/wiki/Key:amenity

## `poiRadius` (type: `integer`):

Radius in meters around each coordinate to search for POIs. Max 5000.

## `maxResults` (type: `integer`):

Maximum number of results to return per address/coordinate.

## Actor input object example

```json
{
  "mode": "geocode",
  "addresses": [
    "Seoul Station, Korea",
    "Eiffel Tower, Paris"
  ],
  "coordinates": [
    {
      "lat": 37.5547,
      "lon": 126.9706
    }
  ],
  "poiTypes": [
    "restaurant",
    "cafe"
  ],
  "poiRadius": 500,
  "maxResults": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/osm-geocoder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("gochujang/osm-geocoder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call gochujang/osm-geocoder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gochujang/osm-geocoder"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/P2yFr2J3Cl1dffjHM/builds/I0Cfrj2CgoQGnTB7e/openapi.json
