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

How to get elevation of points? #22

Open
eserrose opened this issue Jul 7, 2020 · 5 comments
Open

How to get elevation of points? #22

eserrose opened this issue Jul 7, 2020 · 5 comments

Comments

@eserrose
Copy link

eserrose commented Jul 7, 2020

In geo-viewer, clicking a point gives all x,y, and z coordinates of a point. However, I could not find how that is done. Can someone please help?
Much appreciated.

@j-devel
Copy link
Contributor

j-devel commented Jul 8, 2020

That [x, y, z] is the result of applying "mouse picking" against the visible terrain mesh objects with:

_doRaycast(mx, my) {
return Viewer._applyWithMeshesVisible(
this.objsInteractive, (meshes) =>
this.threelet.raycastFromMouse(mx, my, meshes));
}

For the underlying raycasting function raycastFromMouse(), please follow its implementation.

@Spope
Copy link

Spope commented Jul 10, 2020

Hi,

First thanks for your library, it rocks !
This ticket is named exactly as I would have named mine, so I put my question here.

I looked at your example "projection" and I saw that your are setting the elevation of the point by hand.
I tried to use the _resovleElevation by passing the meshes to the proj function (and it works) but I guess there is some debug code which try to access window._scene to display the result of the function.

I guess I should not be using this as it is mentionned WIP, but there is currently not any other way to retrieve the height of a given point right ?

Thanks again for your work.

@eserrose
Copy link
Author

I found out that you can obtain the height of any coordinate using Mapbox rgb terrain tiles (you can find a library for this). The rest is easy as shown in the projection example.

@j-devel
Copy link
Contributor

j-devel commented Jul 11, 2020

I tried to use the _resovleElevation by passing the meshes to the proj function (and it works)
...
I guess I should not be using this as it is mentionned WIP, but there is currently not any other way to retrieve the height of a given point right ?

Hi @Spope ! Resolving elevation by proj() with the meshes argument (i.e. [x, y, z] = proj(latlng, meshes)) is WIP and the internal _resolveElevation() would not be robust enough (hence not yet documented in API). Yes, this is the only approach tried thus far.

you can obtain the height of any coordinate using Mapbox rgb terrain tiles (you can find a library for this)

@eserrose Curious, what's the name of the library?

@Spope
Copy link

Spope commented Jul 15, 2020

Thanks for the answers, will look for other way of doing this.

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

3 participants