three-geo icon indicating copy to clipboard operation
three-geo copied to clipboard

How to get elevation of points?

Open eserrose opened this issue 5 years ago • 5 comments

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.

eserrose avatar Jul 07 '20 01:07 eserrose

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

https://github.com/w3reality/three-geo/blob/07a47d6558297758bf606a67d0aebea90fde0a5c/examples/geo-viewer/src/viewer.js#L459-L463

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

j-devel avatar Jul 08 '20 14:07 j-devel

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.

Spope avatar Jul 10 '20 13:07 Spope

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.

eserrose avatar Jul 10 '20 14:07 eserrose

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?

j-devel avatar Jul 11 '20 05:07 j-devel

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

Spope avatar Jul 15 '20 07:07 Spope