# OpenStreetMap Scraper - POI and places by area (`marekhartmann/openstreetmap-scraper`) Actor

Query OpenStreetMap via Overpass and get places, POIs and their tags with coordinates. Rotates between Overpass mirrors and reports a server-side outage instead of returning it to you as an empty result.

- **URL**: https://apify.com/marekhartmann/openstreetmap-scraper.md
- **Developed by:** [Marek Hartmann](https://apify.com/marekhartmann) (community)
- **Categories:** Automation, Lead generation, Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## OpenStreetMap Data Scraper

Stiahne miesta z OpenStreetMap cez Overpass API — kaviarne, obchody, lekárne,
čokoľvek so značkou — v zadanom obdĺžniku. Vráti názov, súradnice, adresu,
telefón, web, otváracie hodiny a všetky značky.

Bez API kľúča a bez prihlásenia.

### Zadanie je skratka, nie programovanie

```
amenity=cafe@48.14,17.10,48.16,17.12
shop=bakery@50.05,14.40,50.10,14.45
tourism@47.49,19.03,47.52,19.08
```

Tvar je `kľúč=hodnota@juh,západ,sever,východ`. Actor z toho zostaví dotaz na body,
cesty aj relácie. Kto vie po Overpassovsky, môže napísať celý dotaz rovno.

Prevrátená alebo neúplná oblasť je **chyba zadania, nie pád** — beh pokračuje
ďalším zadaním a v `RUN_REPORT` je napísané, čo bolo zle.

### Čím sa líši

**Preťažený Overpass nezhodí beh.** Overpass je zadarmo a preto býva vyťažený —
pri skúške 21. 8. 2026 vrátil na ťažší dotaz HTTP 504. Actor pri 429, 502, 503 a
504 skúsi ďalšie zrkadlo (`overpass-api.de` → `kumi.systems` → `private.coffee`)
a v `RUN_REPORT` napíše, ktoré odpovedalo a ktoré preskočil.

**Prázdna oblasť nie je faktúra.**

| čo sa stalo | ako to skončí |
|-------------|---------------|
| Overpass odpovie a `elements` je prázdne | beh **uspeje**, v oblasti naozaj nič nie je. Pri účtovaní za výsledok **neplatíš nič** |
| odmietnu všetky zrkadlá | beh **zlyhá** s výpisom, ktoré a s akým stavom |
| odpoveď nemá hlavičku Overpassu | beh **zlyhá** — najprv kontrolná otázka na známu oblasť |

Odpoveď sa pozná podľa hlavičky `generator`, nie podľa dĺžky tela. `{"elements":[]}`
bez hlavičky **nie je** odpoveď Overpassu a Actor to za prázdnu oblasť nevydá.

### Vývoj

```
npm install
npm test                  # 13 testov, bez siete
node scripts/smoke.mjs    # ostrý test proti živému Overpassu
```

Postavené na `Marek-Actor-Kit`.

### Need a scraper for something else?

I build custom Apify Actors and browser automation the same way this one is built:
a verified result or an explicit failure, never an empty dataset sold as a success.

- My other Actors: https://apify.com/marekhartmann
- Code and test suites: https://github.com/marekhartmann-creator

Tell me the site and what you need out of it.

# Actor input Schema

## `queries` (type: `array`):

Use the form "key=value@south,west,north,east", for example "amenity=cafe@48.14,17.10,48.16,17.12". If you know Overpass QL you can paste a full query instead (it must start with \[out:json]). If an area contains nothing, the run does NOT fail and you are not charged for it.

## `maxResultsPerQuery` (type: `integer`):

Hard cap on how many results are collected per query. The run stops at this number even if more pages exist, so a broad query cannot run away with your credits.

## `proxyConfiguration` (type: `object`):

Apify Proxy configuration. Leave the default unless the source starts rate-limiting your datacenter IP; residential is rarely needed here.

## Actor input object example

```json
{
  "queries": [
    "amenity=cafe@48.14,17.10,48.16,17.12"
  ],
  "maxResultsPerQuery": 1000,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per element: OSM id and type, latitude, longitude and the full tag set.

## `runReport` (type: `string`):

Per-query outcome, which Overpass mirror answered, and the generator header proving the response was a real Overpass answer.

# 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 = {
    "queries": [
        "amenity=cafe@48.14,17.10,48.16,17.12"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("marekhartmann/openstreetmap-scraper").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 = { "queries": ["amenity=cafe@48.14,17.10,48.16,17.12"] }

# Run the Actor and wait for it to finish
run = client.actor("marekhartmann/openstreetmap-scraper").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 '{
  "queries": [
    "amenity=cafe@48.14,17.10,48.16,17.12"
  ]
}' |
apify call marekhartmann/openstreetmap-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/yTVoLoLbbJAmTpuFZ/builds/Z0k2QJIZBDPojf8i5/openapi.json
