This interactive map was created for a Grid Chicago article to show the cities and Amtrak routes mentioned. Click and drag it around or hover your mouse on the red train station markers.
Want to create a map like that and publish it on your own website? It’s easy. I’ll show you [...]
This interactive map was created for a Grid Chicago article to show the cities and Amtrak routes mentioned. Click and drag it around or hover your mouse on the red train station markers.
Want to create a map like that and publish it on your own website? It’s easy. I’ll show you how to do it in less than 30 minutes. First, download the following files:
- TileMill application (for Mac, Windows, and Linux)
- Railroads in the United States (.zip) (which includes Amtrak routes in a separate shapefile) ~40MB
- Amtrak stations (.zip) (includes an Amtrak Cascades station in Vancouver, BC)
- State boundaries (.zip) ~40MB
- Illinois places (.zip) (these are municipalities)
All shapefiles are from the United States Department of Transportation, Bureau of Transportation Statistics’s National Transportation Atlas 2012 edition except for Illinois places, which comes from the Census Bureau’s TIGER project.
At the end of this tutorial, you’ll have a good introduction on how to find geographic data, build a map with TileMill, style the map, and publish it for the public. Your map will not look like mine as this tutorial doesn’t describe how to add labels or use the hover/info feature.
Tutorial to make Amtrak Illinois map
- Unzip the four ZIP files you downloaded and move their contents into a folder, like /Documents/GIS/Amtrak Illinois/shapefiles. This is your project folder.
- Install TileMill and open it.
- Set up a project. In the Projects pane, click “New Project”. In the filename field, title it “amtrak_illinois”. Ensure that the checkbox next to “Default data” is checked – this shows a world map and helps you get your bearings (but it’s not absolutely necessary).
- Get familiar with TileMill’s layout. Your new project will open with the map on the left side and your Carto style code on the right side. There are four buttons aligning the left edge of your map. From top to bottom they are: Templates, Font list, Carto guide, and Layers.
- Add a layer. We’re going to add the four shapefile layers you downloaded. Click the “Layers” button and then click “Add layer”. In the ID field, type in “amtrak_routes”. For Datasource, browse to your project folder and find “amtrak.shp” – this file has the Amtrak route lines. Then click “Done”. Click “Save & Style”.
- Style that layer. When you click “Save & Style” after adding a layer, your attention will be called to the Carto style code on the right side of TileMill. A section of code with the “amtrak_routes” #selector will have been inserted with some default colors and styles. If you know CSS, you will be familiar with how to change the Amtrak routes line styles. Change the “line-color” to “#000″. After “line-color”, add a new line and insert “line-opacity: 0.5;”. This will add some transparency to the line. Press the “Save” button above the code.
- Add remaining layers. Repeat Step 5 and add 3 more layers: “amtrk_sta.shp” (ID field: “amtrak_stations”), “state.shp” (ID field: “states”), and “tl_2012_17_place.shp” (ID field: “illinois_cities”).
- Hide bus stations. The Amtrak stations layer shows bus and ferry stations as part of Amtrak’s Thruway connections. You probably don’t want to show these. In your Carto style code, rename the #selector from “#amtrak_stations” to “#amtrak_stations[STNTYPE='RAIL']“. That makes the following style code only apply to stations with the “rail” type. Since there’s no style definition for things that aren’t of that type, they won’t appear.
Screenshot of my map.
Prepare your map for uploading
TileMill has many exporting options. You can save it as MBTiles and publish the map for free using MapBox (TileMill’s parent), or you can export it as image files (but it won’t be interactive), or you can display the map using the Leaflet JavaScript map library (which I use for the Chicago Bike Map app). This tutorial will explain how to export MBTiles and upload to MapBox, the server I’m using to display the map at the top of this page.
- Change project settings. To upload to MapBox, you’ll have to export your project as MBTiles, a proprietary format. Click the “Export” button above your Carto style code and click “MBTiles”. You’ll be asked to provide a name, description, attribution, and version. Input appropriate text for all but version.
- Adjust the zoom levels. Adjust the number of zoom levels you want (the more you have the longer it takes to export and upload your project, and you might exceed MapBox’s free 50 MB account limit). My map has zoom levels 8-11.
- Adjust the bounds. You’ll then want to draw your bounds: how much of the map’s geographic extents you want to export. Zoom to a level where you can see the entire state of Illinois in your map. Hold down the Shift key and drag a box around the state, plus a buffer (so viewers don’t fall of your map when they pan to the edges).
- Export your map. Click Export and watch the progress! On a four-year-old MacBook it took less than one minute to export the project.
- Bring the export to your project folder. When export finishes, click the “Save” button and browse to your project folder. Click the file browser’s save button.
- Upload to MapBox. Login to MapBox’s website and click “Upload Layer”. Browse to your project folder, select the .mbtiles folder, and click “Upload file”. Upon a successful upload, your map will display.
- Embed it in your website. Click the “Share” button in the upper left corner of your map and copy the embed code. Paste this into the HTML source code of a webpage (or in a WordPress post) and save that (I’m not going to provide instructions on how to do that).
Now you know how to find geographic data, build a custom map using the TileMill application, begin to understand how to style it, and embed your map for the public on a website or blog.
N.B. I was originally going to use QGIS to build a map and then publish a static image before I realized that TileMill + MapBox (the website) can build a map but publish an interactive feature instead of a static image. I’m happy I went that route. However, I did use QGIS to verify the data and even create a new shapefile of just a few of the key train stations on the Lincoln Service (the centerpiece of my Grid Chicago article).
It is now possible to upload a shapefile (and its companion files SHX, PRJ, and DBF) to Google Fusion Tables (GFT).
Before we go any further, keep in mind that the application that does this will only process 100,000 rows. Additionally, GFT only gives each user 200 MB of storage (and they don’t tell you [...]
It is now possible to upload a shapefile (and its companion files SHX, PRJ, and DBF) to Google Fusion Tables (GFT).
Before we go any further, keep in mind that the application that does this will only process 100,000 rows. Additionally, GFT only gives each user 200 MB of storage (and they don’t tell you your current status, that I can see).
- Login to your Google account (at Gmail, or at GFT).
- Prepare your data. Ensure it has fewer than 100,000 rows.
- ZIP up your dataX.shp, dataX.shx, dataX.prj, and dataX.dbf. Use WinZip for Windows, or for Mac, right-click the selection of files and select “Compress 4 items”.
- Visit the Shape to Fusion website. You will have to authorize the web application to “grant access” to your GFT tables. It needs this access so that after the web application processes your data, it can insert it into GFT.
- If you want a Centroid Geometry column or a Simplified Geometry column added, click “Advanced Options” and check their checkboxes – see notes below for an explanation.
- Choose the file to upload and click Upload.
- Leave the window open until it says it has processed all of the rows. It will report “Processed Y rows and inserted Y rows”. You will be given a link to the GFT the web application created.
Sample Data
If you’re looking to give this a try and see results quickly, try some sample data from the City of Chicago data portal:
- Community Areas – 77 official community areas + 3 “out” areas to make 80 polygons.
- Special Service Areas – akin to business improvement districts, including Wicker Park-Bucktown SSA.
Notes
I had trouble many times while using Shape to Fusion in that after I chose the file to upload and clicked Upload, I had to grant access to the web application again and start over (choose the file and click Upload a second time).
Centroid Geometry – This creates a column with the geographic coordinates of the centroid in a polygon. It lists it in the original projection system. So if your projection is in feet, the value will be in feet. This is a function that can easily be performed in free and open source QGIS, where you can also reproject files to get latitude and longitude values (in WGS84 project, EPSG 4326). The centroid value is surrounded in the field by KML syntax “<Point><coordinates>X,Y</coordinates></Point>”.
Simplified Geometry – A geometry column is automatically created by the web application (or GFT, I’m not sure). This function will create a simpler version of that geometry, with fewer lines and vertices. It also creates columns to list the vertices count for the simple and regular geometry columns.
Let’s say you’re perusing the 309,425 crash reports for automobile crashes in Chicago from 2007 to 2009 and you want to know a few things quickly.
Like how many REAR END crashes there were in January 2007 that had more than 1 injury in the report. With Google Refine, you could do that in about [...]
Let’s say you’re perusing the 309,425 crash reports for automobile crashes in Chicago from 2007 to 2009 and you want to know a few things quickly.
Like how many REAR END crashes there were in January 2007 that had more than 1 injury in the report. With Google Refine, you could do that in about 60 seconds. You just need to know which “facets” to setup.
By the way, there are 90 crash reports meeting those criteria. Look at the screenshot below for how to set that up.
Facets to choose to filter the data
- Get your January facet
- Add your 2007 facet
- Select the collision type of “REAR END” facet
- Choose to include all the reports where injury is greater than 1 (click “include” next to each number higher than 1)
After we do this, we can quickly create a map using another Google tool, Fusion Tables.
Make a map
- Click Export… and select “Comma-separated value.” The file will download. (Make sure your latitude and longitude columns are called latitude and longitude instead of XCOORD and YCOORD or sometimes Fusion Tables will choke on the location and try to geocode your records, which is redundant.)
- Go to Google Fusion Tables and click New Table>Import Table and select your file.
- Give the new table a descriptive title, like “January 2007 rear end crashes with more than 1 injury”
- In the table view, click Visualize>Map.
- BAM!
I completed all the tasks on this page in under 5 minutes and then spent 5 more minutes writing this blog. “The power of Google.”
About Steven Can Plan
I started this blog in 2007 as the writing assignment for an introductory urban planning class at UIC. It's about cities (mainly Chicago), GIS oftentimes, and transportation (mainly bicycling). Learn more about me, Steven Vance. I also write for Streetsblog Chicago.
Steven Can Plan is hosted on Dreamhost.
Chicago Bike Map App

The Chicago Bike Map app is a bike and street map stored entirely in your iOS device – no data connection required. The map is designed to look much like the City of Chicago's official printed and online bike map. The app works on iPhone, iPod touch, and iPad.
- Download from the iTunes Store
- Demo the app online
- On iOS, search for "chicago bike map" in the App Store app
Highly Recommended Bike Products

So far I haven't had a flat with this tire. I've used Continental Gatorskin and Panaracer T-Serv, both of which have had flats (same Chicago streets). The Gatorskin has less tread than both, and wears to a slick surface faster.

Brooks B67 leather sprung saddle
So far my longest trip was 40 miles on this saddle. It molds to your butt like Birkenstock sandals mold to your feet. The springs make the bike ride a little more comfortable and more fun (weird, because you bounce up and down on them). It also looks gorgeous. Comes in 3 colors - I got black.
Advertisement
Books

Making Maps: A Visual Guide to Map Design for GIS by John Krygier PhD, Denis Wood PhD
If you are going to make a map, whether it be hand drawn or digital, you should really give this book a read. Then read it every time you make a map. It will help make sure your maps are laid out sensibly, in a way that others can easily read, and that it doesn't include fluff or unnecessary data.

Sustainable Transportation Planning: Tools for Creating Vibrant, Healthy, and Resilient Communities (Wiley Series in Sustainable Design) by Jeffrey Tumlin
I was sent a review copy. I'm really excited to open it up and start reading because I've been disappointed with textbooks in the past that don't focus on bicycle and pedestrian planning.
Transit & Transportation








