iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.09k stars 293 forks source link

Issue: Not able to use DEM (.bil) as elevation layer #1811

Open prashantthapaliya8989 opened 2 years ago

prashantthapaliya8989 commented 2 years ago

What I have done so far

I have an orthophoto which I hosted in geoserver to obtain WMS url. It is working when I use ColorLayer in the global view.

I want to use .bil file as in this example: https://www.itowns-project.org/itowns/examples/#plugins_pyramidal_tiff

Here is the bil file that I want to use: https://drive.google.com/drive/folders/1byov7Begz5JhgBuTQaMpzbG6FNy1sQm9?usp=sharing

Problem

I am stuck while using the ElevationLayer. I have a dem in tif format and I converted it into .bil format. Since, I am not familiar with .bil format I could not figure out its parameters such as tileMatrixSet, tileMatrixSetLimits. How can I use dem (.bil) in the elevation layer?

https://github.com/iTowns/itowns/blob/master/examples/layers/JSONLayers/GeoidMNT.json I explored this file where the used bil tiles are structured in a folder. The bil file is in the given url: https://github.com/iTowns/iTowns2-sample-data/tree/master/geoid/geoid/bil

prashantthapaliya8989 commented 2 years ago

@gchoqueux

mgermerie commented 2 years ago

Hi !

tileMatrixSet and tileMatrixSetLimits parameters are specifics of TMS standard and not .bil data.

In a general way, should you want to display a .bil DEM using TMSSource, you would first need to arrange your data so that it can be served using TMS standard. You can read more about TMS standard specifications here. This is what is done in our Geoid example : the data repository you mentioned was organized in respect with TMS standard.

In your case, i.e. if you want to display a single .bil file, you should in theory be able to use TMSSource without the need of having a TMS organized data folder. It would be something like this :

const source = new itowns.TMSSource({
    url: 'url to your .bil file',
    format: 'image/x-bil;bits=32',
    crs: 'The coordinates reference system of your .bil data, given as its EPSG code',
    extent: new itowns.Extent(...),  // You will obviously need to replace the dots by the parameters of the actual extent of your .bil data.
});
const layer = new itowns.ElevationLayer('DEM', {
    source: source,
});
view.addLayer(layer);

HOWEVER, I tried this with some test data, and it displays data in each tile (not only on the specified extent). I shall figure out if there's a way of fixing this and let you know of my findings.

jailln commented 1 year ago

The current limitation of itowns that prevents to do it with only one image is that iTowns API doesn't expose a way to read and use only one image (either to display it at a given coordinate or extent or to use it for terrain). This should be added to the roadmap @LoicUTC @PhilippeMarc-IGN since it is a common feature in geomapping libraries.