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

Re-do Lua API #901

Closed
pnorman opened this issue Jan 16, 2019 · 8 comments
Closed

Re-do Lua API #901

pnorman opened this issue Jan 16, 2019 · 8 comments
Milestone

Comments

@pnorman
Copy link
Collaborator

pnorman commented Jan 16, 2019

Now that we have experience with the Lua API, the multi-backend, and have new feature requests which require API changes, we should redo the API.

To allow a transform to be compatible with current API we can use different function names, and then a transform can implement both entry points reasonably easily.

The current API is

function filter_tags_node(tags, num_tags)
return filter, tags

function filter_tags_way(tags, num_tags)
return filter, tags, polygon, roads

function filter_basic_tags_rel(tags, num_tags)
return filter, tags

function filter_tags_relation_member(tags, member_tags,
    roles, num_members)
return filter, tags, member_superseded, boundary,
    polygon, roads

Experience has shown num_tags is not needed because we're not in C. next(tags) == nil does the same check, is more idiomatic Lua, and is faster.

With old-style MP support gone, we don't need the superseded tests.

New features desired are

What other changes do we want to make?

cc @kevinkreiser @systemed

@kevinkreiser
Copy link
Contributor

kevinkreiser commented Jan 19, 2019

The second bullet point was the main feature I was hoping for! If anything else springs to mind I'll post back.

@pnorman pnorman pinned this issue Mar 21, 2019
@pnorman
Copy link
Collaborator Author

pnorman commented Mar 21, 2019

We should let the lua transforms set the distance for line splitting on a per-object area, as well as set if MULTIPOLYGONs are broken up

@systemed
Copy link
Contributor

In an ideal world I'd like filter_tags_way to have some very limited access to the way geometry (even if just the first node), for national rendering variations. Currently I cope with this by pre-/post-processing. This may or not be at all possible!

@pnorman
Copy link
Collaborator Author

pnorman commented Mar 22, 2019

If it is possible - and I'm not sure on that - bounding box is probably the sensible arg to pass

@lonvia
Copy link
Collaborator

lonvia commented Mar 22, 2019

It's possible, we have the information but it would make the processing more expensive. Currently we only retrieve geometries for ways that have not been filtered. If filtering needs the geometries then we need to retrieve it for all ways. So my favourite solution would be a callback function for Lua that can retrieve the geometry when needed. (e.g. in the particular case only for ways that are rendered in a country-specific style.).

@systemed
Copy link
Contributor

+1 - that's something I do in both tilemaker and my OSRM fork and it works very effectively.

@mmd-osm
Copy link
Contributor

mmd-osm commented Jun 17, 2019

This might be a new use case for the Lua API: https://twitter.com/realgiggls/status/1138066068117884929

@lonvia
Copy link
Collaborator

lonvia commented Feb 7, 2020

Implemented in new 'flex' output.

@lonvia lonvia closed this as completed Feb 7, 2020
@lonvia lonvia unpinned this issue Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants