ArcGIS Blog

Developers

ArcGIS REST API

Create Infographics Directly From the REST API

By Daniel Stauning

Infographics help visualize key demographic characteristics for areas of interest with interactive charts, tables, maps, and images. Infographics can help you answer location-based questions using a data driven approach while showcasing your findings with stunning visualizations.

ArcGIS Business Analyst apps such as Pro or Web allow you to run several ready-to-use infographics. This blog focuses on the REST API of the GeoEnrichment Service, where we will walk you through how to choose an infographic, define your area of interest and create one with a request directly to the server.

Infographic
Demographic Summary Infographic

Where can I find a list of available infographics?

To find a list of the standard infographics for a specific country or region, use the infographics discovery method. Here is an example of how to find the infographics for the U.S.

URL Request 

1. Return a list of infographics for the Esri 2021 data based on 2010 Census geographies
https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/Infographics/Standard/US/census?f=json

2. Return a list of infographics for the Esri 2022 data based on 2020 Census geographies
https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/Infographics/Standard/US/census2020?f=json

3. Return a list of infographics for the Esri 2023 data based on 2020 Census geographies
https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/Infographics/Standard/US/esri2023?f=json

The above requests will return a JSON array of infographics and their associated IDs referred to as report IDs. To find the infographics for a different country or region, simply replace US in the URL request with a different 2-digit code. A list of 2-digit codes can be found on the GeoEnrichment coverage page.

Report IDs

The report ID is what we’ll pass to the GeoEnrichment service to specify which infographic to return. Here’s a list of all the standard infographic report IDs for the U.S. gleaned from the URL request above. Click on each link below to see a sample image.

How do I run an infographic directly from the GeoEnrichment REST API?

Now that we’ve discovered the available infographics and have picked one to run, let’s send a request to the GeoEnrichment service using the Create Report operation. This operation downloads an infographic to your device as either a PDF, dynamic HTML or Excel file.

Key parameters

f

The format in which the file information is transferred. The only supported value is bin for binary.

token

The access token used to access service operations. The value can be an API Key or OAuth 2.0 token. For more information on creating API keys, click here.

format

The type of file to be returned. Supported values are pdf or html. Dynamic html output can be embedded in a website and has interactive panels which provide additional information.

report

The ID of the infographic to run.

  • demographic-summary
  • key-facts
studyAreas

An array of input xy or address locations, polygons or administrative boundaries. For point locations, the default area is a 1-mile buffer.

  • [{"geometry":{"x": -122.435, "y": 37.785}}]
  • [{"address":{"text":"380 New York St. Redlands, CA 92373"}}]
  • [{"sourceCountry":"US","layer":"US.ZIP5","ids":["92373"]}]
studyAreasOptions

An array of values to control how input points are buffered. Supported area types include ring buffers and network service areas such as drive times and walk times (routing services must be enabled on the API key for service areas). Multiple buffer radii can be requested. The unit of measurement requested can be miles or kilometers and in the case of service areas, minutes and hours are also supported.

  • {"areaType":"RingBuffer","bufferUnits":"Miles","bufferRadii":[1,3,5]}
  • {'areaType': 'NetworkServiceArea', 'bufferUnits': 'Minutes', 'bufferRadii': [5,10,15],'travel_mode': 'Driving'}

URL Request

https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/createreport?

  • studyAreas=[{'geometry':{'x': -117.1956, 'y': 34.0572}}]
  • format=PDF
  • report=key-facts
  • f=bin
  • token=<ACCESS_TOKEN>

Output PDF

Infographic
Key Facts Infographic

How do I build my own custom infographics and use my own data?

To customize your own infographics, there are well-defined workflows in ArcGIS Business Analyst. The custom data setup and build infographics workflows in the BA web application are designed specifically for this. When you have a custom report template built in Business Analyst, it will exist as an item in your organization’s content. The item ID of the custom report can be passed in the report parameter as shown in the example below.

  • studyAreas=[{'geometry':{'x': -117.1956, 'y': 34.0572}}]
  • format=PDF
  • report={"token":"<ACCESS_TOKEN>","url":"https://www.arcgis.com","itemid":"<itemid>"}
  • f=bin
  • token=<ACCESS_TOKEN>

 

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments