Esempio n. 1
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            // Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            // read json from assets and add to map
            var json = System.IO.File.ReadAllText(AssetUtils.CalculateResourcePath("capitals_3857.geojson"));

            MapSetup.AddJsonLayer(MapView, json);
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set online base layer
            var styleAsset = AssetUtils.LoadAsset("nutibright-v2a.zip");
            var baseLayer  = new CartoOnlineVectorTileLayer("nutiteq.osm", new ZippedAssetPackage(styleAsset));

            MapView.Layers.Add(baseLayer);

            // read json from assets and add to map
            string json;

            using (System.IO.StreamReader sr = new System.IO.StreamReader(Assets.Open("capitals_3857.geojson")))
            {
                json = sr.ReadToEnd();
            }

            MapSetup.AddJsonLayer(MapView, json);
        }