Current Map with Socrata Open Data

TODO: revise to emphasize how the map continuously pulls the most current information directly from the open-data repository; in this case, happens to be filtered point map of hospitals in Texas…. TODO: replace with a better example of frequently-updated “live” data?

Socrata is a database service that is used by government agencies, cities and countries to make open data available to the public. It offers user-friendly ways to view, filter, and export data. In addition, the Socrata platform includes built-in support to create interactive charts and maps, which can be embedded in other websites (including your own).

One advantage of creating data visualizations directly on an open data platform is that the chart or map is linked to the data repository. For example, if the Socrata platform administrator updates the data table, then a Socrata dataviz based on that data will be automatically updated, too. This may be especially useful for “live” data that is continuously updated by agency administrators such as fires, crimes, and property data.

In this section, we will build an interactive point map of hospitals in Texas using General Hospital Information dataset by Medicare, which you can see in Figure 8.47.

Figure 8.47: In this tutorial, we will build a point map of hospitals in Texas using Socrata.

Generally, in order to create a map in Socrata, you need to be a registered user, and the dataset you wish to visualize has to contain a column with location data. This is not just an address column (such as 3500 Gaston Avenue, Dallas, TX), but a geocoded column that contains latitude and longitude values.

Sign Up for Socrata Account

Navigate to click Sign In button in the upper-right corner. Scroll down to Sign Up link. Follow the instructions, including setting up two-step authentication, to create a free account.

Note: You can still practice creating a map in Socrata without being logged in. You won’t be able to save or share it, however.

Once you have an account, log in using your credentials. Navigate to your profile by clicking your username in the upper-right corner and make sure you Accept Terms and Conditions, otherwise you won’t be able to save your draft map.

This username and password are only valid for, not other websites that use Socrata.

Create Your First Socrata Point Map

Navigate to the Hospital General Dataset, and in the menu on the right-hand side choose Visualize > Launch New Visualization, as shown in Figure 8.48. This will open up a Configure Visualization studio where you can create the map.

Go to Visualize > Launch New Visualization.

Figure 8.48: Go to Visualize > Launch New Visualization.

In the top menu, click Map (globe icon between a scatter chart icon and a calendar). You will see an updated layout of the studio, with the map in the middle, and Map Layers and Map Settings items in the side menu on the left.

Socrata was able to determine which column contains geospatial value, and automatically set Geo Column value to Location in the Layer List menu. By default, points are clustered (grouped together), so instead of seeing individual hospital locations, you see bubbles with numbers (such as 12 in Alaska).

Let’s first select only hospitals that are located in the southern state of Texas. To do so, go to Filters > Add filter. The dropdown menu lists all columns (or fields) of the dataset, where we should choose State. In the newly appeared State dropdown, choose TX (for Texas) as shown in Figure 8.49, and scroll down and click Apply. Socrata should zoom in on the map and center on Texas. Close Filters window to free screen space.

Select Texas as the only value for State field.

Figure 8.49: Select Texas as the only value for State field.

Let’s now disaggregate the map so that we can see individual hospitals instead of clusters. Go to Map Settings > Cluster, and bring the Stop Clustering at Zoom Level slider to 1, as shown in Figure 8.50. You will see the map now shows individual points.

To show individual points instead of clusters, set Stop Clustering at Zoom Level to 1.

Figure 8.50: To show individual points instead of clusters, set Stop Clustering at Zoom Level to 1.

In the same accordion menu, change Basemap > Type to Dark to bring the map a fashionable 2020 look. In General, set Title to Texas Hospitals, and hide data table below the map by unchecking the Show data table below visualization box. Under Map Controls, uncheck Show Search Bar and Show Locate Button to get rid of unnecessary elements. Feel free to experiment with other settings as well.

Now, let’s return back to Map Layers menu and choose our Hospitals General Information point layer. You can notice that in Data Selection accordion menu, Resize Points by Value is grayed out. That is because the dataset doesn’t contain columns with continuous variables that can be transformed to point sizes. Instead, we can use Style by Value option to classify categorical points. The dataset contains multiple variables that can be effectively visualized, such as Hospital Type, Emergency Services (a yes/no category), Mortality national comparison and others. Let’s stick with Hospital Type, as is illustrated in Figure 8.51.

Let’s display different types of hospitals in different colors.

Figure 8.51: Let’s display different types of hospitals in different colors.

If you look at the bottom-right corner of the map, you should notice a minimized Legend control. Click on it to see what each color represents.

Change the color palette (in Color menu) from Categorical 1 to Categorical 2, which includes a wider range of unique colors. You can also use Custom… item to set individual colors, as well as change the order of categories in the legend.

To change what is shown in tooltips when you hover or click on points, go to Flyout Details, and set Flyout Title to Facility Name, adding city and phone number as additional flyout values, as is shown in Figure 8.52.

To edit tooltip information, use Flyout Details menu item.

Figure 8.52: To edit tooltip information, use Flyout Details menu item.

At this point you should have a fully-functional interactive map showing all hospitals in Texas, colored according to their type. Before you can share it, you need to save it as a draft, and publish.

Save Draft and Publish

In the lower-right corner, click Save Draft button. Give your map a name, and hit Save. The gray ribbon at the top will tell you it is still a draft, and you can go ahead and Publish… it.

Now you can embed the map on your website as an iframe. To do so, click the Share button in the upper-right side of your map (see Figure 8.53), and copy the generated code from Embed Code text area (Figure 8.54). Learn more in Chapter 10: Embed on the Web.

Click Share button to bring up Share and Embed window.

Figure 8.53: Click Share button to bring up Share and Embed window.

Copy iframe code to embed this map in another website.

Figure 8.54: Copy iframe code to embed this map in another website.

Limitations of Socrata

But there are limitations to creating your chart or map on an open data repository platform. First, if the agency stops using the platform, or changes the structure of the underlying data, your online map (or chart) may stop functioning. Second, you are generally limited to using datasets and geographic boundaries that already exist on that platform.

If these limitations concern you, a simple alternative is to export data from the open repository (which means that any “live” data would become “static”), and import it into your preferred dataviz tool, such as Tableau.

A second, more advanced alternative, is to learn to pull live data from Socrata using an API (Application Programming Interface). That requires coding skills that are beyond the scope of this book. Visit the official documentation to learn more about Socrata API.


In this chapter, we looked at free mapping platforms to create simple point and polygon maps. Google My Maps is a good choice for point maps that can be created in collaboration with others. If the data you are interested in lives on Socrata platform, you might be able to create a point map within the platform itself, and embed it as an iframe in your own website. Tableau is another very powerful tool to build and share polygon and point maps.

In reviewing all these tools, we only scratched the surface and showed simple examples to get you started quickly. All platforms allow layering data to create powerful exploration mapping visualizations.

None of the platforms required special geospatial data, as all were smart enough to perform geocoding and know the boundaries and coordinates of objects given to them. In Chapter 14, we will talk more about geospatial data, how it can be obtained, stored, modified, and shared.