# Overpass QL

> procedural, imperative language loosely based on C syntax for querying OpenStreetMap data through the Overpass API

**Wikidata**: [Q106847581](https://www.wikidata.org/wiki/Q106847581)  
**Source**: https://4ort.xyz/entity/overpass-ql

## Summary
Overpass QL (Overpass Query Language) is a procedural, imperative programming language used to query OpenStreetMap data via the Overpass API. It features a syntax loosely based on C and serves as the primary method for retrieving specific geospatial data from the OpenStreetMap database.

## Key Facts
*   **Primary Use:** Used to query OpenStreetMap data through the Overpass API.
*   **Developer:** Created by Roland Olbricht.
*   **Programming Paradigm:** Follows both imperative and procedural programming paradigms.
*   **Syntax Base:** Loosely based on C syntax (identified in properties as related to Q15777) and derived from Overpass XML.
*   **Aliases:** Also known as "Overpass Query Language" and "OverpassQL."
*   **Type:** Classified as a query language, a procedural programming language, and an imperative programming language.
*   **Relationship:** Named after and operates as a facet of the Overpass API; related to Overpass XML.

## FAQs
### Q: What is Overpass QL used for?
A: Overpass QL is used to retrieve specific data from the OpenStreetMap database. It allows users to filter and extract map elements, such as roads, buildings, or points of interest, based on tags and location.

### Q: How does Overpass QL differ from Overpass XML?
A: Both languages query the same Overpass API, but Overpass QL uses a syntax loosely based on C, making it more compact. Overpass XML uses a procedural, imperative XML structure, which is generally more verbose.

### Q: What programming paradigm does Overpass QL follow?
A: It follows the imperative and procedural programming paradigms. This means users write a sequence of instructions or statements to define how the query should be executed step-by-step.

### Q: Who developed Overpass QL?
A: The language and the associated Overpass API were developed by Roland Olbricht.

## Why It Matters
Overpass QL is a critical tool in the geospatial ecosystem because it enables highly specific, complex data extraction from OpenStreetMap (OSM), which is the world's largest free, editable map database. Unlike general API requests that might return generic map tiles or require extensive post-processing, Overpass QL allows analysts, developers, and cartographers to query raw vector data based on complex logical conditions (e.g., "find all hospitals within 5km of this coordinate built before 2010").

Its design as a procedural and imperative language provides granular control over the query execution flow. This allows for efficient data mining directly at the source, significantly reducing bandwidth and processing requirements for the end-user. By providing a C-style syntax, it lowers the barrier to entry for developers familiar with common programming languages, facilitating the creation of custom maps, geocoding services, and data analysis pipelines.

## Notable For
*   **Unique Paradigm:** Being one of the few domain-specific languages (DSL) for geospatial data that implements both procedural and imperative programming paradigms.
*   **C-Style Syntax:** Distinguishing itself from XML-based alternatives by using a syntax familiar to C, C++, and Java developers.
*   **Direct OSM Access:** Serving as the direct interface for the Overpass API, the standard tool for reading-only access to OSM data.
*   **Dual Language System:** Existing alongside Overpass XML as one of only two query languages supported by the Overpass API.

## Body
### Language Design and Syntax
Overpass QL is defined as a procedural and imperative language. Unlike declarative languages where the user describes *what* they want without specifying control flow, Overpass QL allows users to write scripts that execute statements in sequence. Its syntax is loosely based on C (Q15777), utilizing familiar operators and structural elements to define queries. This design choice makes it more readable and concise compared to its counterpart, Overpass XML.

### Integration with Overpass API
The language is a "facet of" the Overpass API and is explicitly named after it. The Overpass API acts as the engine, while Overpass QL acts as the instruction set. It is optimized for reading OpenStreetMap data quickly and efficiently. The language supports various query types, allowing for the selection of nodes, ways, relations, and areas based on bounding boxes, tags, and spatial relationships.

### Development and Documentation
The language and the API were developed by Roland Olbricht. It is officially documented on the OpenStreetMap Wiki at `wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL`. The wiki serves as the primary reference for the language's syntax, operators, and best practices.

## References

1. [Source](https://wiki.openstreetmap.org/wiki/Special:PermanentLink/2214713)
2. [Source](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL)