public static void InitializePackageManager(string packageFolder, string importPackagePath, IMapView mapView, string downloadedPackage) { // Offline base layer // Define listener, definition is in same class above var packageManager = new CartoPackageManager("nutiteq.osm", packageFolder); packageManager.PackageManagerListener = new PackageListener(packageManager, downloadedPackage); // Download new package list only if it is older than 24h // Note: this is only needed if pre-made packages are used if (packageManager.ServerPackageListAge > 24 * 60 * 60) { packageManager.StartPackageListDownload(); } // Start manager - mandatory packageManager.Start(); // Import initial package if (packageManager.GetLocalPackage("world0_4") == null) { packageManager.StartPackageImport("world0_4", 1, importPackagePath); } // Now can add vector map as layer // Define styling for vector map BinaryData styleBytes = AssetUtils.LoadAsset("nutibright-v2a.zip"); MBVectorTileDecoder vectorTileDecoder = null; if (styleBytes != null) { // Create style set var vectorTileStyleSet = new CompiledStyleSet(new ZippedAssetPackage(styleBytes)); vectorTileDecoder = new MBVectorTileDecoder(vectorTileStyleSet); } else { Log.Error("Failed to load style data"); } // Create online base layer (no package download needed then). Use vector style from assets (osmbright.zip) // comment in to use online map. Packagemanager stuff is not needed then //VectorTileLayer baseLayer = new NutiteqOnlineVectorTileLayer("osmbright.zip"); var baseLayer = new VectorTileLayer(new PackageManagerTileDataSource(packageManager), vectorTileDecoder); mapView.Layers.Add(baseLayer); }