How to compute elevation image for a given bounding box ? #2509
-
Hello, I am trying to convert a bounding box into an elevation image, like I would like to give as parameter a bounding box and in return a heightmap image representing the elevation of this area see also => VCityTeam/UD-Viz#852. I've look here => https://github.com/iTowns/itowns/blob/master/packages/Main/src/Utils/DEMUtils.js#L319 but this is only working for a given point (I guess I could make a double for loop to reconstruct the elevation but I would like to know the resolution of the image in order to optimize this computation), any help are welcome. Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @valentinMachado, I don't know if it'll be problematic for your use case but one issue you may find along the way is that you will only work with already loaded tiles (and not with the most resolved ones provided by your server). So the zoom level at which you draw your bounding box will have an impact on your result. We miss an API to load the most resolved tiles under a geometry (point, line, bbox, depending on the usecase). I encountered this issue when implementing an elevation measure tool under a point. |
Beta Was this translation helpful? Give feedback.
Hi @jailln thanks for your response, I tried as you said by trying with a DEMUtils way and it could have work but while doing it I realised that I was going to do several drawImage with offset and scale in a canvas 2D context to recompose the heightmap then I was going to transform it in the resolution Iam working with. In my opinion it's like redoing all the system (which is a bit complicated) so instead I tried to modify the
LayeredMaterial
shader applied on the ground and got the result I wanted (the computation cost is a render pass and should be optimized enough). But in order to do that I needLayeredMaterial
to be exposed in the API, here is a PR #2517 (EDIT: actually do a shallow …