How to Import a Shapefile in CartoDB

The CartoDB platform is designed for maps of all shapes and sizes. While we appreciate linearity, we understand that many visualizations tell stories that don’t follow a straight path. The following tutorial will explain how to introduce complex shapes into your projects with shapefiles.

What are shapefiles and what do they contain?

A shapefile is a common format for transfering geographic data that you see online. Shapefiles are actually collections of three or more associated files that come together to represent vector features, such as points, lines, and polygons, each with descriptive attributes like “name” or “temperature”. When imported into CartoDB, those attributes will comprise your table.

Files extentions necessary for shapefile import:

  • .shp:
    This file contains the primary geographic reference data and records of various shape types included, such as points, polygons, or multipatches.
  • .dbf:
    The dBase format stores attributes for each shape, and its size cannot exceed 2GB.
  • .shx:
    The shapefile index format does what its name suggests, which is to organize the records of a shapefile for reference.
  • .prj:
    The projection format is essential because it contains coordinate system and projection information. As a plain text file, it describes your data using markup language, which allows it to sync with many applications.

How to import

The CartoDB interface requires the compression of shapefiles into a .zip file, all prefixed with the same name. For example, a file would containne_10m_populated_places.shp, ne_10m_populated_places.dbf, ne_10m_populated_places.shx, andne_10m_populated_places.prj.

There are different methods for zipping your shapefiles- some more complicated than others.

To streamline the process, you may consider downloading a plug-in (such as 7-Zip for Windows) that is compatible with your operating system. Otherwise, Mac allows you to Ctrl-click shapefiles inside Finder and select “Compress” [filename]. The .zip archive is created in the same location as the original file and is named [originalfilename].zip. You can also choose File → Compress. Your file is now ready to take shape on CartoDB via drag and drop to the window pictured below:


Regardless of your preferred zip method, you will need to be mindful of selecting the complete components of your shapefile from whichever folder they are stored.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s