Skip to content

Search result display names assign features to anachronistic parents #1402

Closed

Description

@1ec5

As of OpenHistoricalMap/ohm-deploy#809, the “address” or display name that Nominatim calculates for each search result assigns the feature to a set of often anachronistic parents. For example, searching for “San Jose State University” returns this correct result, a university campus that started in 1994. However, the label puts it in San José Township [1873 – 1881] at admin level 7 and Las Californias [1770 – 1786] at admin level 4.

Search results for San Jose State University: University San José State University, South 7th Street, East San Jose, San Jose, San José Township, Santa Clara County, Las Californias, 95113, United States [1994 – ]

Nominatim knows all the boundaries that contain this university, regardless of time period. It knows that the university lies in California at admin level 4, but Las Californias has been prioritized instead. For the purpose of calculating the address, Nominatim has chosen the boundary at each admin level that has the largest area, among other weighting factors. I think we might need to fork Nominatim in order to filter this SQL query by matching dates in extratags or possibly filter by date in subsequent statements.

Activity

  1. added theissue type on Jul 15, 2026
  2. 1ec5 commented on Jul 15, 2026

    @1ec5
    MemberAuthor

    This is somewhat related to the wrong country problem, but countries are special because of the precomputed grid: #1403.

  3. 1ec5 commented on Jul 20, 2026

    @1ec5
    MemberAuthor

    A given result can be located in multiple places at the same admin level. The current behavior breaks the tie by area, but we would want to break the tie by the longest overlapping duration. Each successive parent in the address would need to overlap the time period of the previous component in the address.

    For an address like “X, Y, Z”, X’s dates must overlap Y’s and Z’s dates. Among the candidate boundaries, Y must be the boundary with the most overlap with X, and Z must be the boundary with the most overlap with Y.

  4. Rub21 commented on Aug 11, 2026

    @Rub21
    Member

    I made the address calculation that use dates. I changed two things, parents that existed at the same time as the result now come first. And when no candidate at a level existed back then, I leave that level out of the address.

    curl -s "https://nominatim.ohmstaging.org/search.php?q=San+Jose+State+University&format=jsonv2&extratags=1" \
      | jq -r '.[] | "starts \(.extratags.start_date // "?") -> \(.display_name)"'
    starts 1857 -> San José State University, San Jose, San José Township, Santa Clara County, California, United States
    starts 1994 -> San José State University, South 5th Street, San Jose, Santa Clara County, 95113, United States
    (env_default) ➜  2026-08-11
    

    The 1857 one keeps both San José Township [1873–1881] and California [1850–1959], because it has no end_date, so its period runs from 1857 onwards and overlaps both. The 1994 one loses both, since the township ended in 1881 and that California ended in 1959. Both keep Santa Clara County [1963–present], which is still open and overlaps either period.

    I read the dates from start_date and end_date in extratags. Places with no dates match everything, so undated data works as before.In many cases the data itself is wrong. For example, relation 2692754 has an end_date one day before its start_date, which looks like a typo. That relation is the only California covering the present day, so on staging a modern place ends up with no state at all.

    If you have more examples for testing it would be good to test. also the fork for OHM Nominatim custom fork is here: https://github.com/OpenHistoricalMap/Nominatim/tree/ohm_date

  5. 1ec5 commented on Aug 12, 2026

    @1ec5
    MemberAuthor

    I changed two things, parents that existed at the same time as the result now come first. And when no candidate at a level existed back then, I leave that level out of the address.

    These changes seem to be a big improvement in cursory testing. Performance for results in San José seem much slower, but I don’t know if that’s because of the less powerful staging server or because we’re having to sort so many San José boundaries that we didn’t have to sort before.

    I wonder about the choice to only rank the parents by whether they overlap, as a Boolean decision. Does this query affect anything other than the display name? If it’s only about display, then it’s better to filter by whether there’s an overlap. That way, we don’t have to sort as many potential parents, and we won’t potentially show things that aren’t parents because they never overlapped.

    Or even better, we could sort by the duration of the overlap. This will break ties more meaningfully. A parent that overlapped by a century is much more useful than a parent that overlapped by only a year.

    In many cases the data itself is wrong. For example, relation 2692754 has an end_date one day before its start_date, which looks like a typo. That relation is the only California covering the present day, so on staging a modern place ends up with no state at all.

    Did you mean a different relation? This relation doesn’t have any end_date=* tag on either staging or production. The Nominatim UI result page for this university says it set the level 4 parent to this California boundary, which starts in 1850 and ends in 1959, but it still isn’t ending up in the display name for some reason.

  6. Rub21 commented on Sep 13, 2026

    @Rub21
    Member

    Did you mean a different relation? This relation doesn’t have any end_date=* tag on either staging or production.

    You were right, I was wrong. R2692754 has no end_date in OHM. I was reading the value Nominatim stores, not the value in the data.

    The end_date comes from a node, N2090859626 "California (1959-present)":

    place=state
    wikidata=Q99
    start_date=1959-12-31
    end_date=1959-12-30     ← ends the day before it starts
    

    Nominatim links that node to the boundary and copies the tag over. When it indexes a boundary, it looks for a place node for the same place, so the polygon and the point do not come back as two results. It tries four ways, in this order:

    • a member node with role label
    • same wikidata, node inside the polygon
    • same place type and a similar name, node inside the polygon
    • same name and same address rank, node inside the polygon

    Only the first one needs the node to be a member. R2692754 has no node members, so it matched on the second one, wikidata=Q99. Then the trigger copies every tag the boundary does not have, and end_date is one of them.

    This happens because in OHM every time slice of a place shares the same wikidata. Nominatim assumes one wikidata is one object, so it links slices from different periods. It is not only California, and it is the same on production and on the preview. Two examples, what the relation has in the data against what Nominatim stores:

    R2692754 California — matched by wikidata=Q99

    in the data     start_date=1959-12-31   end_date=(none)
    in Nominatim    start_date=1959-12-31   end_date=1959-12-30
    linked node     N2090859626 "California (1959-present)"  1959-12-31..1959-12-30
    

    R2860344 España — matched by wikidata=Q29

    in the data     start_date=1977-01-08   end_date=(none)
    in Nominatim    start_date=1977-01-08   end_date=1808
    linked node     N2090982866 "Reino de España"  1700..1808
    

    In both cases the names are different, so it is not a name match. Only the wikidata is shared. Modern Spain now ends in 1808 inside Nominatim, so it can never be the parent of anything modern.

    The Nominatim UI result page for this university says it set the level 4 parent to this California boundary, which starts in 1850 and ends in 1959, but it still isn’t ending up in the display name for some reason.

    About the university: R2692755 ends in 1959 and the campus starts in 1994, so we drop it on purpose. That part is working.

    The one that should take its place is R2692754, which runs from 1959 on. It is still a candidate, but it is rejected too, because of the end_date it inherited, so there is no valid California left and the level stays empty.

    I see two options to handle this:

    • The simple one: do not copy start_date and end_date from the linked node, so a boundary only uses its own dates. It is a small change.

    • The bigger one: check the dates before linking, so a boundary never links a node from another period. Example, R2860344 España. There are four nodes with wikidata=Q29, one per period:

    N2090982866  Reino de España   1700..1808              ← the one it linked
    N2113525612  Reino de España   1813..1873
    N2113525610  Reino de España   1874-12-29..1931-04-13
    N2113525607  España            1975..open              ← the right one, already taken
    

    Matching the right node to the right polygon is the hard part. Spain has four nodes, other places have many more.

    Both changes only run when data is imported, so we need to reindex to see them. And also someone should fix the end_date on N2090859626 in the data.

  7. 1ec5 commented on Sep 13, 2026

    @1ec5
    MemberAuthor

    The end_date comes from a node, N2090859626 "California (1959-present)":

    I deleted the node, since we don’t need manually placed centroid points anymore. We’re slowly deleting these nodes as redundant.

    The simple one: do not copy start_date and end_date from the linked node, so a boundary only uses its own dates. It is a small change.

    I think that would be appropriate. A legitimate label node would represent the settlement associated with the boundary – either the same feature or a distinct one, depending on how you look at it. The settlement almost always predates the boundary. Multiple boundaries in a chronology often share the same place point, so that is expected, but it means Nominatim shouldn’t copy dates from the place point to the boundary relation.

  8. Rub21 commented on Sep 14, 2026

    @Rub21
    Member

    I have deployed the new changes in preview. when Nominatim links a place node to a boundary, it no longer copies start_date and end_date from the node, everything else is still copied, so the boundary keeps the centroid, the importance and the rest. Only the dates are left out, and a boundary now uses its own.

    e.g:

    R2692754 California  1959-12-31..open
    R2860344 España      1977-01-08..open
    R2870169 Polska      1991-03-21..open
    R2692837 România     1991-12-08..open
    R2796671 Michigan    1947-10-11..open
    

    So they can be parents of modern places again. The 1994 campus has its state back:

    W198939478 [1994– ] … San Jose, Santa Clara County, California, 95113, United States
    R2705125   [1857– ] … San José Township, Santa Clara County, California, United States
    

    This changes are still in preview!

  9. 1ec5 commented on Oct 18, 2026

    @1ec5
    MemberAuthor

    I think this is now in good shape in production, other than the country grid, which we’re tracking separately in #1403.

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

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions