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

extend NextRelation/FindInRelation to nodes #632

Merged
merged 13 commits into from
Jan 7, 2024

Commits on Jan 2, 2024

  1. extend NextRelation/FindInRelation to nodes

    This also makes `NextRelation` return a tuple of ID, role rather than
    just ID.
    
    According to https://www.lua.org/pil/5.1.html, I think that's not a breaking change.
    
    Motivation: When I naively try to create labels from OSM entities with the `place`
    tag, I occasionally get duplicates due to relations.
    
    For example, the city of Guelph has [relation
    7486148](https://www.openstreetmap.org/relation/7486148), which has
    [node 36576733](https://www.openstreetmap.org/node/36576733) as its
    `label` member.
    
    They both have `place=city`, so my Lua script faithfully spits out two
    labels.
    
    This PR allows me to suppress the label from the node, which is a start.
    
    Ideally, I'd actually prefer to use the node, as it'll likely have a
    nicely human-curated location. For that, I'd need the relation to be
    able to interrogate its members.
    
    Would you be open to me extending this PR to add `NextMember`,
    `FindInMember` and `RestartMembers` functions that mirror the ones used
    by nodes/ways ?
    cldellow committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    65c8380 View commit details
    Browse the repository at this point in the history
  2. don't truncate int

    cldellow committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    3ce355a View commit details
    Browse the repository at this point in the history
  3. add static_cast

    cldellow committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    ac30cbd View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. don't hardcode role names

    I dunno what I was thinking, this is much better. (And I see now that
    there are many more roles than these four.)
    cldellow committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    a401dad View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    94ea972 View commit details
    Browse the repository at this point in the history
  3. openmaptiles: don't pass false to LayerAsCentroid

    Ugh, I guess this could be considered a breaking change after all.
    
    If a user previously passed `LayerAsCentroid("layername", false)`,
    we'd ignore the false.
    
    With this change, the false causes us to fail, because we expect a
    string.
    
    I'd normally just say this was undefined behaviour, and those users
    deserve to be broken...but it's tricky, since this is a script from the
    official tilemaker repo.
    cldellow committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    154d3ab View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2024

  1. port polylabel from mapbox

    These seems to work well and, at least for large polygons (city parks,
    national parks), is faster than Boost's centroid algorithm. That surprised
    me! I haven't benchmarked it on building polygons yet.
    
    There are several todos here around making it configurable, and making
    it play well with lazy geometries.
    
    Going to finish off the relation memory stuff then fix those.
    cldellow committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    77fb64a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9ca08b3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0910d8a View commit details
    Browse the repository at this point in the history
  4. ::LayerAsCentroid(layer, algorithm, role, ...)

    You can now pass the preferred algorithm to use to LayerAsCentroid.
    
    Still to do: teach lazy geometries about which algorithm was used.
    cldellow committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    c74e4c1 View commit details
    Browse the repository at this point in the history
  5. always materialize centroids if polylabel

    This ensures that the user gets the same, correct behaviour both in
    --materialize-geometries and --lazy-geometries.
    
    We can extend support to materialize geometries, but this PR is already
    getting big (and it has conflicts with the other 2 PRs), so I'm leery of
    getting further out over my skis.
    cldellow committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    3f35ff6 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6b06eb5 View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2024

  1. Configuration menu
    Copy the full SHA
    2f5ca20 View commit details
    Browse the repository at this point in the history