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 obtain elevation data through longitude and latitude coordinates #38

Open
fzw2408 opened this issue May 23, 2022 · 2 comments
Open
Labels
help wanted Extra attention is needed

Comments

@fzw2408
Copy link

fzw2408 commented May 23, 2022

hi tentone:
base scene: we wan't to make same mark on map by longitude and latitude 。some time longitude and latitude location is on the mountain 。datumsToSpherical just return plane coordinates [x,y]. and then the make sprite will be Obscured by the terrain mesh。

In my way: longitude and latitude => ESP900913[x,y,z] (y ===0 )[plane x y coordinates] =>tile[x+offset,y+offset, >14level ] =>get tile terrain image. =>get offset pixe data cal the height data . but there still has error by this way。
do you have same method by gpu or some other ?
look forward to your reply!!!

@tentone
Copy link
Owner

tentone commented Jul 1, 2022

Hello

Sorry for the late response. The method you are using seems correct it only seems to miss on the height extraction from the tile image texture.

To calculate the height from a pixel value you have to use the following formula

elevation = -10000 + (({R} * 256 * 256 + {G} * 256 + {B}) * 0.1)

Maybe we could add a util to library with this technique.

Thanks a lot!

@tentone tentone added the help wanted Extra attention is needed label Jul 1, 2022
@laraduarte
Copy link

@tentone might be a silly question but how do we get the RGB?
elevation = -10000 + (({R} * 256 * 256 + {G} * 256 + {B}) * 0.1)

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants