BookmarkSubscribeRSS Feed

Creating Custom Polygons Using Esri Feature Services in SAS Visual Analytics

Started ‎05-25-2023 by
Modified ‎05-25-2023 by
Views 832

In SAS Visual Analytics, you can quickly create geography data items based on a number of predefined geographies and regions, such as country and region names, state and province names, US state names and abbreviations, and ZIP codes. As long as your CAS table has one of those data items, you can create a geo map. However, there may be times when you need to create a geo map of a region not defined automatically in SAS Visual Analytics. For example, you may need to create geo maps showing custom regions such as sales areas, counties, school districts, or many other possibilities.

 

In many cases, polygons representing the areas you would like to visualize already exist in some other format, whether it is a shapefile, a geodatabase, or an Esri feature service – it's just a question of using them in SAS Visual Analytics. This article will cover creating custom polygons using an Esri feature service.

 

What is an Esri feature service?

Esri feature services are geospatial layers that have been created in ArcGIS software and then published to ArcGIS online or hosted on an organization’s Esri server. Many organizations, such as government agencies and Esri itself, maintain large collections of feature services representing many different possible geographies. These can easily be used to create custom region maps in Visual Analytics.

 

treiman__esri_1-271x300.png

 

Requirements and Steps

To use custom polygons in SAS Visual Analytics, you must create a new geographic data provider. There are a few requirements that must be met to do this. You must have administrative privileges in SAS Viya to be able to define and edit geographic data providers. Specifically, you must have Create, Delete, and Update permission for the /maps/providers URI. For more information, see here. If you’re using an Esri feature layer hosted on your organization's own Esri server, then you will need to specify the credentials for that server in the Esri Custom Services Credentials setting. For more information, see here.

 

Once you have confirmed that you have the necessary permissions and authenticated to your organization’s Esri service (if necessary), then creating a geographic data provider using an Esri feature service involves three steps:

  1. Find and copy the URL of the Esri feature service you want to use in Visual Analytics.
  2.  Create a new geographic data provider, specifying the Esri feature service URL.
  3. Identify the column in the feature service that uniquely identifies each feature in the data being mapped.

I will walk through each of these steps in more detail below.

 

Find and copy the URL

In this example, I'll use a table of housing units per block group from the US Census Bureau (available here) to create a geo region map of the number of housing units per Census Block Group in Wake County, North Carolina. Since Census Block Groups are not one of the built-in geographies in Visual Analytics, I'll need to create a new geographic data provider. The Wake County government has published an Esri feature service of the block group boundaries, which can be found here.

 

treiman_esri_2.png

 

The URL that we need to copy is not the URL of the webpage, but of the feature service itself. This can be found on the bottom right-hand side of the page, underneath the Credits section.

 

treiman_esri_3-2.png

 

Create a new Geographic data provider

Next, I’ll create a new geographic data provider using the Esri feature service. I’ll create a new geographic data item based on the category I want to map (in this case, the Block Group).

 

treiman_esri_4-1.png

 

Then, in the Edit Geography Item window, I'll select Geographic data provider for the Geography data source and click New Provider. I’ll enter a name and select Esri feature service for the Type.

 

treiman_esri_5-1.png

 

In the New Geographic Data Provider window, I’ll enter a name and select Esri feature service for the Type. In the URL field, I’ll paste the URL I copied from the Esri feature service webpage. I’ll also specify the type of geometry: point or polygon. In this example, I’ll choose Polygon.

 

treiman_esri__6_12-1.png

 

Identify the ID column

The geographic data provider doesn’t contain the data being mapped. It just contains information about how to draw polygons on a geo map. I need to tell SAS which polygon in the geographic data provider corresponds with which row in the CAS table being mapped (in this example, the table of housing units in Wake County). I can do this by specifying a common ID column in both the CAS table and the Esri feature service. The ID value needs to uniquely identify each feature (in this case, each Census Block Group), and it needs to be common between both the Esri feature service and the CAS table. For example, Census Block Group 1 needs to have the same ID value in both the Esri feature service and the CAS table.

 

On the Esri feature service webpage, I can examine the attribute table by clicking the Data tab.

 

treiman_esri_7_8-1.png

 

It looks like the GEOID column in the feature service corresponds to the ID column in the CAS table. Note that the names of these columns don’t have to match – just the values. For example, the ID values all begin with 37 for the state of North Carolina, followed by 183 for Wake County, and so on.

 

treiman_esri_9-1-1024x489.png

 

In the New Geographic Data Provider window, I’ll select the ID column from the Esri feature service – GEOID.

 

treiman_esri__10_13-1.png

 

Then in the Edit Geography Item window, I’ll select the ID column I just identified from the CAS table – ID, in this example. Remember, specifying the ID column in both the geographic data provider and the geography data item allows Visual Analytics to associate individual rows in the CAS table to individual polygons from the Esri feature service. In this example, each polygon in the geographic data provider is one Census Block Group, and each row in the CAS table contains information about the number of housing units in a single Census Block Group.

 

treiman_esri__11_10-1.png

 

Results

Finally, I’ll create a geo region map using this new geography data item.

 

treiman_esri_13_11.png

 

Tips

  • You can use a List Table object in Visual Analytics to examine your CAS table and identify the ID column.
  • If your CAS table doesn't have an ID column, you can calculate one. For example, in this example, I could have calculated the ID column by concatenating the State, CountyBlock, and Block Group columns to match the structure of the GEOID from the Esri feature service.
  • You can also use Esri feature services to create coordinate maps. This can be useful if you have a dataset that doesn't contain latitude and longitude, but for which an Esri feature service already exists.
  • Some Esri feature services may have multiple layers. Make sure you pick the right one in the Feature Service Layer field.
  • Visual Analytics can render a maximum of 250,000 vertices. If you have a large number of polygons, consider filtering the map to show a smaller subset of the data and improve performance.
  • Once you've created a geographic data provider, it can be reused in other reports with other CAS tables, as long as the CAS table has an ID column that corresponds with the Esri feature service.

 

Version history
Last update:
‎05-25-2023 01:54 PM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags