← ClaudeAtlas

spatial-joins-and-keyslisted

Getting attribute joins and spatial joins right, covering key types, leading-zero padding (CSJ, county FIPS, ZIP), case and whitespace, null keys, one-to-many row blowups, intersects vs within vs contains, boundary effects and reporting the match rate honestly. Use it when asked to "join a table to a layer", "spatial join points to polygons", "match records by ID", "why didn't my join match", "low match rate", or when a join returns too many rows.
wiatrek-kevin-s/columbus · ★ 2 · AI & Automation · score 68
Install: claude install-skill wiatrek-kevin-s/columbus
# Spatial joins and keys A join that runs is not a join that worked. The usual failures are quiet: keys that lost their zeros, numbers joined to text, nulls that never match, a right side that repeats keys and multiplies rows, and points on a boundary that match two polygons. This skill is about catching those before reporting a result. ## General practice (with or without Columbus) ### 1. Decide what kind of join you need - **Attribute join**: rows match when a key field is equal on both sides (route id, CSJ, FIPS code, parcel id). Fast and exact, if the keys are clean. - **Spatial join**: rows match when geometries meet a predicate (a point within a county). Use it when there is no shared key, or to check that the shared key agrees with location. - Decide the expected **cardinality** before you run it: one-to-one, many-to-one (many crashes to one county), or one-to-many (one route to many segments). Write it down; it is how you will know the result is wrong. ### 2. Profile the keys on both sides first For each key: its type (text or number), its length range, how many distinct values, how many nulls and empty strings, and whether it repeats on the side that should be unique. Look at ten real values from each side next to each other. ### 3. Text vs number, and leading zeros Codes are text, even when they are all digits. Storing them as numbers drops leading zeros, and spreadsheets do it silently on open. | Key | Correct form | Typical damage | | --- | --- |