San Francisco is a city of about 800,000 people in the Northern California region. It is a unique place as it has very intense topography and high population density. Today, I am trying to quantify San Francisco’s spatial data in a visual way.
The datasets that are used are sourced from the APIs of open data websites and specifically the Geography department of the United States Census Bureau and the SF OpenData portal of the City and County of San Francisco. These sources provide access to open data in many formats through direct download by querying their API service.
From the United States Census Bureau I could get files with all the census tract population information and their geometries. From the City and County of San Francisco, I could get the all the building footprints as well as contour lines for the city of San Francisco. This data will be used as a baseline to visually quantify San Francisco’s unique topography and urban design. These visualizations can help urban planners to get a “feel” of the city’s urban landscape and the major commercial and residential zones.
By looking at the map below we can identify San Francisco’s intense topography as described by the contour lines. The closer together the contour the steepest the grade and the warmer the contour line colors the higher the elevation. San Francisco can be characterized as a hilly topography with the major elevations concentrating in the middle of the city and a few hills on the peripheral.
The urban design of the city is presenting itself in the map below. By looking at the map we can identify where the major residential centers are as the population density is higher. On the same map, I plotted the building height (number of floors) to point out the downtown area of San Francisco where the main commercial zone exists with the high rise buildings. We can see a correlation between the population density and the number of floors per building in the residential areas as intuitively more high-rise buildings usually result in higher population density in an urban environment. By comparing the two maps we can also see a correlation between the population density and the elevation profile as most of the people tend to live in the low areas of the city and as the elevation increases the population density tends to decrease.
These maps were created using Carto.
The elevation profile map was generated by connecting the contour data and visualizing it using a choropleth wizard which allows the use of color ramps to promote quantifiable characteristics. In this case, I wanted to promote the elevation grade by using warmer colors for the higher contours and greener colors for the lower ones. The contours are grouped into buckets (histogram) using the Quantile method which puts an equal number of values in each bucket. I then included line labels to show the elevation values.
The urban design map involved spatial analysis in order to be generated. First I calculated the area of each census tract by using the ST_Area() function. By having the area of each census tract I could calculate the population density by dividing the total population with the area and storing it in a separate column. I then plotted the population density of the census tracts using a choropleth with a Quantile distribution. I also included an info window with the population density of each census tract that shows up when you hover over it. The SQL steps are shown below.
SELECT *, ST_Area(the_geom) area FROM census_tract
SELECT *, (dp00100001/ area) AS pop_density_carto FROM census_tract
For the building dataset, I first converted the building footprints (polygons) to points using SQL and the ST_Centroid() function. Then I plotted the buildings using a choropleth with the number of floors as the objective value and using a Quantile distribution. I filtered the data to avoid some few buildings that were set as having a number of floors over 60 as that is not realistic for the San Francisco case. This shows with warmer colors buildings with a large number of floors and more “yellow” colors buildings with fewer floors in order to show the spatial distribution of the high rise buildings. I also included a 'darken' composite operation so that the more high-rise buildings the warmer the color when they overlap and 0.8 transparency so that the census tracts would show up from below.
SELECT ST_Centroid(the_geom) AS building_points FROM buildings