Closed nitrag closed 9 years ago
Hmm, okay so I found out that Mapbox Studio cashes a file. Trying to get that to work. I'm using alloy and currently got it to find the mbtiles file. However screen is blank. Is that because it's this new vector format? Going to play around with it some more...
Online maps works fine.
EDIT: mbtiles cached file (300mb) is not copying to device. Too large?
Ok, @adampax.
So I'm being difficult and trying to test a 300mb file. For some reason it's not copying from the Resources directory to my test device. File too large maybe.
So I enabled UIFileSharingEnabled and copied the file to the ApplicationDataDirectory.
Can you allow the MapView "map" to have an absolute path? Maybe "nativeMap"? And also, if absolute, not have to strip the .mbtiles postfix?
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'colorado.mbtiles');
var filePath = file.nativePath.replace('.mbtiles', '');
if (file.exists()) {
mapview = mapbox.createView({
map: file.nativePath,
I'm not sure how big of file it would support. Might try one of the sample mbtitles files to verify everything is working.
Okay to make mbtiles for offline maps these days with MapBox, you need to use Portable Basemap Server to generate the mbtiles.
http://cageyjames.webfactional.com/?cat=1942
For the URL for the png use:
http://a.tiles.mapbox.com/v3/yourusername.mapid/{z}/{x}/{y}.png?access_token=
Follow the guide for the rest.
I was able to get it to run in the Resources folders if the file size was 30mb. Couldn't get me 250mb+ file to transfer. My original issue was the mbtiles file I was using was also not constructed correctly. This method works great! Just took forever to find on the internets.
Excellent Module!
I got up and running within a few hours! Wow!
I'm getting confused when it comes to saving the mbtiles for offline. I want to use the standard Mapbox Streets vector or a slightly modified one. I'd be happy with either. But I can't find any information on where to download ANYWHERE. I've got a TM2Z file but that doesn't look helpful. And I don't think I need externally hosted tiles.
Help! Thanks