Skip to content

Conversation

@m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 15, 2022

Adding mbtile support to load offline map tiles. mbtiles loader from https://github.com/OnlyInAmerica/android-gmaps-addons

Adria file from https://wiki.openstreetmap.org/wiki/MBTiles

const Map = require('ti.map');
const win = Titanium.UI.createWindow({});
const mapview = Map.createView({
	mapType: Map.TYPE_NONE,
	minZoomLevel: 10,
	maxZoomLevel: 14,
	region: {
		latitude: 45.18144862950657,
		longitude: 12.980699725449085,
		latitudeDelta: 0.10,
		longitudeDelta: 0.10
	},
});

win.addEventListener("open", function() {
	var mbtiles = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "osm.mbtiles");
	console.log("tileOverlay size before: " + mapview.tileOverlaySize);
	mapview.addMbtileMap({
		file: mbtiles,
		zIndex: 20
	})
	console.log("tileOverlay size after: " + mapview.tileOverlaySize);
})

win.add(mapview)
win.open();

ti.map-android-5.6.0.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant