In Tableau Desktop, importing geographic data is sometimes required to create visualizations based on maps. Two common methods are available: using a file CSV containing custom geocodes Or a Shapefile file. Each has its advantages, limitations, and its own import process.
In this article, we'll compare these two approaches, while providing you with detailed tutorials for each.
A geocode CSV file contains tabular data that associates geographic locations (such as city names or regions) with their geographic coordinates (latitude and longitude). This format is lightweight and practical for simple needs.
Use case: Create a map with specific points (for example, corporate branches or points of interest).
A Shapefile is a geospatial format used to represent complex shapes such as regions, borders, or areas of density. It includes several complementary files (.shp, .shx, .dbf) to define both geographic data and its attributes.
Use case: Create complex maps with custom areas or show administrative boundaries.
Your file must contain at least:
This.csv file must be stored in a folder before it can be imported into Tableau.
CSV file example:
Note: You can prepare your data in an excel document that you save in a.csv format.
We can see here that a new geographical role has emerged and allows the cantons to be displayed on the map in the form of a point.
A Shapefile consists of several files, the main ones of which are:
.shp
: Contains geometry..shx
: Spatial index of geographic data..dbf
: Attribute database.Make sure you have all the required files in the same folder.
Note: There are many open source Shapefile files on the Internet via sites such as those of INSEE or Open Data Soft. Unless you have a specific need, I advise you to search for an existing Shapefile file.
To create Shapefiles, you can go to QGIS (https://www.qgis.org/), ArcGIS Online (https://www.arcgis.com/), or Geojson.io (https://geojson.io/).
We now see that the cantons appear through a geometric shape allowing their territories to be observed and no longer as a point.
You can then join with another source file to feed your data.