kueda / TangramAndroidMBTilesDemo

Demo of using Mapzen's Tangram with an MBTiles data source on Android.
MIT License
6 stars 0 forks source link

Using openseamap mbtiles #2

Closed binu8051 closed 4 years ago

binu8051 commented 4 years ago

Hi Thanks for your code. Its working fine with the world map which you have provided.

I tried to load the openseamap, but struck with the scene.yaml. i download the offline map from https://downloadlayer--onlinechart-ol3.netlify.app/#/download/%5Embtile%24/3761342733?lat=21.5425&lon=80.8154&zoom=4&layers=A1-1&lang=en

Can you help on this, Thanks Binu

kueda commented 4 years ago

Glad you found this repo useful! If you fork it and push your changes I can check your scene.yaml for any problems. I tried downloading the MBTiles file from the source you linked and it looks likes it just contains PNG tiles, and this repo is set up to show MVT vector tiles, so you'd probably need to change the source to show type: Raster. Docs at https://tangrams.readthedocs.io/en/master/Overviews/Raster-Overview/

binu8051 commented 4 years ago

Thanks for your reply i tried with the following scene, but noting came

scene: background: color: '#222'

sources: stamen-terrain: type: Raster url: 'file:///data/user/0/com.mapzen.tangramandroidmbtilesdemo/files/GulfOfBengal.mbtiles' max_zoom: 5

My primary requirement is to create a offline seamap for indian ocean, will your app will help for that purpose. Here is the another mbtile for Indian ocean. https://kap.grade.de/cgi-bin/seamark_download.php?Chart=indian_ocean

kueda commented 4 years ago

If that's your entire scene file then you need to add a layer as documented at https://tangrams.readthedocs.io/en/master/Overviews/Raster-Overview/. However, I can't provide much more help than that unless you post your code to github. The scene files can be finicky, so unless I can see what you're doing I can only speculate about what's going wrong.

binu8051 commented 4 years ago

i loaded the GulfOfBengal.mbtiles into assets folder and used the following code

// Copy mbtiles from assets to files dir where we can use it File file = new File(getFilesDir(), "GulfOfBengal.mbtiles"); if (file.exists()) { Log.d(TAG, "mbtiles exists at " + file.getAbsolutePath()); } else { try { InputStream inputStream = getAssets().open("GulfOfBengal.mbtiles"); OutputStream outputStream = new FileOutputStream(file.getAbsolutePath()); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); } inputStream.close(); outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d(TAG, "Saved mbtiles to " + file.getAbsolutePath() + ", size: " + file.length());

for scene.yaml i used the following code `scene: background: color: '#222'

sources: stamen-terrain: type: Raster url: 'file:///data/user/0/com.mapzen.tangramandroidmbtilesdemo/files/GulfOfBengal.mbtiles' max_zoom: 5`

i dont know the layer names for the GulfOfBengal.mbtiles

kueda commented 4 years ago

Again, I can't help much more if you won't post your fork so I can see the entirety of the code you're running, so I'm going to close this. IMO, it still seems like you're not defining the layer in scene.yaml. You should be able to get info about the layer names in your mbtiles by opening the mbtiles file in sqlite and looking in the metadata table. Since I think your issue is with your scene file config and not with the code in this repo, per se, you might try asking for help at https://gitter.im/tangrams/tangram-chat

binu8051 commented 4 years ago

The problem is metadata table is empty on the https://kap.grade.de/seamark_mbtiles/indian_ocean.mbtiles Your mbtiles file have bounds, center, format, maxzoom, minzoom, json in the metadata table. Can you help on this.