Importing Vector Data
Last updated
Last updated
Importing vector and raster data is simple to do, but there are complications that can make things difficult to understand, so it's important to go through this section step-by-step.
We'll be using the BlenderGIS add-on for this section, so make sure it's installed and enabled.
The first step in setting up a scene for GIS data in Blender is to set a CRS.
There are two main ways to set a scene CRS. One way is to set it before the initial import, and have the initial import (and all those after) be transformed to that CRS.
We can do this by going into View -> Geoscene, and setting both the CRS and Geo/Proj rows accordingly:
However, this approach comes with the caveat of having the data slightly offset from the origin, since the origin becomes the mid point of the specified CRS area and not the midpoint of the data we're importing.
For instance, if we set the CRS to EPSG:2263, the origin in Blender (0,0,0) would be somewhere in the middle of New York, even though we're only dealing with data from NYC.
Our data would still be accurately placed, but slightly annoying to work with, since we'd have to move and tweak a few settings to accommodate from the offset. Still, this is a viable option depending on the data, but for the work we're doing, instead of dealing with that, I find it is much easier to just have the initial import be the baseline CRS, and have objects import relative to that.
Note that changing a scene CRS after it has been set and objects have been imported, will not re-align the already imported objects, and only affect the new ones.
For our initial import, we'll make sure to choose a file that has a CRS we'd like all the other files to follow. Click on the GIS drop down on the top menu bar of the 3D viewport.
From here, go to Import -> Shapefile and select the .shp file you want to import. We'll start with the NYC 2020 Census Tracts file, which you can download from here.
Once selected, a menu should pop up showing some options for projecting.
We can leave that first field as is: even though we don't want any elevation, since the shapefile we're using isn't 3D, the geometry z-value will be 0 anyway. We can leave the next two boxes unchecked as well, since those options don't fit the purpose of this import (which is just to be a background map). Next, the CRS is very important.
Since this is our initial import, and we haven't yet specified the scene CRS, this import will set the scene CRS. We can click the "+" to add a new CRS, since by default, the BlenderGIS add-on doesn't come with EPSG:2263. From there, we can query our file's CRS. Note that you can find any .shp file's CRS by looking in its .prj (projection) file with a text editor.
If we click "OK", then select the CRS from the drop down, then press "OK" again and wait a few seconds, we'll see our map in the 3D viewport:
Note that since we have access to the System Console (see introduction page for more details), we can see a "progress bar" for importing the shp:
While this file went too fast for us to make good use of this information, other files will take longer.
We'll now repeat this exact process for the flooding data, with some slight changes to the import menu.
Once we've selected a file, we'll see a different menu pop-up:
Note that a scene georeferencing section is now visible, which matches our shapefile CRS, so we don't need to "Specify shapefile CRS". So, without changing anything, if we press "OK" we should see this in our 3D viewport:
Note how the flooding is nearly perfectly aligned with our background map.
For other .shp files, we'll need to change a few settings. When we import our borough boundaries file, we need to specify that we want to import our data as separate objects, separated by the "boro_name" attribute, which is one of the few attributes within our .shp file. This is so that we can easily separate different boroughs for specific, individual analysis.
Note that the more objects we need to separate, the longer the import will take. Luckily, there are only 5 boroughs in NYC, so this is a very quick import.
Note that the CRS for this file is different from the others, so we'll need to specify that in the "Specify shapefile CRS" dropdown:
Importing the file under these settings should result in this object within the 3D viewport:
We can repeat this same process with the 2009 CHS survey, but we'll swap out the field for "FIRST_BORO", and since the survey has the same CRS as the scene, we don't need to specify it. If you're curious about what all the attributes mean, you can look at the corresponding .xml file for more information, or look at the website for their methodology and descriptions.
The last set of files we need to import are sets of points for each location of each tree. We have one file for all the alive trees and one file for all the dead ones (the original file isn't split - I've linked the split files in the Data Sources page, but you can create them yourself in QGIS). Since the dead ones will take less time (there are fewer dead trees, so fewer points), we'll start with that.
The steps we take to import the points are the exact same as before - the only difference is that the resulting object is going to be a set of vertices instead of a plane.
This looks good, so we can move on to the alive set of trees, which will take a little longer to import. Remember that you can see progress on the Terminal/Console Output page.
Note that you if we were to render this right now, we wouldn't actually be able to see the points - vertices aren't visible in a 3D space. To see them, we'll have to attach objects to each of the points, which we'll go over in the Setting Up SHP and TIF Materials page.
These six shapefiles are all we need on the vector side of things for this animation. Next, we'll import raster data, which will prove to also be fairly simple.