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

"Approximation" algorithm #36

Open
nawagers opened this issue Nov 30, 2017 · 0 comments
Open

"Approximation" algorithm #36

nawagers opened this issue Nov 30, 2017 · 0 comments

Comments

@nawagers
Copy link
Contributor

The "approximation" algorithm is poorly named and the implementation doesn't make sense to me.

The word approximation means an estimate or "not exact". Generally an approximation is used when the algorithm is faster or requires less memory. The trade off is less accuracy. Based on what the functions are doing, the code is "interpolating". Interpolation tries to improve accuracy by building a model of multiple points and calculating the most likely value. Approximation and Interpolation are basically opposites in this context. I suggest the public interface is changed to use "Interpolate" instead.

In regards to implementation, the function "approximation" appears to be using a linear distance weighted function. However, it doesn't use the closest value to the point of interest. Currently, if the point lies in the center cell of a 3x3 grid:

---
-+-
---

The cells used to compute the elevations and the weights are as follows:

-*-
*-*
-*-

The center cell is not checked. This is illogical since it contains the closest point. Also, the weighting function does not appear to be any standard GIS method

I suggest the library offer 3 spatial interpolation methods: Nearest Neighbor, Natural Neighbor, Inverse Distance Weighted.

Nearest Neighbor would return the elevation of the cell that contains the point, same as the current implementation using "Approximate=False"
Natural Neighbor would use the four closest points and weighting them based on the new areas of a voronoi tesselation: Natural Neighbor
IDW includes all point in some radius and weighted by 1/distance. This could be offered by "IDW5"

-*-
***
-*-

and "IDW13"

--*--
-***-
*****
-***-
--*--

Thoughts?

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

1 participant