An attribute table holds the facts about every feature on the map. Put 480 crashes, a teaching subset of the lecture's 1,491-crash CSV, on the map, then sort, query, add and calculate fields and summarize them, in the order ArcGIS Pro does it. Each step shows what changes on the map and what changes in the stored data.
Collision.shp on the map
CrashSelected
World view · longitude/latitude grid, U.S. states only
Where the points land
Inside Georgia0
Selected0
Fields0
What you are seeing
Drag to pan, scroll or pinch to zoom. Click a point to identify it. Projection: Georgia Statewide Lambert.
Display XY Data
The crash file Collisions Dataset.csv is a plain table with a latitude column and a longitude column. Tell ArcGIS which column is X, which is Y, and which coordinate system the numbers are in (slides 3–7).
Collisions Dataset.csv · 26 columns · 1,491 rows (480 in this lab) · first rows of six columns
Export Features
CSV header → shapefile field name
ArcGIS replaced the characters a shapefile does not allow (spaces, #, :, /, parentheses) with underscores, put an F in front of names that did not start with a letter, and cut every name to 10 characters (slide 14).
In ArcGIS Pro, Display XY Data runs the XY Table To Point tool, which writes a new feature class that already has an ObjectID. In ArcMap (the 2022 slides) it made a temporary XY event layer without one, so slide 6 exports the layer to a shapefile to get a unique ID. The lab file is that shapefile, Collision.shp.
Sort
Click any column header in the attribute table below to sort by that field. Click again to reverse. Sorting changes only the view. Every record keeps its FID and its values, and the order stored in Collision.dbf stays the same (slide 8).
Sorted by–
First row on screen–
First record stored–
To change the stored order you need the Sort geoprocessing tool, which writes a new, sorted copy of the data. The table view never rewrites the file.
Select By Attributes
Export the XY layer first. Queries and field calculations need a unique ID for every record, and the export is what adds it (slide 6).
Build a where clause from a field, an operator and a value. Text values go in single quotes. In LIKE, % stands for any run of characters and _ for exactly one. The selected records turn cyan on the map and in the table (slides 9–11).
SQL as ArcGIS Pro writes it
The same query in ArcMap, as on slide 9
Whether = and LIKE match upper and lower case can depend on the data source. When you are not sure, compare in one case with UPPER(), as the lab does when Match case is off. AND is evaluated before OR, as in any SQL.
Add Field & Calculate Field
Export the XY layer first. Queries and field calculations need a unique ID for every record, and the export is what adds it (slide 6).
Think about the field type before you add the field (slide 13). Then Calculate Field fills it from an expression (slide 14). If any records are selected, only those rows are calculated.
Add Field
Type
Holds
In this table
Short
Whole numbers from −32,768 to 32,767
# of vehicles (1 to 5) would fit
Long
Whole numbers up to about ±2.1 billion
Collision_ IDs here (1001 to 1480) would fit in Short, but GDOT's 7-digit report numbers need Long
Float
Decimals, about 7 significant digits
A rate such as injuries per vehicle
Double
Decimals, about 15 significant digits
Latitude 33.76507, MilePoint_
Text
Letters and digits up to a set length (254 at most in a shapefile)
Manner_of_, and route IDs such as 0893255801I whose leading zero a number field would drop
Date
A date; a shapefile keeps the date but not the time of day
Date_and_T came in as Text, so it sorts as text (step 2)
Field names in a shapefile: at most 10 characters, letters, digits and underscores only, starting with a letter, and not a reserved word such as DATE, ORDER or FID. ArcGIS Pro 3.2 and later also offer Big Integer, Date Only, Time Only and Timestamp Offset.
Calculate Field
The same expression in ArcMap's Field Calculator (VB Script, slide 14)
Arcade, ArcGIS Pro's other expression language
Statistics
Pick a numeric field to summarize. Like ArcGIS, the lab returns statistics for the selected set when one exists, and for every record otherwise (slide 15).
Count–
Sum–
Mean–
Median–
Minimum–
Maximum–
Std. deviation–sample, n − 1
Nulls0
Attribute table
Try this in class
In step 1, press “Swap X and Y”. The points leave Georgia for Antarctica and the count inside Georgia drops to 0. Press “Correct setup” to bring them back.
Choose NAD 1983 StatePlane Georgia West (US Feet) as the coordinate system. All 480 points pile up on one spot in Louisiana, because degrees were read as feet. Which kind of coordinate system do degree values need?
In step 2, sort Date_and_T ascending and read the message. Why does a Text field put a 1 PM crash before a 2 AM crash? Check that every FID stayed with its row.
In step 3, run the slide 9 query on Manner_of_ (131 records). Run the lower-case '%angle%' preset with Match case on and see what it finds. Run the '%Angle%' query again, set Selection type to “Select subset from the current selection” and press the F__of_Fata >= 1 preset. How many fatal angle crashes are left?
Select the fatal or serious injury crashes, add a Short field named SevScore and calculate the slide 14 score. How many rows got a score, and what do the other rows show? Clear the selection and calculate again.
Calculate the injuries-per-vehicle preset into a Short field and into a Double field and compare them in step 5. Then summarize MilePoint_ for all records. Is the maximum a real milepoint?
Pitfalls students hit
X is longitude and Y is latitude. Swapping them is the most common Display XY mistake.
Degree values need a geographic coordinate system. Choosing a projected one, such as State Plane in feet, piles every point on one spot (slide 7).
Without an ObjectID, ArcMap could not select or query records reliably. Export first (slide 6).
Numbers or dates stored as Text sort letter by letter.
'%angle%' and '%Angle%' can give different answers. Mind the case, or use UPPER().
Calculate Field with a selection writes only the selected rows. In a shapefile the rest hold 0, which looks like a real value.
Integer fields (Short, Long) cannot keep decimals. Store rates in Float or Double.
Statistics describe the selected set only. Placeholder values such as 1000 or −1 distort them.
Back to Lecture 3: operations on one table (slides 2–15)
Slide 2 lists the one-table operations in this order. Each card names the slides and the ArcGIS Pro command that does the same thing.
Display XY DataSlides 3–7
A CSV has coordinates but no geometry. Display XY Data reads the X field as longitude and the Y field as latitude, in the geographic coordinate system you choose. Slide 7: select a GCS and remove any PCS.
ArcGIS Pro: right-click the table › Display XY Data (the XY Table To Point tool), then Export Features. ArcMap: Display XY Data, then Export Data.
SortingSlide 8
Sorting reorders the rows on screen. It has no effect on the original data.
ArcGIS Pro: right-click a field header › Sort Ascending or Sort Descending, or double-click the header. The Sort geoprocessing tool writes a new dataset instead.
Select By AttributesSlides 9–11
A where clause picks the records that meet a condition, such as fatalities ≥ 1 or a manner of collision containing “Angle”. Show the selected records, switch the selection or clear it.
ArcGIS Pro: Map tab › Select By Attributes; in the table, Show Selected Records, Switch and Clear.
Field types and Add FieldSlides 12–13
Choose the type before you add the field. Once a field holds data, ArcGIS will not change its type; you add a new field and calculate it again.
ArcGIS Pro: the Add Field tool, or the Fields view of the table (Data Design › Fields).
Calculate FieldSlide 14
Writes the result of an expression into a field, for every record or only the selected ones. Shapefile field names are cut to 10 characters, so “# of Fatalities (Collision Table)” becomes F__of_Fata.