Food Desert Analysis Using ArcGIS Online and FME

Evie Lapalme
Evie Lapalme
  • Updated

FME Version

Introduction

Have you ever wanted to take your analysis to the next level with ArcGIS Online services and connections within FME? Here’s a use case looking at Food Desert analysis, using Service Area calculation and GeoEnrichment to view demographics. This study could be used for anywhere in North America.
This article will focus on two particular custom transformers and how to use them: the ArcGISOnlineServiceAreaCalculator and the ArcGISOnlineGeoenricher.

 

What is a Food Desert?

A food desert is an urban area in which it is difficult to buy affordable or good-quality fresh food within a given distance or walkable area. These areas are often associated with low-income households and urban areas where a significant number of people live farther than a 5-minute drive or 15-minute walk away from the nearest grocery store.

 

What is ArcGIS Online?

ArcGIS Online is Esri’s cloud-based mapping software that lets you build interactive web maps. ArcGIS Online provides analysis tools, such as the Routing Service, Geocoding, etc., to gain location intelligence. ArcGIS Online enables you to work effectively across your organization by collaboratively building and using maps that you can share within your organization or publicly.

 

ArcGISOnlineServiceAreaCalculator 

The ArcGIS Online Service Area Calculator is a service provided by Esri that calculates the drive time by minutes or distance from a network analysis. This is especially useful for those wanting to know what is within a service area of a facility, or what falls outside of multiple service areas (i.e. what is being underserved). 

 

ArcGISOnlineGeoenricher

The ArcGIS Online GeoEnrichment service is provided by Esri to give demographic information of specific points in your area. Enriching your data is useful for visualizing and analyzing your information in new ways. 

 

Requirements

A Yelp account and Fusion API key. You can create a free Yelp App to obtain the Fusion API key. 
An ArcGIS Online account.

 

Step-by-Step Instructions

1. Open FME Workbench
Open FME Workbench and click New to create a new workspace.

2. Get Grocery Stores from Yelp API
Add a Creator and an HTTPCaller. Set your HTTPCaller parameters as follows:

  • Request URL:
https://api.yelp.com/v3/businesses/search
  • HTTP Method: GET
  • Query String Parameters
    • location: Coquitlam
    • categories: grocery
  • Headers
    • Authorization: Bearer [your token]
  • Save Response Body To: Attribute 

image.png

For more information on using the HTTPCaller and using HTTP Requests, see the HTTP Requests with the HTTPCaller article. 

Connect the HTTPCaller to a JSONFragmenter using the “_response_body” as your JSON Document, then obtain the coordinates of each grocery store by inputting this JSON Query:

json["businesses"][*]["coordinates"]


Additionally, set Reject Features which Produce No Fragments to “No”, Flatten Query Result into Attributes to “Yes”, and Recursively Flatten Objects/Arrays to “Yes”:

image.png

Then expose “latitude, longitude” as the Attributes to Expose: 

image.png

Add a VertexCreator after the JSONFragmenter. Create points from these coordinates by entering the X value as longitude and Y value as latitude. Make sure the mode is set to “Replace with Point”. Then connect a CoordinateSystemSetter to set the coordinate system to LL84.
 
image.png

3. Add an ArcGISOnlineServiceAreaCalculator
Add an ArcGISOnlineServiceAreaCalculator custom transformer (it will be downloaded from the FME Hub) to the canvas and connect it to the CoordinateSystemSetter. Set the Authentication Type to Web Connection and set up your own web connection through the highlighted drop-down.

image.png

If you do need to create a new ArcGISOnline connection, you can create a new connection by selecting Add Web Connection. Next, create a name for your connection and select Authenticate. Enter your ArcGISOnline username and password and select Sign In. 

image.png

For the purpose of this example, we will be using “Generalized” as Polygon Detail Level, “From Facility” as Travel Direction, “Minutes” for Impedance Type, and using “5” as our break value for input parameters. For more information on how to use this custom transformer, see the Using the ArcGISOnlineServiceAreaCalculator article. 

4. Clip the Features
Using a GeometryReplacer and another CoordinateSystemSetter, input these polygon coordinates to the GeometryReplacer’s “Geometry Source”:

      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -122.8927230834961,
              49.29132171993048
            ],
            [
              -122.89306640624999,
              49.25951487595601
            ],
            [
              -122.89100646972655,
              49.22096080566205
            ],
            [
              -122.88002014160156,
              49.223203145468865
            ],
            [
              -122.85324096679688,
              49.22028808387943
            ],
            [
              -122.8103256225586,
              49.22073656608533
            ],
            [
              -122.77393341064452,
              49.22768751984635
            ],
            [
              -122.73719787597655,
              49.24225892596105
            ],
            [
              -122.7117919921875,
              49.266908436728556
            ],
            [
              -122.68638610839842,
              49.28953033025395
            ],
            [
              -122.68741607666016,
              49.31997510237421
            ],
            [
              -122.77084350585938,
              49.33944093715546
            ],
            [
              -122.81444549560547,
              49.33988833710872
            ],
            [
              -122.85392761230469,
              49.33608530785869
            ],
            [
              -122.8769302368164,
              49.31505148809065
            ],
            [
              -122.8927230834961,
              49.29132171993048
            ]
          ]
        ]
      }

Using a Clipper, connect the Output port of the CoordinateSystemSetter to the Candidate port and the Service_Areas output to the Clipper port.

image.png

The parameters for the clipper should be:

  • Multiple Clippers: Yes
  • Clippers Arrive First: No
  • Overlapping Clippers: Clip Original Candidates
  • Candidates on Clipper Boundary: Output as Outside
  • Invalid Parts Handling: Reject Whole Feature

image.png

5. Removing Unwanted Areas
Download and add the parks.ffs file and the roads_buffer.ffs file into the workspace. These will be used to determine if the areas are inhabited. 

First, duplicate the last clipper with the same parameters and have the roads_buffer connected to the “Candidate” input port and connect the outside port of the last clipper to the Clipper input port. Second, again duplicate the last clipper with the same parameters and have the parks file connected to the Clipper input port and connect the inside port of the last clipper to the Candidate input port. 

image.png

Next, we must deaggregate the polygons from the Clipper and gather their center points for the next step. We can accomplish this by adding two Deaggregators to the canvas and connecting one to the Outside output from the final Clipper. Use all defaults. Then connect the second Deaggregator to the first Deaggregator, using all defaults. 

Because there are lots of sliver polygons, we will be testing to get only the larger polygons with the AreaCalculator and the Tester. Add the AreaCalculator to the canvas and connect it to the last Deaggregator, using all defaults. Run the workspace. Then add a Tester to the canvas and filter for an area minimum of your choosing. We chose to go with _area >= 6.789e-7 so that all of the polygons that it will output are larger than that number.

image.png

Then add a CenterPointReplacer to the canvas and connect it to the Tester, again using all defaults. This will gather points for the Geoenricher to use, as it only takes points (not polygons). 

image.png

6. Preparing the ArcGISOnlineGeoenricher
Add the ArcGISOnlineGeoenricher custom transformer (it will be downloaded from the FME Hub) to the canvas and connect it to the CenterPointReplacer output. Select “Web Connection” from the drop down of Authentication Types and select your web connection from earlier. Parameters should include:

  • Enrichment Data Collection: [your choice]
  • Buffer Area Type: Ring Buffer
  • Ring Buffer Area Unit: Kilometers
  • Buffer Size: 2


image.png

For more information on the GeoEnrichment service and the use of the ArcGISOnlineGeoenricher, see the Using the ArcGISOnlineGeoenricher article. 

Run your workspace. Add an AttributeExposer and import your attributes from the Feature Cache. Select any and all that you want to expose. 

image.png
image.png

Add a FeatureJoiner to the canvas and connect the output of the AttributeExposer to the “Right” input and the output from the Deaggregator to the “Left” input. The parameters should remain defaults except join on “_part_number”. 

image.png

7. Add an ArcGIS Online (AGOL) Feature Service Writer
Select the canvas again and start typing ArcGIS, then scroll down and select the ArcGIS Online (AGOL) Feature Service writer. 

First, select an ArcGIS Online connection. Next, select Parameters on the left-hand side. Make sure that your geometry is set to “arcgisonline_polygon” and your User Attribute Definition mode is set to “Automatic”.

8. Create an ArcGIS Online Dashboard
To showcase your data after you run your workspace, you can create a Dashboard on ArcGIS Online

8-0.jpg

 

Additional Resources

 

Data Attribution

The data used here originates from data made available by Yelp Fusion API and Metro Vancouver Open Data Portal. Yelp Fusion is an API App that is available to use without cost under 5,000 requests.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.