Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to add json layer in a button click in xamarin forms?

$
0
0

I am new in xamarin forms I want to add a json layer in a button click in my map.How can I do this.I am tried with a dependency for adding json layer.I using using Xamarin.Forms.GoogleMaps for creating map.

Please help me...

Here is my code

private void Close_Tapped(object sender, EventArgs e)
  {
    try
    {
        var _IIGeoJsonLayer = DependencyService.Get<IGeoJsonLayer>();
        _IIGeoJsonLayer.AddLayerJson();
    }
    catch (Exception ex)
    {

    }
  }

Here is my Dependency Service

 public void AddLayerJson()
   {
    GoogleMap gmap =null;
    GeoJsonLayer layer = new GeoJsonLayer(gmap, Resource.Raw.jsonFile, Android.App.Application.Context);
    layer.AddLayerToMap();
  }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>