none
How to display the deserialized Json data in to our map control in windows phone 8.1 RRS feed

  • Question

  • I am trying to develop an application to show the nearby locations with the help of Google place API. The url used to get the nearby locations is Google place api url. I converted Json to C# and found the below classes

    public class Location
            {
                public double lat { get; set; }
                public double lng { get; set; }
            }
    
            public class Northeast
            {
                public double lat { get; set; }
                public double lng { get; set; }
            }
    
            public class Southwest
            {
                public double lat { get; set; }
                public double lng { get; set; }
            }
    
            public class Viewport
            {
                public Northeast northeast { get; set; }
                public Southwest southwest { get; set; }
            }
    
            public class Geometry
            {
                public Location location { get; set; }
                public Viewport viewport { get; set; }
            }
    
            public class OpeningHours
            {
                public bool open_now { get; set; }
                public List<object> weekday_text { get; set; }
            }
    
            public class Photo
            {
                public int height { get; set; }
                public List<string> html_attributions { get; set; }
                public string photo_reference { get; set; }
                public int width { get; set; }
            }
    
            public class Result
            {
                public Geometry geometry { get; set; }
                public string icon { get; set; }
                public string id { get; set; }
                public string name { get; set; }
                public string place_id { get; set; }
                public string reference { get; set; }
                public string scope { get; set; }
                public List<string> types { get; set; }
                public string vicinity { get; set; }
                public OpeningHours opening_hours { get; set; }
                public List<Photo> photos { get; set; }
                public double? rating { get; set; }
            }
    
            public class RootObject
            {
                public List<object> html_attributions { get; set; }
                public string next_page_token { get; set; }
                public List<Result> results { get; set; }
                public string status { get; set; }
            }

    By the following code I deserialized Json data

    Uri geocodeRequest = new Uri(string.Format("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=17.4271,078.4466&radius=500&types=petrol_bunk&key=AIzaSyCguNRWmAkk_Vctf0bePWiY1rIjM399Loo"));
    
                HttpClient client = new HttpClient();
                
                HttpResponseMessage response = await client.GetAsync(geocodeRequest);
                if(response.IsSuccessStatusCode==true)
                {
                    var data = response.Content.ReadAsStringAsync();
                    var listdata = JsonConvert.DeserializeObject<mapdel.Class1.RootObject>(data.Result);
    The latitude and longitude values are in Geometry class. Now my main goal is to display the list of retrieved locations in my map control with a pushpin. 

    How to achieve this...

    I want to display the values which is present in the Geometry class -> Locations -> latitude and logitude values
    • Edited by Sandeep_1993 Wednesday, October 21, 2015 12:59 PM
    Wednesday, October 21, 2015 12:57 PM

Answers

  • It is against the terms of use of both Bing and Google maps to combine the services.

    http://rbrundritt.wordpress.com

    Wednesday, October 21, 2015 4:17 PM