How to Create a Spatial File for Tableau

Cody Schneider9 min read

Mapping data in Tableau can turn a standard spreadsheet into a compelling visual story, but sometimes its built-in maps don't include the specific locations you need. If you want to analyze performance by sales region, plot store delivery zones, or map out franchise territories, you'll need to provide Tableau with a custom spatial file. This guide will walk you through exactly how to create those files from your own location data.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

We’ll cover two practical methods: a simple, quick approach for plotting specific points and a more advanced one for creating custom shapes and polygons.

What Exactly Is a Spatial File?

In simple terms, a spatial file contains geographical information that goes beyond simple latitude and longitude coordinates. Instead of just marking a single dot on a map, spatial files can define points, lines, or complex shapes called polygons. Think about the difference between pinning a single store location versus drawing the exact boundaries of its neighborhood delivery zone.

Tableau supports several types of spatial files, but the most common formats you'll encounter are:

  • Shapefiles (.shp): An industry-standard format, these actually consist of multiple files (.shp, .shx, .dbf, and others) that must be kept together in the same folder to work correctly. Don't worry, creating a .zip folder makes managing these easy for Tableau.
  • GeoJSON (.json or .geojson): A modern, flexible format based on JavaScript Object Notation that is excellent for web-based applications. It's often easier to work with because all the data is contained in a single text file. We'll use one today to quickly go from a spreadsheet to a spatial file in just seconds.
  • Keyhole Markup Language (.kml): The file format used by Google Earth, making it a great option if you're already plotting locations there.
  • TopoJSON (.json or .topojson): An extension of GeoJSON that's optimized for smaller file sizes.

So, why would you need to create your own? Because your business data is unique. Tableau knows countries, states, and counties, but it doesn’t know your specific "Northeast Sales Quadrant" or "Downtown Delivery Area B." By creating a spatial file, you teach Tableau about your organization-specific geographies.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

First, Prep Your Location Data

Before you create your beautiful maps, you need the right raw ingredients. Your journey begins with a list of locations in a simple spreadsheet. But to be map-ready, the file will need latitude & longitude coordinates - a process called geocoding.

What is Geocoding?

Geocoding is the process of converting human-readable addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into machine-readable geographic coordinates (latitude: 37.422, longitude: -122.084).

There are several ways to geocode your data:

  • Paid API Services: Services like the Google Maps Geocoding API are highly accurate but can be costly for large datasets.
  • Bulk Geocoding Websites: Multiple free online tools allow you to upload a spreadsheet of addresses and they will provide a file of coordinates. They are fantastic for smaller one-off tasks (up to a few hundred line items).
  • Spreadsheet Add-ons: You can find simple plug-ins for Google Sheets and Excel (like "Geocodio" in Google Sheets or an ‘enable mapping tools for Excel’ integration) that will add latitude and longitude columns right inside your spreadsheet for easy and clean formatting.

Your Action Step: Create a Geocoded CSV

To begin you must:

  1. Create a spreadsheet (like Google Sheets or Microsoft Excel) that, at a bare minimum, contains one column per unit of location information (e.g., street address, city, state, and country).
  2. Using any online method, use a 'geocoding' service to convert that address to latitude and longitude coordinates.
  3. Save this prepared file as a Comma-Separated Values file or .csv. This file should have at least three required columns titled 'location names,' 'latitudes,' and 'longitudes.'

Method 1: The Quick Way (Online CSV to GeoJSON Converter)

If your end goal is to just see specific points such as store locations on a Tableau map, this method is perfect for a quick conversion with no new software required. All it entails is using your .csv formatted file of business location data. Since the file is already geocoded, we only need to transform its type from .csv to GeoJSON form with an 'online converter' web app such as "mygeodata converter" - a fast and simple tool that just does this particular job perfectly every time. You can locate it via any browser.

Step-by-Step Instructions

  1. Prepare Your CSV File: Be sure all geographic column headers ('latitude,' for example) have just one-word labels at the header. Double-check and review entries. Check that coordinates have proper minus sign designations (often for US Longitudes).
  2. Use an 'online converter:' Many reliable free options exist for online geographic format converters. A quick web search will give many results for immediate use. Simply locate, upload a file, and click to download the result.
  3. Upload Your CSV & Map The Column Headers: Most websites prompt you to specify which columns include which data. Just assign columns (e.g., ‘Latitude’ is ‘latitude,’ ‘Longitude’ is 'longitude') through simple drag and drop.
  4. Run! Then download the Spatial file: The converter builds the GeoJSON file automatically with a quick progress bar once the correct columns are listed. Simply click "download" to obtain the spatial formatted file to your PC. It's ready to be loaded to Tableau now.

Method 2: Creating Custom Polygons with QGIS

When you must have complex shapes such as sales districts or delivery coverage zones, you need more powerful visualization tools. Advanced graphics software programs allow you to generate precise graphic map boundary information, which can then be pulled directly into Tableau at any time!

We’ll be using a free, open-source program named QGIS (formerly known as 'Quantum GIS'). It may seem intimidating and advanced like Adobe for graphics, but our instructions are minimal to accomplish basic file-building. QGIS holds a vast set of capabilities for advanced data work.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step 1: Install QGIS & Load A Reference Map

First, download QGIS from qgis.org! After the download, you install and open a 'New project' from the prompts at launch to begin work:

  1. From within the 'toolbars' navigation at the top, select: Web -> QuickMapServices -> OSM -> OSM Standard. Your open-source map of the globe appears. Scroll in your main maps area, pan for wherever the polygon should be.

Step 2: Create a Fresh “Shapefile”- Layer Work File.

Think of layers within many modern creation tools, much like Adobe Photoshop designs are organized in grouped layers. Similarly, QGIS has separate ‘data sources’ that are layered and displayed independently on the canvas area. With these, we layer shapes onto the map. It's quick!

  1. Go to: Layer -> Create Layer -> New Shapefile Layers... A settings window for options now appears. Configure each option as follows:
  • Filename: Browse and provide a location and new filename for the new "SHP” that's created.
  • Geometry-type: Select from ‘point,’ ‘line,’ or 'polygons.' We'll choose “Polygon” for territory shaping today.
  • For the 'Name' option at the lower section, "New_Field,” name your business field ID 'Region Name' and keep the ‘Data’ field unchanged. Set data size limit fields (character count max is 50). To list, add your column “reg names," now inside listed Fields. Click on 'OK.'

Now, notice something labeled in the layers box. It doesn’t contain geometric data yet, but awaits what's to be mapped next.

Step 3. Drawing With Polygon Creating Tool

You're now ready to create your actual shape: use a Pencil-toggled shape to initiate ‘Polygon editing’:

  1. Locate the 'Editing' toolbar along the map's side panel. Click over the icon for a green polygon shape to activate "add_polygon features."
  2. Draw Points on the Screen: Click to form 'shape point dots.' Draw the complete border around any entire region. Right-click to finish your shape immediately. Once completed, a small data menu appears prompting for a 'Region name' - label it ("Northeast Sales"). Click done!
  3. Repeat the same process to create many different borders quickly for polygon regions. 'Save' after each one. When done, just close the file.

Step 4: Save & Use These "Shapefile" Formats in Folders

Now, turn 'editing' off within the sidebar menu for the polygons, and you'll be prompted to save changes. Do not skip this! This finalizes saving all your polygon information. QGIS has built numerous related shapefile data types as individual file items. You must keep this set stored as one folder for Tableau imports. Group these by their similar 'file name.' A new zip folder is the best way to hold this data set.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Bringing those Spatial files to Tableau!

Having crafted the files, let's pull them up through Tableau’s dashboard:

  1. Open a new session in Tableau. In the left sidebar, under 'Connect,' select ‘Spatial files.’
  2. Select either the .geojson you converted online or the .shp. file formats containing your created shapes.
  3. The view shows you "geometry" automatically under ‘Sheet’ - drop these from Columns or 'Rows' into any new empty sheet to display mapping results for shapes.

For advanced use, the true value comes from overlaying live business data by linking it with your organization's source data. The 'Region’ you've identified acts as a common reference column. Match it against Sales or Customer transaction histories (using "Region" for matching values), and you'll be able to visualize results. Color codes might designate sales results by shades in the custom areas you created!

Final Thoughts

Creating spatial data offers advanced custom mapping that can illuminate new business trends that table data simply can’t. There are two clear paths for building map visualization from this post. Go simple with a web app converter, but if you require specialized custom fields with boundaries, QGIS is the tool for you. This enhances Tableau reporting beyond simple location pin charts and offers new reporting methods for your skill set.

Although initially complex, building these reports - albeit with some effort - can yield sophisticated outcomes. Our development experience across analytic products informed the creation of Graphed. This tool is designed to automate processes, connecting your sales platform data from Salesforce to other CRM data, like Shopify. It allows users to execute simple queries, like 'show Sales for each Sales Region as Map,' to create custom visuals without manually mapping points in complex tools - thus reducing the learning curve for analytics!

Related Articles