android - Load Mbtiles using Nutiteq SDK from Mapbox -
i figuring out way load mbtiles mapbox using nutiteq sdk. know how load mbtiles offline using code
// 1. create tile data source mbtiles file mbtilestiledatasource tiledatasource = new mbtilestiledatasource("/sdcard/estonia_ntvt.mbtiles"); // 2. load vector tile styleset unsignedcharvector stylebytes = assetutils.loadbytes("osmbright.zip"); mbvectortilestyleset vectortilestyleset = new mbvectortilestyleset(stylebytes); // 3. create vector tile decoder using styleset vectortiledecoder vectortiledecoder = new mbvectortiledecoder(vectortilestyleset); // 4. create vector tile layer, using created data source , decoder tilelayer vectortilelayer = new vectortilelayer(tiledatasource, vectortiledecoder); // 5. add vector tile layer mapview.getlayers().add(vectortilelayer);
is there way load directly mapbox mbtiles url using nutiteq sdk?
what mean "mapbox mbtiles url", can give example? mbtiles mean offline packages?
i can think of following mapbox urls:
a. mapbox online raster source see https://developer.nutiteq.com/guides/raster-tile-sources
b. mapbox online vector source need define styling, , needs bit more coding:
// load style file assets. nutiteq style quite compatible mapbox streets, // though nt vector tiles bit different unsignedcharvector stylebytes = assetutils.loadbytes("nutibright-v2.zip"); if (stylebytes != null){ // create style set mbvectortilestyleset vectortilestyleset = new mbvectortilestyleset(stylebytes); mbvectortiledecoder vectortiledecoder = new mbvectortiledecoder(vectortilestyleset); // create tile data source , layer vector tiles tiledatasource vectortiledatasource = new httptiledatasource(0, 14, "http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v5/{zoom}/{x}/{y}.vector.pbf?access_token=pk...your-mapbox-key"); vectortilelayer baselayer = new vectortilelayer(vectortiledatasource, vectortiledecoder); // add layer map mapview.getlayers().add(baselayer); }
Comments
Post a Comment