xlhomme / GeotiffParser.js

A JavaScript-based parser for the GeoTIFF image format.
Mozilla Public License 2.0
46 stars 15 forks source link

Can I retrieve elevation #3

Closed ClaudeVernier closed 9 years ago

ClaudeVernier commented 9 years ago

Hi,

Thank you for the work you have put in creating this JavaScript module and for putting it on here.

I have been trying to use it in the goal of reading elevation data at any coordinate.
I have a geotiff file and a web site where I use Google Maps to display an earth map.

When user clicks on one point, let's say in the ocean, I am able to get the longitude and latitude but now, I want to know how deep is the water. I don't need an exact real time value but I need to request this value really often so, asking a web service is not an option.

That's why I plan to keep my GeoTiff file in memory and look in it for the elevation for one coordinate.

Could you please tell me if your GeoTiffParser can do this ? I started reading the code but I couldn't find the answer yet so I wanted to ask you if you believe this is possible, if you would give me permission to use it this way and, maybe, you would have a bit of code doing this.

Thank you for any time you will be able to give to this message.

Best regards, et bonne continuation ! Claude VERNIER

xlhomme commented 9 years ago

Hi Thanks for using GeoTiffParser.js. If you want to obtain many accurate elevation data very often, a javascript application is probably not the best way to achieve your goal. Anyway. GeoTiffParser keep some read block of your file in memory. But you cant keep all bloacks in memry , depends of the size of the Geotiff file .

For reading big geotiff file, you should have a look on the WCSTerrainProvider for cesium ans especially the indexedDB file. https://github.com/xlhomme/WCSTerrainProvider In the project ,I used a GeoServer to serve elevation data (coming from a GeoTiff or SRTM file) and I requested it through WCS protocol in order to retreive a part of the elevation. The WCS request returns me a geotiff file. I'm able to parse the file with the GeoTiffParser.js and store an array of elevation with IndexedDB. Untill I stay on inside the requested area I'am able the retrieve the elevation value in the strored array. When I want to request a value outside, I need to request another tile from WCS.

xl

2015-06-18 19:04 GMT+02:00 ClaudeVernier notifications@github.com:

Hi,

Thank you for the work you have put in creating this JavaScript module and for putting it on here.

I have been trying to use it in the goal of reading elevation data at any coordinate.

I have a geotiff file and a web site where I use Google Maps to display an earth map.

When user clicks on one point, let's say in the ocean, I am able to get the longitude and latitude but now, I want to know how deep is the water. I don't need an exact real time value but I need to request this value really often so, asking a web service is not an option.

That's why I plan to keep my GeoTiff file in memory and look in it for the elevation for one coordinate.

Could you please tell me if your GeoTiffParser can do this ? I started reading the code but I couldn't find the answer yet so I wanted to ask you if you believe this is possible, if you would give me permission to use it this way and, maybe, you would have a bit of code doing this.

Thank you for any time you will be able to give to this message.

Best regards, et bonne continuation ! Claude VERNIER

— Reply to this email directly or view it on GitHub https://github.com/xlhomme/GeotiffParser.js/issues/3.

ClaudeVernier commented 9 years ago

Hi,

Many thanks for your answer. There are a lot of new concepts in there for me to learn from. I did not know about Celsium…

I am a Canadian developer, working in Paris on mainly web sites and SQL Server front ends… The project where I want to find elevation is a hobby project, I don’t need much precision. Maybe if I could show you a sample, you would be able to tell me if my idea is feasible or not…

I have copied my web site on Azure; it is very far from good, in a previous version, it was also a project to test several features of Bing Maps and Google Maps, there is “Menu” button on the right side that enables to set options on and off… Works best in Chrome now: http://unchartedwaters.azurewebsites.net/

There is image buttons on the bottom to drive the boat on the sea and if the boat meets the land, it stops. Approaching a harbour, a zone gets highlighted and if the boat gets in the zone, the player can enter the city… There is also a Log button on the bottom left side that shows the calls to the Google Elevation web service and other events.

To make the animation smoother, and it will be even more important when pirate ships (there is one actually in Quiberon Bay…) will be controlled by the AI (!!), there will be way too much calls to the Elevation web service so I searched for other ways.

Then, on GEBCO web site, I have found a TIFF file that, as far as I understood would contain the elevation (GeoTIFF format (445 Mbytes) for the region between 72N and 72S): http://www.gebco.net/data_and_products/gebco_world_map/

It also made me realize that if I could also use a TIFF file as the imagery layer of the game, the game could be played offline… but I am not sure yet if I want to go in that direction. For the moment, I would like to find a point on the TIFF file that corresponds to latitude, longitude couple and get the elevation.

At some point, I will remove the buttons and the player will simply click where he wants to go and the boat must stop if there is land or an island or not enough water if the boat is full of goods.

I also thought of reading the values once and store them in a database (indexedDB), I tried with the Elevation service and it was too big but I could do it with the TIFF file I presume.

At my first try with the GeoTiffParser, I couldn’t find elevation data. Thanks to your answer, I tried with WCSTerrainProvider but I got blocked by the references to Cesium in the code. I tried to get Cesium code and extract only the bits I thought I needed but it doesn’t seem like the good thing to do.

I am sorry for writing such a long story but, I started to feel a bit lost on that problem and couldn’t find in what direction to go. If you would have some advice or guidance on this, it would be really appreciated. If that hobby ever turns into a real game, I plan it to be a free web-based game, for desktop browsers and smartphones.

Thank you for reading my message and for any time you will be able to give to it.

Regards, Claude

xlhomme commented 9 years ago

Hi, The key point is the way you handled multiple resolutions of your data for keeping the bandwidth. You should have a structure like a quad tree and download for each tile/quad the data (encoded here as a geotiff file). If you use the WCS protocol to download the tile, you could add a scaling parameter in order to keep the same amount of bytes for each quad. There is a example of the use of such parameter in the WCS URL of the WCS provider for cesium.

For your web game, It could be better to download all the data first, instead of downloading quad during the game... But it's another story.

If your are near 'La defense' we could meet....

ClaudeVernier commented 9 years ago

Ah!! Je passes au français alors !!! :-) Ce serait avec plaisir, je suis à Boulogne en journée... Je vous contacte par email. Merci. :-)