# OpenStreetMap Places Scraper (`xtracto/openstreetmap-places`) Actor

Extract points of interest from OpenStreetMap by category and area: name, coordinates, address, phone, website, opening hours, cuisine and accessibility. Free ODbL-licensed data, no API key.

- **URL**: https://apify.com/xtracto/openstreetmap-places.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 95.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Places Scraper — POIs by Category and Area

Extract points of interest from OpenStreetMap: name, coordinates, address, phone, email, website,
opening hours, cuisine, dietary options and accessibility — for any category in any area. 26
built-in categories plus raw OSM tag filters.

Free, keyless, **ODbL-licensed open data**. Every row carries the attribution you are required to
keep.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `place` | string | — | e.g. `Kreuzberg, Berlin` — resolved to a bounding box via Nominatim |
| `boundingBox` | object | — | `{south, west, north, east}` in decimal degrees; overrides `place` |
| `categories` | array | — | `restaurant`, `cafe`, `hotel`, `pharmacy`, `supermarket`, `park`, … |
| `customFilter` | string | — | Raw Overpass filter, e.g. `["amenity"="library"]` |
| `maxItems` | integer | `500` | Across all categories combined |

### Output

```jsonc
{
  "_input": "cafe",
  "_source": "S1-overpass-api",
  "_scrapedAt": "2026-09-09T14:18:52Z",
  "_attribution": "© OpenStreetMap contributors, ODbL 1.0 — https://www.openstreetmap.org/copyright",

  "osmType": "node", "osmId": 84644791,
  "osmUrl": "https://www.openstreetmap.org/node/84644791",

  "name": "Espresso House", "brand": null, "operator": null,
  "category": "cafe",
  "latitude": 52.5082693, "longitude": 13.3770044,

  "addressLine": "Potsdamer Platz 10",
  "street": "Potsdamer Platz", "houseNumber": "10",
  "postcode": "10785", "city": "Berlin", "suburb": "Mitte", "country": "DE",

  "phone": "+49 30 26367933",
  "email": null,
  "website": "https://de.espressohouse.com/find-us/potsdamer-platz-10",
  "facebook": null, "instagram": null,

  "openingHours": "Mo-Fr 06:00-22:00; Sa-Su 07:00-22:00",
  "cuisine": "coffee_shop",
  "dietVegetarian": "yes", "dietVegan": null,
  "takeaway": null, "delivery": null,
  "outdoorSeating": "yes", "indoorSeating": "yes",
  "smoking": "no", "wheelchair": "yes", "internetAccess": "wlan",

  "amenity": "cafe", "shop": null, "tourism": null, "leisure": null,
  "lastCheckedDate": "2025-06-30",
  "tagCount": 24,
  "tags": { /* every raw OSM tag, untouched */ }
}
```

### Three things worth knowing

**OSM has two competing conventions for contact details, both live, and which one dominates depends
on where you are.** In a Berlin run, 24 places used `contact:phone` and 17 used a bare `phone`. In
Ubud the ratio inverted: 2 against 53. In neither run did a single place use both. So reading
`contact:phone` alone would have returned 24 of 41 numbers in Berlin and **2 of 55** in Bali — and
the difference is the mapping community's habit, not the data quality. The same split applies to `website`/
`contact:website` and `email`/`contact:email`. This actor reads both and emits one normalised
field, with the complete raw tag map alongside in `tags`.

**Ways and relations have no coordinates unless you ask for them.** A supermarket mapped as a
building is a `way`, and under a plain `out body` it comes back with no `lat`/`lon` at all — 16 of
97 results in one run. The query uses `out center`, and coordinates are taken from `center` when
`lat` is absent.

**A 504 from Overpass usually means "busy", not "too heavy".** A parks query timed out three times
and then succeeded on the same host minutes later. The actor tries the main instance and then
`overpass.kumi.systems`, and reports `server_timeout` — distinct from `blocked` — when every mirror
gives up, so you know to retry rather than to rewrite the query.

`overpass.osm.ch` is deliberately **not** in the mirror list: it answers `200` with `elements: []`
for queries the others fill, and a silently empty result is worse than an error because nothing
downstream can distinguish it from "there are no parks here".

### Identify yourself, don't impersonate a browser

This is the reverse of most scraping. Nominatim refuses `Mozilla/5.0` outright —
`403 Access denied. See https://operations.osmfoundation.org/policies` — while a User-Agent naming
the application is served normally. Both services are run by volunteers on donated infrastructure,
Overpass publishes its own rate limit at `/api/status`, and this actor reads that endpoint to decide
how long to wait rather than guessing. No proxy is needed or wanted here.

### Errors

| `_error` | Meaning |
|---|---|
| `place_not_found` | Nominatim had no match for the place name |
| `server_timeout` | Every Overpass mirror returned 504 — usually transient |
| `blocked` | A mirror refused, or returned a 200 that was not JSON |
| `network_error` | Never reached the server |
| `unexpected_shape` | A 200 without an `elements` list |

If nothing at all is found, the run fails rather than reporting success over an empty dataset.

### Licence

OpenStreetMap data is published under the [Open Database License](https://opendatacommons.org/licenses/odbl/).
You may use it commercially, but you must attribute OpenStreetMap and share alike if you distribute
a derived database. The `_attribution` field on every row is there so that obligation travels with
the data.

# Actor input Schema

## `place` (type: `string`):

Where to search, e.g. "Kreuzberg, Berlin" or "Ubud, Bali". Resolved to a bounding box via Nominatim. Ignored if you set a bounding box below.

## `boundingBox` (type: `object`):

Exact area to search, as south/west/north/east decimal degrees. Overrides the place name.

## `categories` (type: `array`):

What to look for. Pick as many as you like — each is one Overpass query.

## `customFilter` (type: `string`):

Advanced: a raw Overpass tag filter such as \["amenity"="library"] or \["shop"="books"]. Runs in addition to the categories above.

## `maxItems` (type: `integer`):

Across all categories combined.

## Actor input object example

```json
{
  "place": "Kreuzberg, Berlin",
  "categories": [
    "restaurant",
    "cafe"
  ],
  "maxItems": 500
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset items shown in the 'Places' view.

## `items` (type: `string`):

Every record this run produced, with all fields, as JSON.

# 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 = {
    "place": "Kreuzberg, Berlin",
    "categories": [
        "restaurant",
        "cafe"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/openstreetmap-places").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 = {
    "place": "Kreuzberg, Berlin",
    "categories": [
        "restaurant",
        "cafe",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/openstreetmap-places").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 '{
  "place": "Kreuzberg, Berlin",
  "categories": [
    "restaurant",
    "cafe"
  ]
}' |
apify call xtracto/openstreetmap-places --silent --output-dataset

```

## MCP server setup

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

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/GeTunhPsSWZv4DBeb/builds/GWDbiNMvXW2QT3fqd/openapi.json
