Qgis Tutorial Nyit 2024
Qgis Tutorial Nyit 2024
TUTORIALS
2024
Professor:
Adriana Chávez
CLASS 1
2 3
1. DATA SOURCES 2. TYPES OF DATA
Global • Points
• Lines
• Natural Earth Data • Polygons
• USGS Earth Explorer • Tables
• OpenStreetMap • Rasters (color bands)
• Esri Open Data Hub
• NASA’s Socioeconomic Data and Applications Center (SEDAC)
For each shape file you’ll have 5 files. You need to download all
• Open topography
the folder with data, if not it’s not going to work.
• UNEP Environmental Data Explorer
• NASA Earth Observations
• Digital Social Science Center (DSSC) Columbia University Shapefiles
• Geo Data Tufts
• Cornell University Geospatial Information Repository . dbf it’s a table
• UN Environment Programme .cpg are points
• World Health Organization .prj it’s information about the projection
.shx it’s a support file for the shape
USA .shp is our vectorial information (this is the one you will plug into
QGIS)
• US Census
• Data.gov
• Social explorer (On Columbia University network) 3. PROJECTIONS
NYC and NY State “A projection is the means by which you display the coordinate
system and your data on a flat surface, such as a piece of paper or
• NYC Open Data a digital screen. Mathematical calculations are used to convert the
• Bytes of the Big Apple coordinate system used on the curved surface of earth to one for a
• NY GIS Clearinghouse flat surface.” Source: ArcGIS PRO
CITATION
When creating any GIS file you should always cite your sources.
Including the source, date, etc.
C: // QGIS >
00_DATA
4 5
You can explore other projections such as: Robinson, Fuller, Goode Canvas and Legend
Homolosine (land), Goode Homolosine (ocean), Polar UPS North, You can change the background color to black to have a more
Vertical perspective, etc. See more projections in this link. For “autocad” feel.
example: The world from space. Map Tools
Select the units. For example: meters, feet, etc.
C: // QGIS > To select the projection you will click on > Options > CRS:
00_DATA Coordinates > Select your coordinate system. For example: set
01_GIS default > EPSG 3857 - WGS 84 / Pseudo-Mercator
02_EXPORT (To save layers that you create)
Verify the parameters of the selected projection. For example:
Important Units.
When you save your files remember not to add too many
characters in the file’s name and don’t use spaces or special 6. ADD A BASE IMAGE
characters in file names
(use . or _). This will prevent your file from crashing. GIS Data You can add a Google Maps or a Google Satellite image as a
occupies a lot of space, so you can also have an external hard drive background.
to save your information. Always remember to save! You don’t
want to lose your file. Install the HCMGIS Plugin
Go to plugin > Manage and install plugins > Search HCMGIS >
Set up your file Install
Set up language English (American). You can use your language of Once installed go to HCMGIS on the top and add Google Maps,
preference. Google Satellite or Bing Virtua Earth. By now you should be able
to see a map on your screen.
6 7
XYZ Tiles
Another way to do it is to add it manually. Go to XYZ Tiles > New
Connection > Copy-paste the following > Add a layer to the project
and you should be able to see the base map.
Note: For google maps: select zoom level 19 (This zoom level will
allow you to visualize the most amount of data when you zoom in)
The easiest way to add a layer is to open your folder and drag it
into the screen > Grab the .shp file and add it. You can also go to
Layer > Add Layer > Add Vector Layer > Select the layer you want
to add from your data folder. You can select your preferred layer
format that you want to add.
8 9
Try to add some layers. For example: Cities, UTM, rivers, 9. TOOLS
nightlights, shipping, countries, etc.
Zoom in - zoom out. Just like in Autocad or Rhino.
Zoom to layer. You can click right in the layer and will zoom into
your preferred layer.
Pan. Use the hand for panning.
8. LAYER ORDER
10 11
For example, you can do a zoom into the Caribbean and create Select from the attribute table
a bookmark. You can also edit the scale. Let’s say 1:500000 or From the attribute table you can filter information and select
preferred. specific attributes. For example, Select by country > Belize >
You’ll see selected data in yellow. Remember to click on “Deselect
all features from the layer”
12 13
12. LAYER STYLING 13. RASTER IMAGES
Rasters can also be visualized with different colors > Select Min/
Symbolize data
Max value settings > you’ll find different ways to represent this
Simple symbol You can edit the color, line weights and all features
from min-max to mean/standard deviation > Select your preferred
of your polygons, lines, points and rasters. For example, for points
color ramp and edit your map.
you can change the color, select the type of marker or size.
14 15
Define the scale
When exporting it is important to define the scale in which you
want to export your map. To do so click on edit and click on Move
Content. Go to Item properties on the right side and select your
preferred scale. You can adjust with your mouse the view that you
want to visualize.
Add map
Click on add map and move your mouse to add the map to the
page extent. You will visualize what you are seeing on your screen.
The scale, layers, etc. If you want to export only a few layers you
need to go to your screen and visualize what you want to export.
Lock Layers
Click on Item Properties > Lock Layers and Lock styles for layers to
freeze the content of your map. In this way, any changes you make
won’t be seen in your layout.
Add pages
Like in indesign or a PDF you can add more pages to your layout.
Click on layout > Add pages > Select the number of pages that you
need.
16 17
Add Maps Add Scale and North Arrow
On every page you can add a map and lock layers and styling to Below from the add layer, you’ll find a tool for adding a scale bar
preserve your visualizations. Here it is useful to create a bookmark and north arrow. Select your preferred scale and north and edit
to guarantee that you’ll be exporting data on the same frame. It’s them according to your graphic preferences. In the scale you can
also useful if you are exporting data with different scales. select the units that you want to display. In the north you can also
select your preferred arrow style.
18 19
Export as PDF
Similar to exporting an image you can export your maps on a PDF.
It will export all the pages that you have on your layout. See this
link to look at an example. Export > PDF > Export points, lines and
polygons separately. Also, export raster separately. Click in always
export as vectors.
20 21
CLASS 2
22 23
1. START A NEW FILE IN GIS • CSV or spreadsheets: “Many times the GIS data comes in a
table or an Excel spreadsheet. Also, if you have a list of lat/long
coordinates, you can easily import this data in your GIS project.”
• Set up your projection. We will be working with NYC
Source: https://www.qgistutorials.com/en/docs/importing_
Data. Choose: NAD_1983_StatePlane_New_York_Long_
spreadsheets_csv.html
Island+FIPS+3104_Feet
Note: You can find the reference in the metadata file. Always check Add a GDB
in which coordinate the layer was created. Add a layer > Click on Directory > OpenFileGDB > Select the Vector
Database > Add > Create a Group to add all layers.
Beside shapefiles(.shp) and rasters (.tiff), you can also find other
formats such as a GeodataBase (GDB) or CSV or spreadsheets
(excel).
• GDB: “The file geodatabase format has emerged as a
very common format for storing and exchanging spatial data,
particularly considering that it allows for the storage of multiple
data layers, and that it allows for the storage of data layers that
exceed the limits of other specifications. Users of ArcGIS regularly
use file geodatabases when attribute tables exceed the storage
If you have any question watch this tutorial:
capacity of a shapefile attribute table (an individual DBF file is
https://www.youtube.com/watch?v=cfDzukvpOp8
limited to ~2GB in size).”
Source: https://gis.ucla.edu/node/53
24 25
Add a CVS Layer Styling
Data Source Manager > Click on Delimited Text Option > File Go to Layer Styling panel > Select the trees layer > Edit single
format CSV > Find your csv file Go to Geometry Definition > Select symbol > Edit color, stroke, etc.
Point coordinates > Go to Geometry CRS and select the CRS (Use
the one from NYC) > Add layer. Do the same with “nybb” new york borough boundaries > Edit
Voila! You should see the dots in the map. lines > Fill color, etc.
Note: * Don’t drag the CSV, you won’t see anything.* I also suggest creating a Bookmark to freeze the view.
If you have any question watch this tutorial:
https://www.youtube.com/watch?v=eoZUZuivfMk
26 27
VISUALIZING DATA (POLYGONS) 2. NUMERICAL DATA
1. CATEGORICAL DATA Graduated is another way to visualize the attribute’s table data. It
serves to visualize differences in numeric data.
Categorized serves to visualize data broken into categories for
example, male, female, age, etc. This is not numerical data but
categories as its name says. You can visualize the different
attributes of your layer on a color ramp.
Example 1. Select layer NYC Stormwater Flood Map > Layer Styling
> Categorized > Value: Flooding category > Color ramp > Click
on Classify, if not you won;t be able to see the data .You’ll see a
gradient of colors depending on the attribute table’s data. Choose
your preferred gradient or edit the colors and create your own
style.
10 classes 05 classes
Data classification
QGIS has 6 different methods in which you can visualize vector
map data statistically. These methods use different statistical
algorithms to break down the data into separate classes. This
affects the interpretation of the map.
28 29
2. Equal interval: divides the classes into equal groups. This
method will create classes which are at the same size.
30 31
3. Logarithmic scale: “Is a way of displaying numerical data over a
very wide range of values in a compact way—typically the largest
numbers in the data are hundreds or even thousands of times
larger than the smallest numbers.” The method is designed to
optimize the arrangement of a set of values into ‘natural’ classes.
32 33
For visualizing points you can apply two visualization techniques:
Right click on method and you’ll see:
• Color: with a gradient of color
• Size: will categorize the symbols according to their size
Categorized
Categorizing points work very similar to shapefiles. Add layer
Manhattan trees > Click on Categorized > Value NTA Name > Color
ramp > And you’ll see the points in different colors depending on
their neighborhood.
34 35
Heatmap
Visualize a point dataset as a heatmap image. You can visualize the
concentration of points in your map.
Layer styling > Heatmap > Select your preferred color ramp >
Modify the radius according to your layer. You can also adjust
the rendering quality. You can also modify the layer rendering
parameters by selecting blending mode: multiply, overlay, etc. Just
Save a layer with the right projection
like in photoshop.
It’s important to save our laters with the right projection. This will
avoid having future problems performing any process from the
Toolbox. It’s very easy, you only need to right click on your layer >
Export > Save features as > Select the name of the file name and
it’s location > Select the CRS projection you want to > Click OK >
You’ll have a new layer that has already the desired projection.
Select by location
Go to Vector > Research tools > Select by location > Select layer
you want to select from (trees) > Where the features “are within”
> Select layer from > Manhattan > Run > After the selection pops
up go to right click > Export > Save selected features as > and save
your file. You can edit the layers of your selection as you want.
Count points in polygons
Similarly, you can select all trees that are within parks. This can Now we’re going to create a map from two layers “trees” and
give you a ratio of all trees in NYC streets vs trees in parks. NTA’s. We’re going to use the Processing Toolbox > Type “count
A common use for selection is with buffers. For example, if you points” > Select count points in polygon > Select your Polygons
are interested in identifying the areas within 10 minutes walking (NTA layer) > Then select the points (Trees) > Click run (It will take
distance from a hospital. You can create a buffer of 800 meters a while) >
around hospitals. Then select all buildings that intersect/or are
within that buffer.
36 37
Extra tutorial: Georeferencing Census Data
Note: See this link to learn more about the Margin of Error Column.
38 39
Under Fields > Format you should find a short list to modify the Here’s another tutorial on how to do this: https://www.
column attribute. qgistutorials.com/en/docs/performing_table_joins.html
Another work-around is to specify the field types while in Excel,
and then save as an xlsx file. When you import the .xlsx file to This is another one: https://www.youtube.com/
QGIS, your field types will be maintained. This does not work if you watch?v=e6XWIDKWHMM
specify the field types in Excel and then save as CSV.
https://gis.stackexchange.com/questions/298777/qgis-3-2-
forcing-column-type-when-importing-csv
QGIS
Add the layer nyct2020.shp > Open attribute table > Look at the
GEOID file > This is your geolocation.
Now add your .csv file to layers > Locate it right below the file you
want to join it with.
Go to your layer > Right click on properties > Join > Click on + >
Select the file which you want to join > Join fields Geo ID with Geo
ID > ready!
40 41
CLASS 3
42 43
Digital Elevation Models Source: JBA Risk Management
• What is a Digital Elevation Model or DEM? Learn more about DEM resolution in this link
44 45
Here are some data sources to download DEM’s 2. ADD LAYER
NYC: a. Folder NYC_DEM_1ft_Int
• https://gis.ny.gov/elevation/NYS-High-Res-DEM.html b. Add .tif file (Raster)
• https://apps.nationalmap.gov/downloader/ c. Add the NYC Boroughs for reference (Shapefile)
• https://data.cityofnewyork.us/City-Government/1-foot-Digital-
Elevation-Model-DEM-/dpc8-z3jc
Global data:
• https://www.eorc.jaxa.jp/ALOS/en/index_e.htm
Tutorial
46 47
3. RENDER Singlebband pseudocolor (Colors)
a. Continuous
To visualize or renderize a DEM you can do the following options:
Try the different settings and see how the DEM changes.
48 49
c. Quantile Visualization (5 classes: you can use your preferred Preset Shading Parameters (Altitude 30, Azimuth 45, Z Factor 2
number of classes)
Options
You can set the parameters as you prefer. See below.
Band: The raster band to use
Altitude: The elevation angle of the light source (default is 45°)
Azimuth: The azimuth of the light source (default is 315°)
Z Factor: Scaling factor for the values of the raster band (default is
1)
Multidirectional: Specify if multidirectional hill shadinghillshading
is to be used (default is off)
50 51
CONTOURS 4. CLIPPING A RASTER
It will draw contours using the raster’s altitude data.
Sometimes rasters are huge and you’ll need to crop them. For
Options: doing this you will need to:
Input band: raster band to use a. Select polygon to crop from > Go to Select Features (Arrow)
Contour interval: distance between two consecutive lines (10 and select Manhattan and the Bronx. If you click on shift you can
feet, 50 feet, etc) select more than 1 feature.
Contour symbol: the symbol to apply to the common contour lines b. Right click on the layer > Export > Save selected features as >
(You can change symbols and colors here) Remember to:
Index contour interval: the distance between two consecutive • Format (ESRI Shapefile)
index contours, that is the lines shown in a distinctive manner for • File name (select the name of your file and its location)
ease of identification, being commonly printed more heavily than • CRS: (select defined projection)
other contour lines and generally labeled with a value along its c. A new Shapefile was created from your previous selection.
course.
Index contour symbol: the symbol to apply to the index contour
lines (You can change symbols and colors here)
Input downscaling: Indicates by how much the renderer will scale
down the request to the data provider (default is 4.0).
Resampling: cubic
To better visualize the raster either in hillshade or in contours it is
recommended to add specify cubic into the resampling options.
Now that you have exported this layer, we’ll use it to create a clip.
CLIP RASTER
Click on raster > Extraction > There are two options to do this
1. Clip raster by extent: give us a rectangular layout
52 53
Within the parameters you’ll find: Save your temporary file!
Input layer: Select the raster to crop Remember to save your temporary file by right click on your layer
Clipping extent: there are few options to do this: > Export > Save layer as >
Within the parameters you will find:
1. Calculate from layer: you can choose a layer and use it as a
reference for clipping. Format: GeoTIFF (format in which you want to save your file)
2. Calculate from layout map: use a layout as reference. File name: Select the folder and name of your file
3. Calculate from bookmart: use a bookmark as reference. CRS: Very important to select the projection you want to use
4. Use current map canvas extent: Zoom into your window and and
click in the area you want to clip.
5. Draw on map canvas: draw a rectangle from the area you want
to clip.
Advanced parameters
Clipped (extent) Note: You can also look at this tutorial if you have any questions
1. Save as temporary file: I suggest doing this, because it runs about the different ways to clip a raster.
faster, but you need to be sure to save your file later.
2. Select the location and name of the file you want to save. Clip raster by mask layer
After running this you should see a square clipped out of the Second option is to clip the raster by mask layer.
original raster, like the following image: Click on raster > Extraction > Clip Raster by Mask Layer
54 55
Clip with rectangle
Notes:
• The previous step (assign a specified no data value to output
bands) is useful because clips are rectangular and when you have
different shapes, the QGIS could give you an error. Verify your coordinates
• If there’s an error the most common mistake is the coordinate Once your layer is exported it is important to verify the coordinate
system. Always check it out first. system and the units. This is important as you will need a raster
• If there’s an error you can try to click on create an output alpha with the right coordinates and also the right units. Right click on
band. Sometimes it works. your layer > Properties > Information > CRS.
• Your computer could take a while to process, so be patient! If your layer is not in the right CRS or units, you’ll need to
• Once the file was created remember to save your shapefile > reproject your raster. See below if you need to do so.
Click on layer > Export > Save as.
56 57
5. CREATING CONTOURS Contours every 25 m (3D)
Extract contours
To extract contours from the DEM you click on Raster > Extraction
> Contour > Within the parameters you’ll find:
Input layer: select the dem that you want to work with Visualize color ramp in contours
Band number: Band 1 (use default) The new contour file that is created from the DEM will give you a
Interval between contour lines: 10, 20, etc (This is the value layer you can visualize the contour lines by color. This could be a
that you want to use. Note that the units of the DEM are in feet, so nice way to visualize your contour lines or topolines.
you’ll get contours every 10 feet, 20 feet, etc.)
Note: You can visualize this with Graduated Colors (creating
Advanced parameters: Contours > Save to temporary file (Save classes) or just with Categorized. Select ELEV for value in order to
your file name and location) do this.
Contours in 3D
If you want your contours to be 3D, be sure that when you Contours every 5 ft using graduated colors with 5 classes
exported your contours you clicked on Advanced Parameters >
Produce 3D vector
58 59
DUPLICATE LAYER Overlay effect on google earth + previous multiply effects
Note: This one will give some topo texture to your map.
60 61
7. SIMPLE AND MULTIPLE RING BUFFERS 500 meter from subway stations without dissolve
Buffers
“Buffers are a tool used to define areas at specified distances from
an object or set of objects in an environment. In GIS, buffers are
ideal for analyses that involve distance constraints.” Source
62 63
MULTI RING BUFFER Layer to be buffered: select the layer you want
Dissolve features before buffering: click on dissolve if you want
You can create multiple buffers, but before you’ll probably need to to merge the rings
install a plug in. Buffer distance: select the distance (for example 500)
Got to Plugins > Manage and install plugins > Search for multi ring Number of rings: the desired number of rings (for example 3)
buffer > Click on install plug in.
Multi ring buffer from subway stations represented in categories
Remember to save this layer > Export > Save feature as > Save
your file.
See this tutorial for more information.
For more Geoprocessing tools see this link
8. HYDROLOGY
Now you go to Vector > Multi Ring Buffer
A. Fill sink
Before running a hydrological analysis you need to clean up your
DEM, to remove depressions or “sinks” from the DEM. This will
avoid further problems. See image below.
64 65
Click on the Toolbox > Search SAGA > Terrain Analysis > Fill sinks 1. Fillsinks (Wang & Liu) - NY LIDAR 1FT
(wang & liu) Looks like a regular DEM but actually it has already been
You can also just type: Fill sinks wang liu reprocessed
Click on run > This will take a while > See below the results
Once the layers have been processed you’ll see the following 3
images and files:
a. Fillsinks
b. Flow direction
c. Watersheds 3. Flow direction (Wang & Liu) - NY LIDAR 1FT
You can visualize as Singleband pseudocolor it with 7 classes and
also set up MIN: 0 and MAX: 7
Each color represents a direction (North, Northeast, etc).
66 67
Watersheds - Upper NY
68 69
B. Strahler order Strahler order - UPPER NY
After this you’ll run strahler order. You can just type “strahler
order” in the toolbox and you’ll find it.
For this next step You can just type “channel network and drainage
basin ” in the toolbox and you’ll find it.
You can understand this as a vectorized file of the Strahler.
70 71
Flow direction - NY LIDAR 1FT Basin (Polygons) - NY LIDAR 1FT
72 73
Junctions - NY LIDAR 1FT
Points are the intersections of streams Zoom in> Graduated > Size> 11 classes - NY LIDAR 1FT
74 75
Contrast with aerial image - NY LIDAR 1FT Channel - Upper NY
76 77
Basin (Raster) - Upper NY Combined - Upper NY (Basins and channels)
78 79
Combined - Upper NY (Aerial and channels) Flow accumulation - UpperNY
For more information on Channel and Drainage Basins see this tutorial For more information on Hydrological Analysis see this link
80 81
In the parameters you’ll find: Input layer: layer that you want to reproject
Input layer: Select the raster file DEM Source CRS: original projection that your layer have
Band number: Band 1 (Gray) Default Target CRS: the projection you want your layer to have
Aspect: Save file
C. Merge rasters
Visualization singleband pseudocolor
Sometimes your rasters come in separate files so you’ll need to
For visualizing this select Singleband pseudocolor > Equal interval
merge them into one. To do this go to:
> Classes 7
Raster > Miscellaneous > Merge
You’re choosing 7 classes because each of 7 cardinal points.
North(1), Northeast(2), East, Southeast(3), South(4),
Southwest(5), West(6), Northwest (7)
So by visualizing the colors you’ll see the orientation of your slope.
Input layers: Click and select the rasters that you want to merge.
Output data type: Float 32 (This is usually a good parameter to
use)
Merged: Save your file > Run > the result will be your merged
raster
82 83
D. Create a polygon E. Draw circles, rectangles, etc...
To draw circles, rectangles and more you do the same but you will
Draw a polygon (any shape you want) click on the Shape Digitizing Toolbar and draw the shape that you
You can also create or draw a polygon and use that for clipping or want.
use it for your project. To do this you will:
Click in layer > Create layer > New shapefile layer > Within the Go to your layer > Click on edit > And now you can add a new
parameters you’ll find: polygon > and draw your shape file > select a circle or square > Do
you want to save the changes to your layer: YES.
File name: name your file
File encoding: UTF-8 (use the default option) If you don’t see the Shape Digitizing Toolbar just do right click on
Geometry type: Polygon (you can select other features if you want edit and look for it at the menu. You can also turn on the Advanced
to draw a point or other type of geometry) Digitizing Panel to where you can also edit coordinates.
Click ok > A new layer will be created > Click on edit > And now
you can add a new polygon > and draw your shape file > remember
to click again on edit > Do you want to save the changes to your
layer: YES. When you draw you will be manually selecting the
shape of the polygon that you want.
Toggle Add polygon feature
84 85
F. Dissolve Input layers: Select the layers you want to dissolve
When you use dissolve everything is merged by a common field Dissolve fields: Select the fields you want to dissolve. It can be
and it works on a single layer. For example: only one or all of them.
Dissolved: Save layer
You will also dissolve values in the attribute table, which is useful
to simplify large datasets.
See this link to learn more or also this one.
G. Isochrones
You can also calculate isochrones by installing a plugin called
QNEAT3.
Look at this tutorial to learn how to do it.
86 87
10. 3D MODELING Open Grasshopper
Open grasshopper and open the file TJOA_Terrain_Mesh.gh
Export to Rhino/Autocad
Select your layer > Export > Save features as > Autocad DXF > File
name > Save
Note: It is important to know the units of your CRS (feet or
meters).
Rhino
Now you can open your file in Rhino or Autocad.
When you open your file it will ask you for the Model Units: Add
the units in which your DEM and contour lines were exported
(meters, feet, etc)
88 89
3D mesh Photoshop image edit
Export images from qgis as jpegs by creating a layout and
exporting them.
Then open the jpegs in photoshop and trim the clip (in this case
the red square) so that the proportion is the same. For example:
DEM Flow accumulation
3D mesh - Render
90 91
Now you’ll have your images fitted to the proportion of your clip. Select the DEM.jpeg >
For example:
Select the square and match the image proportions to the clip >
Enter
92 93
Max value in QGIS is the height you’ll add in Rhino Exaggerated model > 10X
If needed you can exaggerate your mesh
94 95
96