Skip to content

Query Features should only show features in date range #1163

Closed

Description

@CharliePlett

Bug description
When you right click on the map and select Query Features it returns all enclosing features that exist at that point.

I believe it should only show features that exist in the selected date.

Currently when I want to see surrounding features there are 300 British Empire and Spanish Empire relations clogging up the list, that I have to look through. (Totally my fault)

Alternate Solution
We could have a separate button to show all surrounding features, though I don't really see a reason for that.

Screenshots

Image Image

Activity

  1. 1ec5 commented on Oct 16, 2025

    @1ec5
    Member

    Related to filtering Nominatim results by date (#196), but far more straightforward. Here’s where we construct the Overpass queries:

    https://github.com/OpenHistoricalMap/ohm-website/blob/c0ac066115115e8e8c17d475ce8d796d6f1f5bfc/app/assets/javascripts/index/query.js#L315-L318

    Here’s an example Overpass query that filters by a given point in time.

  2. added
    website
    on Oct 16, 2025
  3. added theissue type on Oct 16, 2025
  4. 1ec5 commented on Oct 16, 2025

    @1ec5
    Member

    We could have a separate button to show all surrounding features, though I don't really see a reason for that.

    Sometimes I do need to find a feature by location without knowing its exact dates, especially if it was shortlived. But I think we could get this option for free by making date filtering optional overall: #930.

  5. Rub21 commented on Nov 28, 2025

    @Rub21
    Member

    This feature could work with the current date on the slider and show only the objects whose start_date is greater than or equal to the current date. If you want to see all objects, you could set the year to 0 and filter from there.

            // Example with currentDate = 1952:
            //   - Object 1952-2000: 1952 >= 1952 ✓ (matches)
            //   - Object 1960-2000: 1960 >= 1952 ✓ (matches)
            //   - Object 1900-1950: 1900 >= 1952 ✗ (starts before current date, excluded)
            //   - Object start_date=1600: 1600 >= 1952 ✗ (starts before current date, excluded)
            //   - Object (no start_date): no start_date ✓ (included - unknown creation date)
    

    This is a start to see that it is possible to filter by dates in Overpass. Is it necessary to include end_date? I could modify the script in case we need to set a specific range.

    Changes: https://github.com/OpenHistoricalMap/ohm-website/blob/ffbfa72982ab3a29b6094fc18701c654eb4e5d10/app/assets/javascripts/index/query.js#L307-L358

    Current filter in production

    Image

    Staging filters

    Image

    https://staging.openhistoricalmap.org/query?lat=-12.05321&lon=-77.11226#map=15/-12.05796/-77.10218&layers=O&date=1950-10-14&daterange=1825-01-01,2025-12-31

  6. 1ec5 commented on Nov 29, 2025

    @1ec5
    Member

    That looks promising. It’ll be a big usability improvement (as well as a performance improvement).

    The query on staging is returning four boundaries that didn’t exist in 1950. From the branch so far, it looks like you might’ve taken my suggestion to base it off this example, but I forgot to mention two caveats:

    • The example is only granular down to the year.
    • The example only considers start_date=* and assumes the results still exist.

    This query considers both start_date=* and end_date=* down to the day. With a few modifications, I think your changes will yield the correct results.

  7. Rub21 commented on Dec 2, 2025

    @Rub21
    Member

    The query on staging is returning four boundaries that didn’t exist in 1950

    We are using the production Overpass endpoint in staging because we don't have a specific Overpass stack for staging. that maybe the reason some object does not exist in staging, it comes from production DB , On the other hand, I have modified the script according to the example and it now returns better results according to the current date

    Image Image

    PR: OpenHistoricalMap/ohm-website#356

  8. Rub21 commented on Dec 5, 2025

    @Rub21
    Member

    I made some other changes to the script so that it can filter the data below 1000 with JavaScript; it works fine now.

    1264 BC 183 BC
    Image 1 Image 2
    1849 2025
    Image 3 Image 4
  9. Rub21 commented on Dec 19, 2025

    @Rub21
    Member

    This feature has been deployed in production. The features now return according to the current slider date.

    Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Nominatimwebsite

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions