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

Support "Rehydrating" index #36

Open
2 tasks
kylebarron opened this issue Apr 1, 2020 · 1 comment
Open
2 tasks

Support "Rehydrating" index #36

kylebarron opened this issue Apr 1, 2020 · 1 comment

Comments

@kylebarron
Copy link
Owner

Motivation

The SnapFeatures constructor, which constructs the Rtree from the mesh positions, takes up the majority of the time.

image

This index could be useful in the future after the initial snapping of the basemap to the mesh.

For example, say a user is interested in uploading a GPS trace and wants to view it on top of the map, the process for displaying it might be:

  • reproject WGS84 coordinates to web mercator
  • cut line into web tiles, perhaps with the new utilities in math.gl
  • for each tile, load a terrain mesh, and snap the line to it

Idea

Since Flatbush is based on typed arrays, "rehydrating" a flatbush index is easy and supported. https://github.com/mourner/flatbush#flatbushfromdata

This could make it easy to store the rtree for later use (as long as memory pressure isn't a concern)

  • benchmark flatbush.from(data)

  • expose an object from the SnapFeatures that includes

       indexData: Flatbush.data (TypedArray);
       triangles: FloatArray;
       bounds: [number, number, number, number] | null;

    (bounds might not be necessary). This would be an object of 3

@kylebarron
Copy link
Owner Author

Note that storing the index with the tile data would also help if I ever figured out the viewshed algorithm

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