Skip to content

L-201 · GIS 201

GIS 201: Spatial analysis

What happens where, and what is near what?

GIS 101 put things on a map. GIS 201 asks the map questions: how far, how much, what is inside, what overlaps, which address, which class. Each lesson is a lab you can drag, and every answer is computed live.

After GIS 101, or if you already know what a layer and an attribute are.

60°0°-60°globeMercator○ = same circle on the ground
201·01

Projections: peeling an orange flat

BIG IDEAThe Earth is round and a map is flat, so every map stretches something. A projection is the rule for how, and the rule decides what you can trust: shape, area, or distance, never all three.

Try to flatten an orange peel and it tears. A map projection is a recipe for stretching instead of tearing: it says where each latitude and longitude lands on the page. The stretching is not a flaw to hide; it is a choice, and different jobs need different choices.

Mercator keeps angles true, which is why sailors and web maps love it: north is always up and a compass course is a straight line. The price is scale. At latitude φ, a Mercator map stretches everything by sec φ (one over the cosine), in both directions. At the equator that is 1.00; at 60° it is 2.00; at 80° it is 5.76. Areas stretch by the square of that.

The famous victim is Greenland. On the ground Greenland is about 2.17 million km² and Africa about 30.37 million km², so Africa holds 14.0 Greenlands. On a Mercator world map they look nearly the same size. Pick the equal-area projection in the lab and the honest ratio comes back.

Three projections matter most in American engineering work. Web Mercator (WKID 3857, formerly 102100) is what every basemap tile uses, so it is fine for display and wrong for measuring. State Plane gives each state a few zones with distortion under one part in ten thousand; Mississippi East uses a Transverse Mercator zone measured in US survey feet, and that is where our plans live. UTM divides the world into 60 north-south strips 6° wide; Jackson sits in zone 15.

TRY ITStretch a latitude

Slide the latitude and switch projections. Watch the Tissot circles and the Greenland-to-Africa ratio.

φ = 60°Mercator · ±80°AfricaGreenland
Parallel scale k
2.00×
Meridian scale h
2.00×
Area factor h·k
4.00×
Africa ÷ Greenland
1.1(true 14.0)
Each red ellipse is a Tissot indicatrix: the same small circle on the globe, drawn as the projection distorts it.
201·02

Great circles: the arc over the Earth and the chord through it

BIG IDEAThe shortest path over a sphere is a great-circle arc. The shortest path through it is a chord. The gap between them is the whole reason globes and flat maps disagree.

Stretch a string between two cities on a globe and it settles onto a great circle: a circle whose center is the center of the Earth. That string is the arc, and it is the route airliners fly. Now imagine drilling straight through the planet from one city to the other. That tunnel is the chord.

Both come from one number, the central angle θ between the two cities as seen from the Earth's center. With the mean radius R, the arc is R·θ and the chord is 2R·sin(θ/2). The chord's deepest point lies R·(1 − cos(θ/2)) below the surface; surveyors call that distance the sagitta or middle ordinate, and it comes back in GIS 301 when we stake highway curves.

On a flat Mercator map the great circle looks bent and the straight line is a rhumb line, a course of constant compass bearing. The rhumb line is easier to steer and never shorter (the two agree only along a meridian or the equator). From Jackson to London the arc is 7,262 km and the rhumb line 7,665 km; the chord through the Earth is only 6,875 km, 1,007 km deep at its midpoint.

TRY ITArc over, chord through

Pick two cities. Drag the globe to see the arc on the surface and the tunnel beneath it; the cross-section shows the angle.

ABarc over the surfacechord through the Earth
θ = 65.3°R = 6,371.0 kmA JANB LONarc R·θ = 7,262 kmchord 2R·sin(θ/2) = 6,875 kmdepth R·(1 − cos θ/2) = 1,007 km
FROM ONE ANGLE
θ = 65.31° = 1.1399 rad
arc = R·θ = 7,262 km
chord = 2R·sin(θ/2) = 6,875 km
depth = R·(1 − cos θ/2) = 1,007 km
Jackson, MSLondongreat circle 7,262 kmrhumb line 7,665 km
Great circle (arc)
7,262km · 4,513 mi
Rhumb line
7,665km · +5.5%
Chord (tunnel)
6,875km
Tunnel depth
1,007km
Central angle θ
65.3°
Initial bearing
43°
Rhumb bearing
74° constant
Arc − chord
387km
Mean Earth radius 6,371.0088 km (the IUGG R1 value). The plane flies the arc; the dashed chord is the tunnel.
201·03

Buffers: everything within a distance

BIG IDEAA buffer is the set of every point within a distance of a feature. It turns a dot, a street, or a park into a question you can ask the data: what is close?

Most spatial questions start as a distance. Which houses are within a school's walk zone? Which parcels sit within 300 feet of a proposed sewer line? Which homes touch the park? Each one is a buffer: draw the shape of everything within distance d of the feature, then count what falls inside.

A buffer around a point is a circle, so its area is πd². A 1,000 ft school zone covers 72.1 acres. A buffer around a line is a stadium shape (a capsule), and a buffer around a polygon is the polygon grown outward by d with rounded corners. In this small neighborhood a 1,000 ft zone around the school catches 60 of the 60 houses, which is a useful warning: the right distance matters more than the tool.

Buffers are computed in a projected coordinate system, in real feet or meters, which is why the projection lesson came first. Buffer a point in degrees of latitude and longitude and you get an ellipse of the wrong size.

TRY ITCount the houses

Drag the school, the street, or the park; slide the distance. Houses inside the buffer light up and are counted.

schoolgrid 100 ft
Houses inside
18of 60
Buffer area
4.5acres
Distance
250ft
201·04

Overlay: where two layers agree

BIG IDEAOverlay lays two layers on top of each other and cuts new shapes where they meet. Intersect keeps the overlap, union keeps everything, erase keeps what is left.

Put a flood zone on top of a parcel map and three questions appear. How much of each parcel floods? That is an intersect: the pieces common to both layers. What is the total footprint of parcels and flood together? That is a union. How much buildable land is left outside the flood zone? That is an erase (the parcels minus the flood zone).

Every overlay produces new polygons with new areas, and the attributes of both inputs ride along on each piece. That is the trick that makes GIS more than a drawing: after the intersect, each sliver knows its parcel number and its flood zone code at the same time.

Drag the flood zone in the lab and the numbers update. Notice that areas are additive: the erase area plus the intersect area always equals the parcel area, because the two results partition the parcels exactly.

TRY ITCut the parcels

Choose the operation and drag the flood zone over the parcels. The result is hatched and its area is computed.

A1A2A3A4B1B2B3B4flood zone
Intersect area
2.49acres
All parcels
9.87acres
Parcels touched
6of 8
A1
0%
A2
0%
A3
26%
A4
53%
B1
54%
B2
48%
B3
21%
B4
0%
201·05

Point in polygon: inside or outside?

BIG IDEATo decide whether a point is inside a polygon, shoot a ray from the point to the right and count the edges it crosses. Odd means inside; even means outside. That one rule powers every "which district am I in" lookup.

Which school zone is this address in? Which council ward? Which flood zone? Each is a point-in-polygon test. Humans answer it by eye; a computer cannot, so it uses the ray casting rule, sometimes called the even-odd rule.

Start at the point and travel in any fixed direction, say due east, forever. Every time you cross the boundary you flip from inside to outside or back. Since you certainly end up outside, you began inside if and only if you crossed an odd number of times. The rule works for any shape with a single boundary, however jagged, and a small extension handles holes.

Drag the point around the town in the lab, including into the notches, and watch the crossings get numbered. Each test touches every edge once, so a polygon with a million vertices takes a million steps per point; that is why GIS keeps a spatial index to skip polygons whose bounding box the point cannot be in.

TRY ITCast the ray

Drag the dot anywhere. The ray flies east and numbers each boundary crossing.

0 crossings so far…
Crossings
1odd
Verdict
Inside
To boundary
40units
201·06

Geocoding: from a street address to a dot

BIG IDEAGeocoding turns "148 Oak Street" into a dot by finding the right street segment, picking the side by odd or even, and sliding along the segment by the house number's share of the address range.

Street data carries four address numbers per segment: the from and to on the left side and the from and to on the right. Here Oak Street runs 101–199 on the left (odd) and 100–198 on the right (even). To place a house, the geocoder finds the segment whose range holds the number, decides the side by parity, and then interpolates: the position is (number − from) ÷ (to − from) of the way along.

So 148 Oak Street is (148 − 100) ÷ (198 − 100) = 49% of the way from the start, on the right. Real houses are not spaced evenly, so this is an estimate; a dot placed on a parcel centroid or a rooftop is better when a city has that data.

Geocoders also have to forgive typos, abbreviations, and missing ZIP codes. Each candidate gets a match score out of 100, and a match below a minimum score is held back for review. Scores reward an exact house number, street name, and city, and they fall when a piece had to be guessed.

TRY ITPlace the house

Slide or type a house number. The dot moves along Oak Street and jumps sides when the parity changes.

left · odd 101–199right · even 100–198fromtoOak Street →148
INTERPOLATION
148 is even → right side, range 100–198
f = (148 − 100) ÷ (198 − 100)
= 48 ÷ 98 = 0.490
along = f × 318 ft = 156 ft
Side
righteven
Along segment
49%
From the start
156ft
201·07

Classification: same data, different story

BIG IDEAA choropleth map colors areas by class, and the classes come from where you cut the data. The same ${fmtInt(nTracts)} numbers can tell three different stories depending on the cuts.

The lab holds 24 neighborhoods with the share of households that have no car. To color the map we must sort the values into a few classes. Equal interval slices the range into bands of the same width, which is easy to read but can leave classes empty. Quantile puts the same number of areas into each class, which always looks balanced and can split near-identical values. Natural breaks (Jenks) searches for cuts that make each class as tight as possible, following gaps in the data.

The histogram under the map shows the raw values with the break lines drawn through them. Switch methods and the lines move while the data stays still. Then change the number of classes: fewer classes make bolder claims, more classes make finer but noisier ones. Most published maps use four to six.

This is the part of GIS that is closest to writing. A legend is a sentence about the data, and the person who picks the breaks is its author.

TRY ITCut the classes

Change the method and the number of classes. Watch which neighborhoods move between the darkest and lightest classes.

12.29.05.17.214.37.716.19.96.313.72.86.46.18.25.43.85.78.33.62.712.63.55.511.7% of households with no vehicle
2.7–4.4 (5)4.4–6.8 (7)6.8–10.8 (6)10.8–13.1 (3)13.1–16.1 (3)
4.46.810.813.1min 2.7max 16.1
Top class from
13.1%
In top class
3of 24
In bottom class
5of 24
201·08

The analysis toolbox in ArcGIS

BIG IDEAEvery lesson in this course is a tool in ArcGIS Pro and an operator in the Maps SDK. Knowing the plain idea first is what keeps the tool from being a mystery button.

ArcGIS packages the ideas above as geoprocessing tools, run from a toolbox in ArcGIS Pro, chained in ModelBuilder or Python, and published as services. The Maps SDK for JavaScript gives the same geometry math to a web page as operators that run in the browser with no server round trip.

A worked example of why the projection lesson matters. Measured on the Web Mercator plane, New York to London comes out to 8,406 km; measured geodesically, it is 5,570 km. Same two points, same software, one setting apart.

The table below is the map from this course to the software. When a tool name is unfamiliar, find the row that names the plain idea, and the rest is a dialog box.

New York → Londonplanar, Web Mercator · 8,406 kmgeodesic · 5,570 kmsame points, same tool, one setting apart: +51%
Measured in the browser from the same two coordinates; the planar number is what a ruler on a Web Mercator basemap reports.

Check yourself: GIS 201

  1. 1.On a Mercator map, how many times larger than true does a small shape at 60° latitude draw, by length?
  2. 2.New York to London: which is the great-circle distance?
  3. 3.From Jackson to Tokyo, how deep below the surface would a straight tunnel (the chord) pass at its midpoint?
  4. 4.A ray cast east from a point crosses a polygon's boundary 3 times. Where is the point?
  5. 5.Where does the geocoder put 148 Oak Street on a segment whose even side runs 100–198?
  6. 6.A 1,000 ft school zone is drawn as a buffer around the school. About how much land is inside it?