Overview

You will learn: how to calculate five, ten and fifteen minute drivable areas around a location with the ArcGIS Transportation Routing and Network Analytics Services.

The ArcGIS Transportation Routing and Network Analytics Services can find routes, get driving directions, calculate drive times, and solve complicated multiple vehicle routing problems(VRP). If you would like to create an application that can determine the areas that can be reached by driving or walking for a specific time, you can use the ArcGIS REST API and the solveServiceArea operation. All you need to do is pass in the start location (facility) and the time(s), and the service will return the area that can be reached. These areas are referred to as "service areas". Once you have the results you can add the areas to a map or integrate them further into your application. To learn more about the capabilities of the service, please visit the documentation.

In this lab you will use the ArcGIS REST API to access the ArcGIS Transportation Routing and Network Analytics Services to get the drive-time areas around a location in a dense urban environment.

Before you begin

Install Postman to execute HTTP requests. Go to this lab if you need an access token.

Steps

Create a request to access the directions service

  1. Open Postman and click [+] in the tab bar to create a new request.

  2. In the new tab, set the following:

    • HTTP Method: POST
    • Request URL: https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World/solveServiceArea

Add parameters to define the type of drive time to create

  1. Click on Body and add the following Key/Value pairs:

    • f: json
    • token: Go to this lab if you need an access token.
    • outSr: 4326
    • defaultBreaks: 5
    • facilities:
      {
      "features": [
          {
            "geometry":{
              "x":-118.09047,
              "y":33.81091,
              "spatialReference": {
                "wkid": 4326
              }
            },
            "attributes": {
              "Name": "San Gabriel River Trail"
            }
          }
        ]
      }
      

Execute the request to create the drive time polygon

  1. Click Send to run the request.

  2. In the response window, change the view to JSON. It should look something like this:

    {
      "messages": [],
      "saPolygons": {
          "fieldAliases": {
              "ObjectID": "ObjectID",
              "FacilityID": "FacilityID",
              "Name": "Name",
              "FromBreak": "FromBreak",
              "ToBreak": "ToBreak",
              "Shape_Length": "Shape_Length",
              "Shape_Area": "Shape_Area"
          },
          "geometryType": "esriGeometryPolygon",
          "spatialReference": {
              "wkid": 4326,
              "latestWkid": 4326
          },
          "features": [
              {
                  "attributes": {
                      "ObjectID": 1,
                      "FacilityID": 1,
                      "Name": "San Gabriel River Trail : 0 - 5",
                      "FromBreak": 0,
                      "ToBreak": 5,
                      "Shape_Length": 0.26028519748553797,
                      "Shape_Area": 0.00036342816500024795
                  },
                  "geometry": {
                      "rings": [
                          [
                              [
                                  -118.08038902299995,
                                  33.824083328000029
                              ],
                              [
                                  -118.08016395599998,
                                  33.814203262000035
                              ],
                              [
                                  -118.07993888899995,
                                  33.814203262000035
                              ],
                              [
                                  -118.07859229999997,
                                  33.813302994000026
                              ],
                              [
                                  -118.07702064499995,
                                  33.814649582000072
                              ],
                              [
                                  -118.07612228399995,
                                  33.813528061000056
                              ],
                              [
                                  -118.07544898999998,
                                  33.81375312800003
                              ],
                              [
                                  -118.07477378799996,
                                  33.813302994000026
                              ],
                              [
                                  -118.07477378799996,
                                  33.811506271000042
                              ],
                              [
                                  -118.07297706599996,
                                  33.811281204000068
                              ],
                              [
                                  -118.07275390599995,
                                  33.816446304000067
                              ],
                              [
                                  -118.07163047799997,
                                  33.817346573000066
                              ],
                              [
                                  -118.07073211699998,
                                  33.816446304000067
                              ],
                              [
                                  -118.07095718399995,
                                  33.811281204000068
                              ],
                              [
                                  -118.07050704999995,
                                  33.811281204000068
                              ],
                              [
                                  -118.07028198199998,
                                  33.811281204000068
                              ],
                              [
                                  -118.06916046099997,
                                  33.811731339000062
                              ],
                              [
                                  -118.06781196599997,
                                  33.811281204000068
                              ],
                              [
                                  -118.06713867199994,
                                  33.811731339000062
                              ],
                              [
                                  -118.06511688199998,
                                  33.811056137000037
                              ],
                              [
                                  -118.06466865499999,
                                  33.810159683000052
                              ],
                              [
                                  -118.06556701699998,
                                  33.809259415000042
                              ],
                              [
                                  -118.07050704999995,
                                  33.809259415000042
                              ],
                              [
                                  -118.07005882299995,
                                  33.808362961000057
                              ],
                              [
                                  -118.07095718399995,
                                  33.807687759000032
                              ],
                              [
                                  -118.07095718399995,
                                  33.806116104000068
                              ],
                              [
                                  -118.07185554499995,
                                  33.805219650000026
                              ],
                              [
                                  -118.07365226699994,
                                  33.805665970000064
                              ],
                              [
                                  -118.07410049399999,
                                  33.807462692000058
                              ],
                              [
                                  -118.07567214999995,
                                  33.807912827000052
                              ],
                              [
                                  -118.07567214999995,
                                  33.808137894000026
                              ],
                              [
                                  -118.07589721699998,
                                  33.808588028000031
                              ],
                              [
                                  -118.07499885599998,
                                  33.809484482000073
                              ],
                              [
                                  -118.07657051099994,
                                  33.809484482000073
                              ],
                              [
                                  -118.07657051099994,
                                  33.809038162000036
                              ],
                              [
                                  -118.07791900599995,
                                  33.808137894000026
                              ],
                              [
                                  -118.07881736799999,
                                  33.808362961000057
                              ],
                              [
                                  -118.07926559399999,
                                  33.809484482000073
                              ],
                              [
                                  -118.08061408999998,
                                  33.808362961000057
                              ],
                              [
                                  -118.08173561099994,
                                  33.808813095000062
                              ],
                              [
                                  -118.08196067799997,
                                  33.809484482000073
                              ],
                              [
                                  -118.08330917399996,
                                  33.809484482000073
                              ],
                              [
                                  -118.08330917399996,
                                  33.808588028000031
                              ],
                              [
                                  -118.08510589599996,
                                  33.807687759000032
                              ],
                              [
                                  -118.08645248399995,
                                  33.807912827000052
                              ],
                              [
                                  -118.08712577799997,
                                  33.809038162000036
                              ],
                              [
                                  -118.08869743299999,
                                  33.809038162000036
                              ],
                              [
                                  -118.08869743299999,
                                  33.805665970000064
                              ],
                              [
                                  -118.08824920699999,
                                  33.805665970000064
                              ],
                              [
                                  -118.08824920699999,
                                  33.805444717000057
                              ],
                              [
                                  -118.08779907199994,
                                  33.805219650000026
                              ],
                              [
                                  -118.08757591199998,
                                  33.804094315000043
                              ],
                              [
                                  -118.08869743299999,
                                  33.803197861000058
                              ],
                              [
                                  -118.09071922299995,
                                  33.805219650000026
                              ],
                              [
                                  -118.09094428999998,
                                  33.809259415000042
                              ],
                              [
                                  -118.09813117999994,
                                  33.809484482000073
                              ],
                              [
                                  -118.09745597799997,
                                  33.807912827000052
                              ],
                              [
                                  -118.09813117999994,
                                  33.807016373000067
                              ],
                              [
                                  -118.09813117999994,
                                  33.804094315000043
                              ],
                              [
                                  -118.09633445699995,
                                  33.804319382000074
                              ],
                              [
                                  -118.09633445699995,
                                  33.804094315000043
                              ],
                              [
                                  -118.09543609599996,
                                  33.803422928000032
                              ],
                              [
                                  -118.09566116299999,
                                  33.802522659000033
                              ],
                              [
                                  -118.09633445699995,
                                  33.802072525000028
                              ],
                              [
                                  -118.09835433999996,
                                  33.802072525000028
                              ],
                              [
                                  -118.09880447399996,
                                  33.800500870000064
                              ],
                              [
                                  -118.09992790199999,
                                  33.800500870000064
                              ],
                              [
                                  -118.10037612899998,
                                  33.802297592000059
                              ],
                              [
                                  -118.10217285199997,
                                  33.802072525000028
                              ],
                              [
                                  -118.10307121299996,
                                  33.802972794000027
                              ],
                              [
                                  -118.10262298599997,
                                  33.804094315000043
                              ],
                              [
                                  -118.10082626299999,
                                  33.804544449000048
                              ],
                              [
                                  -118.10127448999998,
                                  33.805891037000038
                              ],
                              [
                                  -118.10239791899994,
                                  33.806116104000068
                              ],
                              [
                                  -118.10284614599999,
                                  33.806791306000036
                              ],
                              [
                                  -118.10217285199997,
                                  33.807687759000032
                              ],
                              [
                                  -118.10262298599997,
                                  33.808813095000062
                              ],
                              [
                                  -118.10352134699997,
                                  33.807912827000052
                              ],
                              [
                                  -118.10374450699999,
                                  33.807912827000052
                              ],
                              [
                                  -118.10509300199999,
                                  33.808137894000026
                              ],
                              [
                                  -118.10531616199995,
                                  33.808813095000062
                              ],
                              [
                                  -118.10688972499997,
                                  33.809038162000036
                              ],
                              [
                                  -118.10711288499999,
                                  33.807687759000032
                              ],
                              [
                                  -118.10801124599999,
                                  33.807241440000041
                              ],
                              [
                                  -118.10890960699999,
                                  33.808137894000026
                              ],
                              [
                                  -118.10890960699999,
                                  33.809484482000073
                              ],
                              [
                                  -118.11070632899998,
                                  33.809484482000073
                              ],
                              [
                                  -118.11160469099997,
                                  33.810384750000026
                              ],
                              [
                                  -118.11115646399998,
                                  33.811281204000068
                              ],
                              [
                                  -118.10890960699999,
                                  33.811731339000062
                              ],
                              [
                                  -118.10868644699997,
                                  33.812627792000058
                              ],
                              [
                                  -118.10801124599999,
                                  33.813077927000052
                              ],
                              [
                                  -118.10666465799994,
                                  33.811956406000036
                              ],
                              [
                                  -118.10374450699999,
                                  33.813978195000061
                              ],
                              [
                                  -118.10374450699999,
                                  33.814203262000035
                              ],
                              [
                                  -118.10284614599999,
                                  33.815099716000077
                              ],
                              [
                                  -118.10127448999998,
                                  33.814874649000046
                              ],
                              [
                                  -118.10127448999998,
                                  33.815774918000045
                              ],
                              [
                                  -118.10172462499997,
                                  33.815774918000045
                              ],
                              [
                                  -118.10217285199997,
                                  33.816671371000041
                              ],
                              [
                                  -118.10104942299995,
                                  33.81779670700007
                              ],
                              [
                                  -118.10239791899994,
                                  33.818017960000077
                              ],
                              [
                                  -118.10284614599999,
                                  33.81891822800003
                              ],
                              [
                                  -118.10194778399995,
                                  33.819814682000072
                              ],
                              [
                                  -118.10015106199995,
                                  33.819814682000072
                              ],
                              [
                                  -118.10037612899998,
                                  33.820940018000044
                              ],
                              [
                                  -118.09925270099995,
                                  33.82206153900006
                              ],
                              [
                                  -118.09813117999994,
                                  33.821165085000075
                              ],
                              [
                                  -118.09813117999994,
                                  33.819814682000072
                              ],
                              [
                                  -118.09543609599996,
                                  33.819814682000072
                              ],
                              [
                                  -118.09476280199999,
                                  33.819368362000034
                              ],
                              [
                                  -118.09453773499996,
                                  33.818693161000056
                              ],
                              [
                                  -118.09543609599996,
                                  33.81779670700007
                              ],
                              [
                                  -118.09566116299999,
                                  33.81779670700007
                              ],
                              [
                                  -118.09790611299996,
                                  33.81779670700007
                              ],
                              [
                                  -118.09790611299996,
                                  33.815549850000025
                              ],
                              [
                                  -118.09655761699997,
                                  33.815549850000025
                              ],
                              [
                                  -118.09610938999998,
                                  33.816671371000041
                              ],
                              [
                                  -118.09498596199995,
                                  33.816671371000041
                              ],
                              [
                                  -118.09386444099999,
                                  33.813978195000061
                              ],
                              [
                                  -118.09318923999996,
                                  33.813528061000056
                              ],
                              [
                                  -118.09229087799997,
                                  33.813978195000061
                              ],
                              [
                                  -118.09139251699997,
                                  33.813302994000026
                              ],
                              [
                                  -118.09116935699996,
                                  33.811731339000062
                              ],
                              [
                                  -118.09004592899998,
                                  33.81240654000004
                              ],
                              [
                                  -118.08914756799999,
                                  33.81240654000004
                              ],
                              [
                                  -118.08847427399996,
                                  33.811731339000062
                              ],
                              [
                                  -118.08690261799995,
                                  33.811731339000062
                              ],
                              [
                                  -118.08802413899997,
                                  33.813077927000052
                              ],
                              [
                                  -118.08802413899997,
                                  33.814424515000042
                              ],
                              [
                                  -118.08802413899997,
                                  33.814649582000072
                              ],
                              [
                                  -118.08757591199998,
                                  33.815099716000077
                              ],
                              [
                                  -118.08847427399996,
                                  33.815999985000076
                              ],
                              [
                                  -118.08802413899997,
                                  33.817121506000035
                              ],
                              [
                                  -118.08690261799995,
                                  33.817121506000035
                              ],
                              [
                                  -118.08510589599996,
                                  33.815549850000025
                              ],
                              [
                                  -118.08488082899999,
                                  33.816221237000036
                              ],
                              [
                                  -118.08577918999998,
                                  33.816671371000041
                              ],
                              [
                                  -118.08577918999998,
                                  33.81779670700007
                              ],
                              [
                                  -118.08510589599996,
                                  33.818243027000051
                              ],
                              [
                                  -118.08375740099996,
                                  33.818017960000077
                              ],
                              [
                                  -118.08285903899997,
                                  33.817121506000035
                              ],
                              [
                                  -118.08285903899997,
                                  33.815549850000025
                              ],
                              [
                                  -118.08330917399996,
                                  33.814649582000072
                              ],
                              [
                                  -118.08488082899999,
                                  33.813528061000056
                              ],
                              [
                                  -118.08510589599996,
                                  33.812627792000058
                              ],
                              [
                                  -118.08465576199995,
                                  33.811506271000042
                              ],
                              [
                                  -118.08241081199998,
                                  33.811506271000042
                              ],
                              [
                                  -118.08241081199998,
                                  33.811956406000036
                              ],
                              [
                                  -118.08241081199998,
                                  33.812181473000066
                              ],
                              [
                                  -118.08241081199998,
                                  33.823858261000055
                              ],
                              [
                                  -118.08398246799999,
                                  33.829473495000059
                              ],
                              [
                                  -118.08690261799995,
                                  33.834413528000027
                              ],
                              [
                                  -118.08690261799995,
                                  33.835313797000026
                              ],
                              [
                                  -118.08690261799995,
                                  33.835535049000043
                              ],
                              [
                                  -118.08622741699998,
                                  33.835985184000037
                              ],
                              [
                                  -118.08622741699998,
                                  33.836210251000068
                              ],
                              [
                                  -118.08488082899999,
                                  33.835313797000026
                              ],
                              [
                                  -118.08330917399996,
                                  33.831941605000054
                              ],
                              [
                                  -118.08196067799997,
                                  33.830820084000038
                              ],
                              [
                                  -118.08038902299995,
                                  33.824083328000029
                              ]
                          ]
                      ]
                  }
              }
          ]
      }
    }
    
  3. Go to the top of the response. Find the saPolygons and features property. This represents the service area polygon that was generated.

Add additional drive times to calculate

  1. In the Body, change the defaultBreaks parameter to generate three polygons for five minute, ten minute, and fifteen minute drive times around our location:

    • defaultBreaks: 5,10,15
  2. Click Send to run the request.

  3. Find the saPolygons.features property in the response. Notice that it now contains an array of three polygons.

  1. In Postman click Code below the Send button. Select a programming language and use Postman to generate sample code for your application to run this request.

Congratulations, you're done!

You have determined the areas around the San Gabriel River Trail that can be reached in a five, ten, and fifteen minute drive.

Challenge

Use walking time

You can customize how your area is determined with the travelMode parameter. For example, you can get routes optimized for best walking time or shortest driving distance as opposed to driving time. See the travelMode parameter in the service area documentation or the GetTravelModes API.

Add additional places

You can include as many as 100 input locations to the facilities array when calling the synchronous service. Try using the mergeSimilarPolygonRanges option to combine polygons with similar drive times.