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

Length for tg_line? #5

Closed
simonrolfmore-brunswick opened this issue Oct 2, 2023 · 3 comments
Closed

Length for tg_line? #5

simonrolfmore-brunswick opened this issue Oct 2, 2023 · 3 comments

Comments

@simonrolfmore-brunswick
Copy link

I absolutely appreciate this may not be the way you want to go with tg, but I figure it can't hurt to ask: would you be interested in exposing a function to calculate the length of a tg_line?

It looks like there's already an internal length function for calculating the Pythagoras distance between 2 points, and a function to calculate a ring's perimeter as part of the Polsby-Popper score calculation, so this doesn't appear to be a huge stretch in terms of extra code, but I understand this may not be an API overhead you want to take on.

For full disclosure, I'm asking for this with the hope of it getting incorporated into sqlite-tg as it's a much lighter-weight alternative to using Spatialite and the GeoJSON conversion, intersection, and bounding box functions are super useful for the work I'm doing.

@tidwall
Copy link
Owner

tidwall commented Oct 3, 2023

You're right that this should be a relatively simple change. Most of the code is already there but just needs to be exposed to the API.

I'll dig a little deep and see what I can do.

tidwall added a commit that referenced this issue Oct 4, 2023
This commit exposes the following methods:

- tg_line_length
- tg_ring_perimeter
- tg_ring_area

See #5
@tidwall
Copy link
Owner

tidwall commented Oct 4, 2023

The method is now available.

@simonrolfmore-brunswick
Copy link
Author

Thank you! Looks fantastic :)

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

2 participants