A successful geographic match can still multiply the quantity you meant to count
A table contains one hundred facilities. After joining it to service-area polygons, the output contains one hundred and twelve rows. The program has not necessarily invented twelve facilities. Some original points may match more than one polygon, while others may have no match at all. The important question is what those rows now represent.
This guide focuses on that change of unit: from original objects to spatial relationships, then from relationships to allocated totals. It builds on the existing spatial-join introduction rather than repeating a general list of GIS tools. We will work through boundary points, overlapping areas, unmatched records and weights that do—or do not—preserve the original amount.
All locations, areas and quantities below are imaginary planar examples. They describe neither official administrative boundaries nor real service eligibility. Geometric predicates do not settle legal, educational or emergency decisions by themselves. Use authoritative boundaries and the relevant decision rules for an actual application.
Geoinformatics subject guide · Learning that transfers into life · How X Works hub
Choose your reading route
Route 1: Identify the relationship · Chapters 1–3
Route 2: Work through edge cases · Chapters 4–5
Route 3: Preserve quantities deliberately · Chapters 6–8
Route 4: Test the complete result · Chapters 9–10
Audit geometry, coordinate reference and time before aggregation
Route 5: Transfer and communicate · Chapters 11–12
Full chapter index · Independent worked case · Questions and practical checks
Chapter index
Identify the relationship · Chapters 1–3
Distinguish an object table from a relationship table
State the predicate as a precise question
Separate geometric matching from administrative assignment
Work through edge cases · Chapters 4–5
Work a shared-boundary example by hand
Treat overlaps and holes as different cases
Preserve quantities deliberately · Chapters 6–8
Check copied quantities for multiplicity inflation
Use weights when the target is an additive allocation
Keep unmatched objects visible
Test the complete result · Chapters 9–10
Audit geometry, coordinate reference and time before aggregation
Test relationships and invariants, not just row counts
Transfer and communicate · Chapters 11–12
Transfer from points to building footprints
Explain what the final totals represent
CHAPTER 1 OF 12
1. Distinguish an object table from a relationship table
An object table might have one row per facility. A spatial join can produce one row per facility–area relationship. If facility F1 intersects areas A and B, two output rows can correctly describe those two relationships. They do not establish that two distinct facilities exist. The unit of the output changed.
An ordinary equality join has the same issue when keys are not unique. Geographic matching makes the relationship depend on geometry rather than a shared text key, but it does not remove relational multiplicity. PostgreSQL’s join tutorial describes the underlying pairing of rows. The geographic predicate determines which pairs qualify.
Before joining, state whether the desired output is all qualifying pairs, one assigned area per facility, a set of facilities with any match, or a total distributed across areas. These are different products. A one-to-many relationship table can be the correct intermediate evidence for all of them, but each needs a different downstream calculation.
Keep original feature IDs in the output. Without them, repeated relationships are difficult to distinguish from duplicated source objects. Also retain the matched area ID and the predicate used. A table with only area names and copied quantities may look easy to read while concealing the information needed to explain an unexpected total.
CHAPTER 2 OF 12
2. State the predicate as a precise question
For valid planar geometries, intersects asks whether two geometries share any point. Covers includes points on a polygon’s boundary as well as its interior. Contains has an additional interior-intersection condition; in particular, a polygon does not contain a point lying only on its boundary. PostGIS documents these distinctions explicitly.
These names should not be reduced to the everyday phrase inside the area. A point on an edge, a line along an edge and a polygon sharing an edge present different geometric relationships. Define the geometry types and the intended test, then inspect examples matching those types.
For a point strictly inside one ordinary polygon, contains and covers can agree. That easy case is useful for learning but insufficient for validation. A workflow tested only on interior points can pass every demonstration and fail exactly where the substantive allocation problem is hardest: shared edges, holes and overlaps.
Software choices also matter. The examples here use planar geometry semantics. Do not assume that every geography datatype, numerical tolerance or spatial engine behaves identically. Record the actual implementation and test cases. A copied predicate name is not a substitute for checking what the receiving tool does with the data in question.
CHAPTER 3 OF 12
3. Separate geometric matching from administrative assignment
A polygon is a digital representation of an area under a stated definition and date. A point can satisfy a geometric relationship without establishing an official allocation. School eligibility, service responsibility and property administration may depend on rules that are not encoded in the polygon alone.
Imagine a facility entrance on a shared boundary. A covers test can return both adjacent areas. That is a faithful description of the stored geometry, not an instruction to choose whichever area appears first in the database. An assignment decision needs a documented tie policy or additional authoritative information.
A deterministic rule can make a result reproducible without making it substantively correct. Choosing the smallest area ID is repeatable, but it may have no relationship to the service arrangement. If such a convention is appropriate for an exploratory calculation, label it as that convention and retain the ambiguity flag.
The first useful repair is often to keep the relationship table and create a separate assignment table. The former preserves what the geometry says; the latter records what the decision rule does with it. This separation lets another reviewer change the allocation policy without pretending that the original spatial evidence was different.
CHAPTER 4 OF 12
4. Work a shared-boundary example by hand
Draw rectangle A from x = 0 to 10 and y = 0 to 10. Draw adjacent rectangle B from x = 10 to 20 over the same y range. Put P1 at (5,5), P2 at (10,5) and P3 at (15,5). The rectangles meet along x = 10.
Under covers, A matches P1 and P2, while B matches P2 and P3. There are four qualifying pairs but only three distinct points. Counting matches by area gives two for A and two for B. Adding those counts produces four memberships, not four unique facilities.
Under contains for these point–polygon examples, P1 matches A and P3 matches B, while boundary point P2 matches neither. The pair total becomes two. The source still has three points. Changing the predicate traded a double boundary match for an unmatched point; it did not decide the appropriate real-world assignment.
A good exercise asks you to predict both outputs before opening GIS software. Then compare exact pair lists rather than only totals. Four versus two is not a competition to find the bigger correct number. The correct result depends on the stated relationship, and a complete allocation needs an additional rule for P2.
CHAPTER 5 OF 12
5. Treat overlaps and holes as different cases
Overlapping service polygons can represent genuine simultaneous memberships. A community centre may serve both an accessibility programme area and a recreation catchment. A point in the overlap can legitimately match two areas. Forcing every point into one area may erase the question the polygons were designed to answer.
A hole in a polygon is different. A point strictly inside an excluded interior ring is not inside that polygon’s covered region. A point on the hole boundary requires the chosen boundary predicate. A drawing that fills the hole visually can mislead a learner about the stored relationship even when the geometry is technically correct.
Create separate test points in the polygon interior, inside the hole, on the outer boundary and on the hole boundary. List the expected results for each predicate. Do not combine all failures under a vague label such as edge issue. The distinction helps determine whether the problem is data encoding, geometry validity or a mistaken decision rule.
Also distinguish intended overlap from accidental overlap caused by geometry errors or incompatible boundary versions. Both produce multiple matches, but their remedies differ. A true overlap needs an interpretation or allocation policy. A defective boundary layer needs source correction and revalidation, not a clever aggregation that hides the inconsistency.
CHAPTER 6 OF 12
6. Check copied quantities for multiplicity inflation
Suppose P1, P2 and P3 in the shared-boundary example carry capacities of 100, 60 and 40 places. The source total is 200. A covers join copies P2’s 60 into both area relationships. Summing the joined rows gives 100 + 60 + 60 + 40 = 260.
The extra 60 is not a new physical capacity. It is repeated whole-object capacity attached to two valid relationships. An area report may intentionally show the capacity of every facility touching each area, but its area totals are then non-additive. Adding them to obtain a regional capacity would answer a different and misleading question.
A distinct source-ID count can recover three facilities, but it does not automatically tell you how to distribute their 200 places across A and B. Keeping only the first P2 row chooses an area implicitly. Summing distinct numerical capacities is even less safe because different facilities can have the same capacity.
Write a conservation check against the original table: source total, matched unique-object total, relationship-row total and allocated total. When they differ, explain the reason. A useful audit does not demand that every possible total be equal; it demands that the differences follow the declared counting and allocation rules.
CHAPTER 7 OF 12
7. Use weights when the target is an additive allocation
One way to distribute an object’s quantity is to attach weights to its qualifying areas. If the quantity must be fully allocated exactly once, its weights should sum to one. For an object with quantity q and weights w1 and w2, the allocated amounts are q×w1 and q×w2.
In our fictional example, assign P2 weights 0.5 to A and 0.5 to B solely as a teaching convention. A receives 100 + 30 = 130 and B receives 30 + 40 = 70. Their total is 200. The arithmetic preserves capacity, but the equal split is not evidence that half of P2’s real users come from each side.
Another policy might allocate all of P2 to A, giving totals 160 and 40. Both policies conserve 200 while producing different area figures. Conservation checks the bookkeeping, not the substantive validity of the weights. Choose weights from the intended question and available evidence, rather than treating a balanced total as proof of a fair or accurate allocation.
If quantities can be negative, missing or measured with uncertainty, define how the allocation treats them. A missing capacity should not become zero merely because a multiplication needs a number. Preserve the reason a total is incomplete and distinguish a fully allocated known amount from a complete inventory of all actual capacity.
CHAPTER 8 OF 12
8. Keep unmatched objects visible
An inner join returns qualifying pairs and can omit source objects with no match. A left join can preserve those objects with an absent matched-area value. For a complete audit, the difference matters: a zero assigned to an area and an object with no area relationship are not the same thing.
Add point P4 with capacity 20 outside both rectangles. The source total becomes 220. A covers relationship table for A and B still contains capacities totalling 260, because P4 contributes no pair and P2 contributes twice. The apparent surplus of 40 hides two simultaneous problems: 60 repeated and 20 unmatched.
A net difference alone cannot reveal that structure. List unmatched IDs separately and calculate the extra representation of multiply matched IDs. The equation 220 − 20 + 60 = 260 explains the joined-row sum exactly. It also shows why a total that happens to match the source could conceal cancelling omissions and duplications.
For a one-assignment product, use explicit states such as assigned, ambiguous and unmatched. Do not convert unresolved states to the nearest area without authorisation from the analysis rule. Nearest is a different relationship from containment and may require a suitable distance metric, maximum distance and treatment of ties.
CHAPTER 9 OF 12
9. Audit geometry, coordinate reference and time before aggregation
A correct predicate applied to incompatible coordinates gives an unreliable answer. Check coordinate reference systems, axis conventions, units and transformation history before joining. Two layers that look approximately aligned at a small display scale can still disagree near boundaries where the allocation changes.
Temporal compatibility is equally important. A facility observed in one year may be joined to a boundary effective in another. A difference can reflect a real boundary change rather than a positional error. Preserve observation dates and boundary versions so a later analyst can reconstruct which geographic world the join represented.
Geometry validity needs its own check. PostGIS warns against using the discussed predicates with invalid geometries. Repairing a self-intersection can alter area relationships, so record the repair and compare results. A repaired geometry is not automatically authoritative merely because a validator now accepts it.
Use stable landmarks and deliberately selected boundary cases, not only random interior points. Record how many source objects lie near uncertain edges under an appropriate uncertainty assessment. An exactly computed result from uncertain coordinates can remain substantively uncertain. More decimal places in the output do not resolve that mismatch.
CHAPTER 10 OF 12
10. Test relationships and invariants, not just row counts
A useful tiny fixture includes an interior point, a shared-edge point, an overlap point, a hole point, an unmatched point and a duplicate source ID introduced deliberately. For each, write the expected pair list and allocation state. This tests mechanisms rather than hoping that a plausible overall count indicates correctness.
Check pair uniqueness separately from source uniqueness. Two identical facility–area rows may be accidental duplication. Two rows for one facility matched to different areas may be legitimate multiplicity. Removing every repeated facility ID would erase that distinction. Keep a qualified pair key for relationship diagnostics.
For nonnegative quantities with full single allocation, verify that each eligible object’s weights sum to one and that the allocated total equals the known eligible source total within the stated numerical tolerance. For deliberately overlapping memberships, do not require area totals to add to the unique-object total. Instead, clearly label the totals non-additive.
Finally compare actual ID sets. A source count of one hundred and an assigned count of one hundred can still contain the wrong objects if one omission is offset by a duplicate. Counts are compact summaries, not full evidence of correspondence. The pair list, unresolved list and allocation rule make the result independently checkable.
CHAPTER 11 OF 12
11. Transfer from points to building footprints
A building represented by a point and the same building represented by a footprint can answer different questions. Its centroid may lie outside a hazard polygon while part of the building intersects it. A footprint intersection establishes contact with the modelled zone, not necessarily that the entire building is affected uniformly.
If a building footprint overlaps two administrative areas, allocating by overlap area can be one modelling choice. It requires appropriate area measurement, valid geometry and an assumption connecting the allocated quantity to area. Floor area, occupants or service use are not guaranteed to be uniformly distributed across the footprint.
For an invented example, a 100-square-unit building has 30 square units in A and 70 in B. Allocating a known 50-unit quantity by footprint area gives 15 and 35. The total is conserved. If all the activity actually occurs in the part within A, however, the area-proportional allocation misrepresents the process despite perfect arithmetic.
The transfer lesson is to separate geometry from the quantity’s spatial distribution. A point-based tie rule cannot be copied unchanged to an areal overlap task. State which relationship remains useful, which new measurement is required and which substantive assumption justifies moving from an overlap fraction to an allocated amount.
CHAPTER 12 OF 12
12. Explain what the final totals represent
A reader-facing result can distinguish three statements: ninety facilities have at least one area match; five facilities have multiple qualifying matches; and ten facilities remain unmatched. If allocations are made, report the rule and the known quantity being distributed. Avoid compressing all of these into an unexplained joined successfully message.
When area totals are non-additive, say so beside the numbers. A facility serving several catchments may legitimately appear in several catchment reports. That is useful information as long as the reader is not encouraged to add the reports as if they were disjoint physical inventories.
Keep source versions, geometry rules, predicate, spatial engine, pair keys, unresolved cases and weight definitions. These records let a reviewer distinguish a changed boundary from a changed allocation policy. They also make it possible to repair one component without silently rewriting the earlier evidence.
The gold-standard outcome is not necessarily one tidy row for every object. It is an intelligible relationship between objects, areas and totals. You should be able to explain why an object appears twice, why another is absent from a relationship table, and exactly what operation turns those relationships into the quantity shown in the final report.
Independent worked case and evidence checks
Work this independent fictional case using five facilities. Their capacities are F1 = 80, F2 = 50, F3 = 30, F4 = 20 and F5 = 40. The source total is 220. Under a stated covers predicate, F1 matches A; F2 matches A and B; F3 matches B and C; F4 matches no area; and F5 matches C.
The relationship table contains six matched pairs. Counting distinct matched facility IDs gives four, not six. The joined capacity sum is 80 + 50 + 50 + 30 + 30 + 40 = 280. Starting from the source total explains it: 220 minus F4’s unmatched 20 plus F2’s extra 50 plus F3’s extra 30 equals 280.
Now use a declared additive allocation: F1 goes entirely to A; F2 is split 0.6 to A and 0.4 to B; F3 is split 0.25 to B and 0.75 to C; F5 goes entirely to C. A receives 80 + 30 = 110. B receives 20 + 7.5 = 27.5. C receives 22.5 + 40 = 62.5.
The allocated total is 110 + 27.5 + 62.5 = 200. That equals the known capacity of the four matched facilities, not the entire source total of 220. Preserve F4’s 20 as unallocated rather than reporting that the region contains only 200 places. The distinction remains even though every assigned facility’s weights sum to one.
Introduce an error deliberately: give F2 weights 0.6 and 0.6. Its contribution becomes 60 rather than 50, raising the allocated total to 210. The problem is a weight-sum failure, not a predicate failure. A geometry repair would not fix it. This is why diagnostics should identify the mechanism responsible for each discrepancy.
For a changed-context check, suppose F2’s 50 is an unknown capacity rather than a measured quantity. Its two relationships can still be counted, but the capacity total is incomplete. Do not fill the missing capacity with zero merely to restore a convenient equality. Report the known subtotal and the unresolved contribution separately.
Finally ask whether those fractions were measured service-use shares, area-based assumptions or an administrative convention. The numerical allocation is reproducible under any of those interpretations, but the claim it supports differs. Correct weights, valid geometry and conserved totals are three pieces of evidence, not a single interchangeable guarantee.
Try a cancellation trap with a smaller population. Three source facilities have capacities 40, 40 and 80. The first matches two areas, the second matches none and the third matches one. The source total is 160. The relationship sum is also 40 + 40 + 80 = 160. Equal totals conceal one omitted facility and one repeated facility. Distinct matched IDs reveal only two of the three source facilities, while the pair list explains where the extra representation entered.
Now change the target from total capacity to the number of facilities with at least one match. The answer is two, regardless of the repeated first facility’s capacity. Change it again to the number of qualifying relationships: the answer is three. Finally ask for capacity allocated to exactly one area per source facility: the unmatched object requires a documented unresolved state or a justified assignment rule. The same small table now supports three answers and one incomplete task.
A reviewer should be able to name the evidence that distinguishes these outcomes without seeing a map. If the pair list and source IDs suffice, the relational explanation is clear. If the reviewer must guess whether each row means an object, a membership or an allocation, the result needs clearer structure before it is used.
Worked comparison
| Question | Suitable unit or rule | Check |
|---|---|---|
| How many relationships exist? | Unique facility–area pairs | No duplicate copies of the same pair |
| How many facilities matched? | Distinct source facility IDs | Separate unmatched source IDs |
| How much capacity touches each area? | Whole-object memberships | Label overlapping totals non-additive |
| How much is allocated? | Quantity multiplied by declared weights | Weights and known subtotal reconcile |
| How much exists in the region? | Complete source population and quantity evidence | Do not erase unresolved capacity |
Questions and practical checks
Why did the output have more rows than the source?
One object can match several areas. Inspect source–area pairs before treating additional rows as duplicated physical objects.
Should boundary points use contains or covers?
Choose the relationship the task requires and test the actual implementation. Covers includes boundary points; that can create multiple matches on shared edges.
Does splitting equally make the allocation correct?
It can conserve a total, but substantive correctness requires evidence or an appropriate declared convention. Equal weights are not measured usage.
Can equal row totals prove nothing was lost?
No. Omissions and repeated objects can cancel. Compare IDs, pair multiplicities and unmatched records.
Should unmatched points go to the nearest area?
Only if that is an explicit, justified rule. Nearest is a different relationship and needs its own distance and tie conventions.
Continue with the connected subjects
Start with relationships and geometry
Spatial join foundations: how location connects records
Spatial topology: boundaries, overlap and containment
Check upstream location and interpretation
Geocoding: turning descriptions into positions
Spatial uncertainty: why exact predicates do not guarantee exact locations
Spatial overlay: when the geometry itself must be combined
Sources and scope
PostGIS: contains and its interior condition
PostGIS: covers, boundaries and validity warning
PostGIS: intersection semantics and implementation distinctions
PostgreSQL: matched pairs and preserving unmatched rows in joins
The numerical cases in this guide are original fictional teaching examples, not measurements from a real site. This is an educational explanation, not a field safety instruction, engineering approval or an official certification. For a real project, use qualified practitioners, current product documentation and site-specific evidence. Sources were checked on 30 October 2026.
Continue the representation checks
A raster mask governs which observations enter a calculation; tile identity governs which representations count as one object; a spatial join governs which relationships enter a total; and an index governs which candidates reach an exact test. Use the companion guide when your question crosses one of those boundaries.
Raster Validity Masks, Zero Measurements and Multiband Coverage
Vector-Tile Feature Counts, Clipped Fragments and Source Identity
GeoPackage RTree Indexes, Stale Bounds and Spatial Query Completeness