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

Add length() Lua function for geometries #1757

Closed
joto opened this issue Sep 8, 2022 · 5 comments
Closed

Add length() Lua function for geometries #1757

joto opened this issue Sep 8, 2022 · 5 comments
Labels
flex Issues about the flex output good first issue Good issue to work on for developers new to osm2pgsql

Comments

@joto
Copy link
Collaborator

joto commented Sep 8, 2022

It would be great to have a length() function for (multi)linestrings. Implementation similar to the area() function for polygons using the boost::geometry function of the same name.

See #1756

@joto joto added good first issue Good issue to work on for developers new to osm2pgsql flex Issues about the flex output labels Sep 8, 2022
@pnorman
Copy link
Collaborator

pnorman commented Sep 8, 2022

Should this be the total length, or, when splitting is on, the length of the split linestring?

@joto
Copy link
Collaborator Author

joto commented Sep 8, 2022

Should this be the total length, or, when splitting is on, the length of the split linestring?

This would be a function on geometry objects which don't do magic auto-splitting. It should just do what it says on the box, i.e. calculate the length of that geometry.

@victoriasiver26
Copy link

Hello, I am interested in contributing. This would be my first contribution so I might need some extra guidence, would that be alright?

@joto
Copy link
Collaborator Author

joto commented Sep 13, 2022

@victoriasiver26 Sure. Try installing osm2pgsql from source and running it using the flex output. Try the geometries-using-insert.lua example from the flex-config directory. Look there for use of the area() function. Then find the places in the source where the area() function is implemented and do the equivalent for the length() function.

@lonvia
Copy link
Collaborator

lonvia commented Sep 25, 2022

Implemented in #1777.

@lonvia lonvia closed this as completed Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flex Issues about the flex output good first issue Good issue to work on for developers new to osm2pgsql
Projects
None yet
Development

No branches or pull requests

4 participants