Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Date Calculation in Overpass API Queries #727

Open
baditaflorin opened this issue May 20, 2024 · 1 comment
Open

Dynamic Date Calculation in Overpass API Queries #727

baditaflorin opened this issue May 20, 2024 · 1 comment

Comments

@baditaflorin
Copy link

Background

Currently, the Newer statement in Overpass API restricts output to elements newer than a specified date. The date must be hardcoded in the format YYYY-MM-DDTHH:MM:SSZ, which can be cumbersome and error-prone when dealing with frequently changing queries.

Enhancement

Introduce dynamic date calculation placeholders, such as {{24_hours_ago}}, which will automatically compute the corresponding date and time based on the current UTC time. This will eliminate the need to manually update date values in queries.

Examples of Dynamic Date Placeholders

  • {{1_hour_ago}} - 1 hour ago
  • {{24_hours_ago}} - 24 hours ago
  • {{7_days_ago}} - 7 days ago

Implementation

These placeholders can be processed and replaced with the actual date and time in the required format (YYYY-MM-DDTHH:MM:SSZ) at the time of query execution.

Use Cases

1. Monitoring Recent Edits to Map Data

Scenario: A community of mappers wants to monitor and review recent changes made to the OSM data in their region to ensure data quality and accuracy.

Query Example:

[out:json];
(
  node(newer:{{24_hours_ago}});
  way(newer:{{24_hours_ago}});
  relation(newer:{{24_hours_ago}});
);
out body;

Benefit: Automatically retrieves all changes made in the last 24 hours without the need for manual date adjustments, allowing for timely reviews.

2. Detecting Recently Added or Modified Points of Interest (POIs)

Scenario: A local government uses OSM data to track newly added or modified points of interest (POIs) like schools, hospitals, and parks.

Query Example:

[out:json];
node[amenity](newer:{{7_days_ago}});
out body;

Benefit: Ensures that the government has the latest information on important amenities without manually updating the query every week.

3. Tracking Changes in Road Networks

Scenario: A transportation agency needs to monitor changes to the road network for updating navigation systems and maps.

Query Example:

[out:json];
way[highway](newer:{{7_days_ago}});
out body;

Benefit: Automatically fetches updates to roads and highways made in the past week, streamlining the process of keeping navigation systems current.

Summary

Implementing dynamic date calculation placeholders like {{24_hours_ago}} in Overpass API will greatly enhance query flexibility and accuracy. This feature will be particularly beneficial for applications requiring frequent and timely updates, as demonstrated in the use cases above.

Action Items

  1. Add support for dynamic date placeholders in the Overpass API query processor.
  2. Ensure placeholders are replaced with correct UTC date and time format during query execution.
  3. Update documentation to include examples and usage guidelines for the new feature.
@mmd-osm
Copy link
Contributor

mmd-osm commented May 26, 2024

It would be good if you could explain in more detail why you can’t use the existing overpass turbo extension {{date:1 day}} in this case? How do you run your queries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants