Re: MBTiles issue

47 views
Skip to first unread message

Jaak Laineste (Nutiteq)

unread,
Jun 4, 2015, 7:48:42 AM6/4/15
to nutit...@googlegroups.com
Hello,

The problem is probably not in the file, but how you use it. Xamarin sample as it is uses MBTiles in special way - not as map layer directly, but as part of VectorTileLayer (PackageManagerTileDataSource), and this way you can use only vector-based MBTiles files. If you look to code, then the file is imported to PackageManager. You have raster-based MBTiles, and you need it to add it to assets, and then in code to Map as a RasterTileLayer:

   string importMBtilesPath = AssetUtils.CalculateResourcePath ("world_countries.mbtiles");
   var mbLayer = new RasterTileLayer (new MBTilesTileDataSource (importMBtilesPath));
   Map.Layers.Add(mbLayer);

This is iOS code, for Android only difference is how you find path for the file. In fact, in Andoid you would need to copy the file to device storage first, it cannot be used directly from assets as there is no random read access to it.

See my screenshot in attachment. It has another issue: sea part is not blue, but transparent. To make it nicer you would need to set map background bitmap. It can be simply totally white:

Map.Options.BackgroundBitmap = null;  

Or use some image, e.g. here is 16x16 bitmap - see second attached screenshot

  UnsignedCharVector backgroundWaterBytes = AssetUtils.LoadBytes("water.png");
  var backgroundWater = new Bitmap (backgroundWaterBytes, true);
  Map.Options.BackgroundBitmap = backgroundWater;

p.s. what do you mean by bordered/bounced .mbtiles ?

Jaak
Nutiteq



Hi Jaak,

I downloaded the NutiteqMaps SDK-3.1.1, and ran the sample in Xamarin. It worked like a charm. But when I replaced the .mbtiles file with another custom .mbtiles file (can be found here: http://www.arcgis.com/home/item.html?id=7b650618563741ca9a5186c1aa69126e), the map didn't show properly. I see a white background instead of the map tiles.

Also a bordered/bounced .mbtiles file didn't work. Do you know any tools besides MapTiler, TileMill and MapBox Studio to create valid .mbtiles that works with NutiteqMaps? I'm trying to generate a .mbtiles file of the city Antwerp (Belgium).

Thanks!

Regards,

Yakup

Dilemas. Menesteres del alma

unread,
Jul 17, 2015, 3:41:33 PM7/17/15
to nutit...@googlegroups.com
Hi.

You could use SASPLANET in order to download good free maps and also get them packed into mbtiles format non problem. There are however some minimal modifications to new database file, i mean new tables need to be created. Just check your functional mbtiles file and replicate tables on your new mbtile file. thats it.

carlos
Reply all
Reply to author
Forward
0 new messages