ericnewton76 / gmaps-api-net

C# google maps api interface for interacting with the backend web services for Google Maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class structure for Nested Steps

TuranDev opened this issue · comments

commented

When in transit mode some responses will contain Steps within Steps s there is a need for DirectionStep to contain an instance of itself.

Ok, sounds reasonable. Can you provide a specific example of a response that returns this situation? Post it here to add to the knowledge of the issue itself

commented

Sure for example doing the query:

https://maps.googleapis.com/maps/api/directions/json?origin=oxford%street+london+UK&destination=bond%street+london+UK&mode=transit&key="REMOVED"

Will return steps that themselves contain steps, looking at the extract below steps contains another array called steps with a slightly different make up:

  "routes" : [
      {
         "bounds" : {
            "northeast" : {
               "lat" : 51.5503181,
               "lng" : 0.006020999999999999
            },
            "southwest" : {
               "lat" : 51.5133197,
               "lng" : -0.1448236
            }
         },
         "copyrights" : "Map data ©2017 Google",
         "legs" : [
            {
               "arrival_time" : {
                  "text" : "02:53",
                  "time_zone" : "Europe/London",
                  "value" : 1489805589
               },
               "departure_time" : {
                  "text" : "02:18",
                  "time_zone" : "Europe/London",
                  "value" : 1489803497
               },
               "distance" : {
                  "text" : "12.8 km",
                  "value" : 12755
               },
               "duration" : {
                  "text" : "35 mins",
                  "value" : 2092
               },
               "end_address" : "Bond St, London E15 1LT, UK",
               "end_location" : {
                  "lat" : 51.5503181,
                  "lng" : 0.0041229
               },
               "start_address" : "Oxford St, London, UK",
               "start_location" : {
                  "lat" : 51.5149226,
                  "lng" : -0.1448236
               },
               "steps" : [
                  {
                     "distance" : {
                        "text" : "0.2 km",
                        "value" : 248
                     },
                     "duration" : {
                        "text" : "4 mins",
                        "value" : 214
                     },
                     "end_location" : {
                        "lat" : 51.515377,
                        "lng" : -0.141338
                     },
                     "html_instructions" : "Walk to Oxford Circus Station",
                     "polyline" : {
                        "points" : "golyHbh[MgBe@yG@E?E?E?GAMCWE{@JAi@wD"
                     },
                     "start_location" : {
                        "lat" : 51.5149226,
                        "lng" : -0.1448236
                     },
                     "steps" : [
                        {
                           "distance" : {
                              "text" : "0.1 km",
                              "value" : 137
                           },
                           "duration" : {
                              "text" : "2 mins",
                              "value" : 109
                           },
                           "end_location" : {
                              "lat" : 51.5151766,
                              "lng" : -0.1428936
                           },
                           "html_instructions" : "Walk \u003cb\u003eeast\u003c/b\u003e on \u003cb\u003eOxford St\u003c/b\u003e/\u003cb\u003eA40\u003c/b\u003e towards \u003cb\u003eHarewood Pl\u003c/b\u003e",
                           "polyline" : {
                              "points" : "golyHbh[MgBe@yG"
                           },
                           "start_location" : {
                              "lat" : 51.5149226,
                              "lng" : -0.1448236
                           },
                           "travel_mode" : "WALKING"
                        },