CEE 8813 · GIS Lecture 3 · Table operations

Attribute Table Lab

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

Crash Selected

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.

    Select By Attributes

    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.

    Attribute table

    Try this in class

    1. 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.
    2. 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?
    3. 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.
    4. 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?
    5. 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.
    6. 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.

    ArcGIS Pro: Calculate Field, Python 3: !F__of_Fata! * 5 + !F__Serious! * 3 + !F__Visible! * 1. ArcMap: Field Calculator, VB Script: [F__of_Fata]*5 + [F__Serious]*3 + [F__Visible]*1.

    StatisticsSlide 15

    Often a first step in data analysis and a chance to think critically about the data. Statistics are returned only for the selected set.

    ArcGIS Pro: right-click a field header › Statistics, or the Summary Statistics tool.

    Slides 16–22 (Join and Relate) are the next step: they work on two tables at once, such as these crashes and the county table.