Creating a racial dot density map using QGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi there we're going to take a look at how to create a density map this is using census data by race so we can map out the racial segregation across the city of new orleans in this case i'm going to start by using the quick map services plugin to bring in a nice base map stamen has a toner light map the next thing we need to do is get the data i'm going to use a website called census reporter which makes it pretty easy to get spatial data out of from the most recent census so i'm going to start by searching for a place search for new orleans some people say new orleans some people say nollens it's just like qgis and qgis all right so there it is and next we're going to search i'm just going to type a topic like race and i'm going to pick the main race table there's all sorts of complexities in the census tables but we're going to go with this one this is all self-reported data so this is however people reported themselves on their census forms so we rather than getting totals for all of new orleans we want to separate it down to this pretty small group let's go down to block groups and now we can see block group 0 block group 1 etc and we're going to download this data we'll just do it as a shape file and i'm going to save this to a new.map folder so the first thing i want to do is unzip this data and so what i'll do is just use 7zip let's extract here and this opens up a folder and one thing i can see is that i have four components of a shapefile but there's also this metadata and that metadata is going to be really handy in just a moment as you'll see so what i'm going to do is just drag the shp over onto my map and if all goes well i see this one side effect of downloading this the way i did from the census reporter is that not only was i downloading the block groups but i was also downloading all of new orleans as a whole i probably should have removed that first but we can easily get around that just by going into edit mode and open up the attribute table and if i just sort by name here's the main one for new orleans so i'm just going to select that and delete it and save my edits all right so now i have this great data and you'll notice that each column just has this rather long string of unique identifiers which we need to look up so that's where this metadata.json file i'm going to open up in vim you could also open up with notepad or something like that it looks like this is just text and what we can see is that this first column name right here means total this next one ends with the two is white alone the next one that ends with three is black etc etc so the first thing i want to do to make this data a little more usable is to convert those column names now you cannot edit the column names directly but there is a tool in the processing toolbar or processing toolbox called refactor fields and i'm just going to open that up and here i have a list of all these things so here's the one that was the total i'm just going to change the name of that to total i'm going to change the name of this one to white change this one to black what was the fourth one the fourth one is american indian native alaska native and i'm just going to keep these short because it is a shape file and this one was asian i believe and i'm just going to stop there and what i'll do is actually we'll just remove these other fields just so i'm not cluttering up my table you keep or delete whichever ones you want you can remove those i'm also just going to for now get rid of these margins of error which are important if you're doing an analysis but for our purposes i'm just going to take the numbers as provided otherwise everything looks good the g idea is a text string i'm not doing any joining but that's usually the way you want that anyway enough of that i'm going to click on run and i'm just saving this to a temporary layer which is perfectly fine for now and i can save the results later all right so that ran pretty quickly i'll close that up and when i look at my refactored table i now have these human readable column names so that's going to make it a lot easier to choose which column i'm displaying on the map so the next thing i'm going to do is open up the styling dock or the styling panel it's this colorful paint brush and i usually like to expand this out so i can see it a little bit better and right now it's using the single symbol this purple polygon color i'm going to change this actually i'm going to leave it at that so simple fill is one thing i'm going to use something in here called random marker fill so what this does is it takes each polygon and it puts in some random markers now at this point i cannot see the boundaries of these polygons so what i'm going to do is i'm going to add a new display called simple fill i'm going to put this one on the bottom if i can i'll drag this one up oh i have to use the arrows there we go and now i'm going to make the fill style no brush and i have these black lines and maybe i can make those nice and thick so what it's doing here if i go back to random marker fill is it's adding 10 random points within each polygon so one two three four five six seven eight nine maybe i miscounted but somewhere around 10 it should be 10. rather than having the same number in each of these polygons i'm going to use this tool that's called data defined override so we can decide how many points to put in based on some data that's in our table so if i just want to show the population density of each of these i can open up the expression editor here and choose let's just choose the total number and here's this expression i get a preview for the first block i could just make sure those numbers seem reasonable and now we can see well you can see that some of these are lower density obviously a lower number in the park here taking the full number might not be what we want maybe what we do is do a dot for every 10 people so i'm going to edit that and say let's divide that by 10. so now i can see there's a lot of people crowded into these areas and less than some of these regions so to edit that again i went into i just regularly clicked that and said edit and i could i could change that to whatever i need i'm going to actually instead of doing the total number let's do the number of white residents so we saw a lot of points disappear from this area now this says point count 10 here but whenever you see this highlighted in yellow that means that it's actually being overridden by some data there's also the seed which we'll talk about in just a moment one thing i would like to do with this let's use blue for the white population and sometimes the borders on the dots can be distracting so i'm going to just copy that blue color just drag it down and it's also the stroke color so the next thing i'm going to do is i want to copy this and now apply the same thing made with different color for black and african american population so what i'm going to do is select my retina marker fill and there's a button here that will duplicate that layer and this one i'm going to modify so i need to go into this expression and this is why i gave them human-readable names they're easy to remember so we did white and now we're going to do black and let's pick a different color so instead of blue let's pick maybe a kind of medium green and i'm also going to copy that over to the stroke color and there we have that one thing you may notice is that these areas there's almost no blue dots and the reason is because we are using the same random number seed for both of these so all the green dots are starting in the exact same place as all the blue dots did so we want to change this it doesn't you could just change it by one digit and that's enough and here we see more of a more of a mix in these areas it doesn't really matter what the seeds are just pick different numbers for each for each layer and let's do that again one more time let's do let's do the asian population so i'm going to go to my expression for the data different override and instead of black to asian let's have red green and blue very distinctly different colors so here i can see um there's actually this area in uh the northeastern which i think is a large vietnamese population so one thing you'll notice is that when i zoom in and out zooming in you know these dots are fairly readable you can see the mix of the colors if i go in too far then suddenly they're so spread out it's get hard to get a better sense of the density and also as i zoom out the dots are clobbering each other and you can't see all the dots underneath there there's probably different ways of dealing with this but one thing i found is really useful especially if you want an interactive map where you're zooming in and out and you want the point size to not be an issue is we instead of having each point be two millimeters is how i have it set here we can change this to be relative to the map let's say meters at scale and let's make them six meters wide so i've only done this with a red point so far and i think there were some over here so here are some so as i zoom in that's six meters across whereas the other points are resizing let me go to simple marker here and change the size of this one make it six meters and this last one make it six meters now those are too small um actually at this scale of six meters per dot per person that's much more space than a human would take up and we're squeezing 10 people per dot so let's actually change that i'm going to go to random market field and change our formula for each of these so instead of dividing it by 10 i'm just going to use the raw number and change the formula and this last one so now i'm doing one dot per person for each of these categories which has the effect of when you're zoomed out you can and let me get rid of those really thick lines that's a little too thick let's say 0.5 so now we can still see those borders we could also just take that away entirely if we wanted to and say no pen and then you can just see the space map and the reason i picked this particular base map the stamen toner light is that it's it's gray scale it's fairly muted and you see some of the main roads but but not much else so here i can see a little bit of the red of the asian population and also over here so zoomed out it looks you can really see the segregation these are kind of white areas these are kind of black and african-american areas and this is sort of a mix of all three as well so you could add other colors for the other categories these were the largest population numbers so i thought that would be useful to show those it does get more difficult to add in more more dots of other types because you start running out of colors to use that don't interfere with the others so that is a quick introduction to how to make a density map there used to be a plugin for qgis it still exists called dot map which would actually create a layer of points for you but you don't need to because there is this random marker fill which just does it on the fly and i think there may be some issues when we zoom in i noticed that the density of this gets greater so i think something strange is happening with the clipping of these polygons of the the block groups but it does seem to work well when you're zoomed out so do be aware of that there might be some issues with with polygons that are on the edge but if you're zoomed to the level where you can see your full full map maybe that's good and i nearly forgot the other very important thing here would be to save our data as remember we refactored it and there's this icon looks like computer chip almost looks like a little insect that means it's a temporary layer temporary scratch layer so what i'm going to do is right click that and say make permanent and there i have a dialogue to specify where i want to save this i'm going to save it as a geo package a nice modern data format and i will just call this new orleans races and just click ok so that's now saved in there and then of course i probably want to also save my project which has the map styles there we go
Info
Channel: cornell-gis
Views: 8,124
Rating: undefined out of 5
Keywords:
Id: TOY_7xKtTcU
Channel Id: undefined
Length: 13min 26sec (806 seconds)
Published: Mon Sep 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.