Web Charlie Uses Map box and WebGIS to Visualize Northumberland County Food Supply

Now the Northumberland County residents have a reliable and updated web map to locate food banks.

Discover
alternative

Problem Background

Currently in the municipality of Northumberland County there are no effective web-based applications that users can rely on to find fresh, local food. In March 2020, all thirteen Northumberland County food banks closed except for one location due to COVID-19 restrictions. This led to a disruption to the food distribution supply chain and confusion to food bank users. There was mass confusion about which food bank was still available, and which ones were closed. The confusion from the shutdown affected the vulnerable population and led to people not having access to food. With a current collaborative project partnered with Sustainable Cobourg underway, Web Charlie plans on bringing a new web-based food accessibility tool and solution to Northumberland County residents.

Northumberland County Study Area
Northumberland County has 7 municipalities and it's located in Ontario, Canada

Problem Statement

Our goal is to set out and create a web map with local fresh food locations that is accessible to users on a responsive mobile platform.

  • Ideal: Users can go online in a mobile friendly web map to find fresh foods in the Cobourg area.

  • Reality: There is no web platform available for food availability in the Cobourg area.

  • Consequences: Users continue to lack support in finding food and failure to access food resources.

  • Proposal: Create a food bank web map that is accessible to users on a responsive mobile platform.

Ranney Gorge Suspension Bridge
Northumberland County: Strength Honour and Beauty

Our Journey

Over the span of couple weeks, our team tried different ways to implement the web solution. We came across some problems along the way and tried to find workarounds for our final product. This section will detail what we have tried and what we did to overcome the issue.

Phase One: Mapbox & GeoJSON

From our friend Sustainable Cobourg’s ArcGIS Online Web Map, we were able to find a feature service layer at their ArcGIS REST Services Directory. We looked at using the query function within the query to get a web response that matches what Mapbox can intake. We made sure to use an SQL query “Name IS NOT NULL” to make sure we selected all the food banks. The advantage of this method is being able to get point data as well as the description directly from the ArcGIS Online source, instead of having to make manual changes every time Sustainable Cobourg updates their feature layer.

Problem: The team attempted to use the GeoJSON queried directly from the feature service via the REST endpoint, but it was unsuccessful due to the fact it is not native to Mapbox and required heavy request modification.

The issue was that the web request to the feature service layer was not configured properly and they could not be projected on the Mapbox.

Web Response From Dev Tools
Our expected response was not correct!

From here we extracted the GeoJSON using a query to place into Mapbox map. Markers showed up and our next issue were the pop-up windows. Through Mapbox tutorials and research, we figured out the solution to display the specific attributes that we wanted from the properties section. We needed to configure the code from the tutorial slightly to fit our requirements and needs.

Problem: What we had trouble with was changing the marker symbols so that they cluster properly.


Phase Two: Mapbox

Our goal is to automate the updated Foodbanks layer from ArcGIS Online and have that linked to the Mapbox map, where we won’t need to query for the GeoJSON and paste into Mapbox every time we have a new updated point. We want to be able to paste the REST endpoint URL into Mapbox instead of using GeoJSON. We are still figuring out the correct formatting to achieve this. This leads us to phase three, trying a different platform.

Pop ups in Mapbox
A view of pop ups in Mapbox

Read me

Read me
An alternative way on generating the data in backend. View this readme on GitHub


Phase Three: Leaflet

Progressing with the project we looked for other ways we could improve the usability of our map in a mobile friendly way. We turned to Leaflet to see how they implement feature layer as a URL. From this tutorial, we were able to achieve pasting the REST endpoint URL and adding it to the map. From there, we added the pop-up windows and the properties that we wanted to display just to try.

Web Response From Dev Tools
Leaflet view with data straight from the feature service URL


Next Steps

Leaflet is an open-source JavaScript library and can be enhanced with different web applications such as Mapbox, OpenStreetMap, and Esri suite. It is a native environment that adapts with Esri products seamlessly. Our next steps include adding more customized map elements so that it has even better aesthetic appeal for a wide audience.

Our Mapbox Solution

alternative

The Interactive Web Map

At the height of Covid-19 pandemic around March 2020, the Northumberland County witnessed the consequences of food deserts in their municipality on their citizens. The lack of access to fresh food for food insecure persons led to Sustainable Cobourg’s call to action – to create an interactive web friendly map for users and organizations to set up optimal locations for pop-up food distribution sites.

  • Food Banks Regularly updated data for Food Bank location and information to increase food availability.
  • Responsive Design This website is responsive! You can resize the screen and view this solution on your mobile phone! To view it in full screen, click the blue button below.

  • Web Tier Mapbox
  • Middle Tier Mapbox Studio
  • Data Tier GeoJSON embedded on website
Launch Mapbox in Full Screen

Our Esri Leaflet Solution

The Alternative Web Map

The primary Mapbox solution requires manual updating. The team thought it would be interesting to provide an alternative solution using Esri leaflet. This solution leverages the feature service directly from Sustainable Cobourg’s ArcGIS Online account. If the feature service layer is updated here, then the icons would automatically update.

  • Farmer's Market In this solution, you can view the farmer’s market layer as well as the foodbanks!

  • Web Tier Esri Leaflet
  • Middle Tier ArcGIS Rest Services Directory
  • Data Tier Sustainable Cobourg ArcGIS Server
Launch Leaflet in Full Screen

Methodology

Using the published web map from our Sustainable Cobourg’s ArcGIS Online account, we exported the food banks layer as a GeoJSON file and downloaded the file into our GitHub folder via VS Code. We stylized the basemap in Mapbox and added markers for each point along with popup windows for the properties of each point. Below will be a brief highlight of the steps that we took to come to our solution.


Step 0

Our initial step in creating the solution was to come up with a visually appealing basemap using Mapbox Studio. The team went with a blue monochrome color because it was simple and did not have distracting stylings. It was the easiest template to start working with.

Monochrome Colors
Blue is looking good!


Mapbox Studio
Decisions had to be made to make sure no icons or cartographic features were sticking out of the ordinary.


Mapbox Style
Lastly, we published the style in Mapbox studio and then we were ready to use the basemap!

Step 1

From Sustainable Cobourg's ArcGIS Online account, we found the Project Cobourg Web Map. From there we went into the layers to retrieve the Food_Banks (0) Feature Server REST endpoint. This was followed by creating a Query for GeoJSON of the ArcGIS Online Food_Banks (0) FeatureServer. Once we received the GeoJSON return, we saved the output as a GeoJSON file and placed into our repository on GitHub via VS Code.

RESTendpoint Query

GeoJSON example

Step 2

Once the GeoJSON file was extracted and placed into our repository, we moved onto installing Mapbox to add to our web page. Here are the steps to "Install Mapbox GL JS: Add Mapbox to your app or website".

  • Choose Platform: iOs, Android, JS Web or Unity and Copy the access token.
  • Pick Method: HTML or Module Bundler
  • Install: Include the GL JS JavaScript and CSS files in the head section of your HTML file.
  • Create a map: Add the map to your site with access Token, and place map in script section.
RESTendpoint Query

Step 3

Add "mapboxgl.accessToken" that was copied from Step 2 along with a variable for the map window. Here you can style the basemap and paste into link and set the zoom level as well as the center coordinates of your study area. We selected zoom 9 and centered it in Northumberland County. The blue monochromatic basemap was a custom style created by in Mapbox studio. Next, add GeoJSON that was queried from Step 1 into HTML web page under function "map.AddSource".

Add GeoJSON to HTML code

Step 4

Next, add Markers & Title Description for each point on the map. We customize the font size, family, offset from the default styling.

Add GeoJSON to HTML code

Step 5

Finally, add pop-up windows to points using attributes from properties section.

Add GeoJSON to HTML code

Step 6

Find workflow to automate updates. We found that integrating Mapbox Styling with Leaflet URL input would be our best option moving forward.

Leaflet map code

Meet The Team

Team Web Charlie has 12 years of combined GIS experience. Trained in the Fleming College GIS Specialist program, each member provides valuable experiences and input to the web solution. To find out more, check out their profiles below!

Responsive image

Christopher Webb

GIS Applications Specialist

Graduated from Trent University in 2019 with Honours in Biology and Environmental Resource Science. Turned to GIS because, what else is there to do in an Ontario Lockdown?

Enjoys Pina Coladas and getting caught in the rain.

Responsive image

Kezia Yu

GIS Cartographic Specialist

Graduated from the University of Toronto in 2018 with an Honours Bachelor of Arts. Majored in Human Geography and minored in GIS and Environmental Geography.

Enjoys long walks on the beach.

Responsive image

Jim Wei

GIS Applications Specialist

Avid GIS mapper and scripter that finds interest in programming and automating tasks. Jim has a background in environmental consulting and a Geoscience degree from University of Toronto.

When he is not working, he is curating and refining his dad humor.

Based on a 2020 COVID-19 Response report by Northumberland County Food 4 All, the first 20 weeks of action (March 13 - July 31, 2020) saw:

1

Meals Prepared

1

Foodbanks

1

Individuals Served

1

Food Deliveries Made

1

Pounds of Product Distributed

Food 4 All provides Food support to many of the local food banks, not-for-profits and school nutrition programs.

To find out about more information about Feed the Change 2020 click the link below.

Food 4 All

Contact details

Don't hesitate to send your questions to us through the contact form.

alternative