Skip to main content
The following content is a read-only preview of an executable Jupyter notebook.To run this notebook interactively:
  1. Go to Wherobots Cloud.
  2. Start a runtime.
  3. Open the notebook.
  4. In the Jupyter Launcher:
    1. Click File > Open Path.
    2. Paste the following path to access this notebook: examples/Analyzing_Data/PMTiles-railroad.ipynb
    3. Click Enter.
PMTiles rendered in Esri This notebook demonstrates how to generate a PMTiles file from the U.S. Census Bureau’s TIGER railroad dataset using Wherobots. This notebook is part of a hands-on project that shows you how to generate and visualize PMTiles. It consists of three parts:
  1. Blog Post – introduces and showcases this capability.
  2. Jupyter Notebook (this file) – step-by-step code for generating the PMTiles file.
  3. Web Visualization Repo – tile server and client code using the Esri JavaScript SDK.
In this notebook, you will:
  • Download and prepare the TIGER railroad shapefile and store it in Wherobots Managed Storage.
  • Filter nationwide data to a specific region, Texas, using Spatial SQL with Sedona.
  • Generate a PMTiles file using the Wherobots vtiles library.
  • Visualize the resulting map tiles directly within the notebook.

Download the railroad dataset from TIGER

This piece of code is a helper function that downloads the zipped folder, extracts it, and uploads it to your Managed Storage (S3 bucket). If the TIGER dataset’s FTP server is down, we have mirrored the data in our public S3 bucket: s3://wherobots-examples/data/pmtiles-blog/tl_2024_us_rails/

Getting WherobotsDB started

This gives you access to WherobotsDB and PMTiles generator

Read in the files that we downloaded

Filter by Texas boundary

Feel free to alter this to some other US state or remove it entirely to get the same experience of the blog. The code to generate PMTiles on the entire dataset:
Click here to learn how to select another state using the wkls library.

FYI about the data

MTFCC stands for MAF/TIGER Feature Class Code and is a code that is assigned by the U.S. Census Bureau to classify and describe geographic objects or features, such as roads, rivers, and railroad tracks. The MTFCC code R1011 means a Railroad Feature (Main, Spur, or Yard). LINEARID is a Linear Feature Identifier, a unique ID number used in U.S. Census Bureau TIGER (Topologically Integrated Geographic Encoding and Referencing) data to associate a street or feature name with its location, such as an edge or address range in the spatial data.

Generating the PMTiles

A single line of code generates the PMTiles file from the processed DataFrame and saves it directly to your S3 bucket.
Alternatively, you can load the PMTiles to Wherobots hosted PMTiles viewer to visualize it.