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

Guess quantize factor from input data #141

Merged
merged 2 commits into from
Sep 19, 2021

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented Sep 19, 2021

This PR fix #140.

When loading Topojson data from file the data its pretty normal that the data is quantised and delta-encoded beforehand.

But in this case during the toposimplification it first dequantize the arcs, then apply a simplify and then quantise again. But for the quantisation it requires a quantisation factor. If this is not set in the options it will now use an estimated guess from the input data.

The delta-encoding happens from the first coordinate of each arc, so we can check the integer length of the max coordinate-value of all arcs first coordinate.

power_estimate = len(str(int(np_arcs[:,0].max())))
quant_factor_estimate = 10 ** power_estimate

@mattijn mattijn merged commit 954b4b6 into master Sep 19, 2021
@mattijn mattijn deleted the guess-quantize-factor-from-input-data branch June 9, 2022 12:21
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

Successfully merging this pull request may close these issues.

toposimplify wrongly applied on Topojson data from file
1 participant