Skip to content

Feature Request: Support directional filters (north/south/east/west) similar to around #780

@chenlingmin

Description

@chenlingmin

Feature Request: Support directional filters (north/south/east/west) similar to around

Description

Currently, Overpass QL supports around for radius-based spatial queries and bbox/area for rectangular or administrative area filtering. However, there is no native support for directional filtering, such as selecting objects north, south, east, or west of a reference object. This is a common use case, for example: "all residential areas south of a school."

Use case / motivation

  • Find all neighborhoods south of a school or all residential areas east of a road
  • Analyze spatial relationships between OSM objects without exporting to GIS or Python
  • Simplify queries that currently require around plus external coordinate filtering

Proposed feature

  • Introduce new spatial filters, e.g., north_of, south_of, east_of, west_of
  • Or extend around with a directional parameter:
way(around.school:500, direction=south);
  • Functionality should be similar to around:
    • Use object center points
    • Apply both distance and directional constraints
    • Return objects satisfying both radius and direction conditions

Benefits

  • Eliminates the need for post-processing in GIS or Python for directional filtering
  • Makes Overpass QL more expressive and closer to a spatial query language
  • Supports common real-world mapping and urban analysis scenarios

Additional context

  • Internally, this could be implemented by calculating the dx/dy between candidate object centers and the reference object, similar to how around computes distances
  • Directional filtering could optionally be combined with distance, e.g., "objects within 500m south of a school"

References / Related

  • around implementation: calculates object centers and approximate planar distances
  • Current workaround: export object centers and filter by coordinates externally

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions