Working with Feature Layers

Working with Feature Layers

LAB 2

WORKING WITH FEATURE LAYERS—

Police Stations in Downtown San Francisco

Overview

In this lab, you will

Find out how to download and prepare data for your map

Work with linear and point layers

Label features

Select by attribute, location and interactive selection method

Create new layers

This lab will be used as a reminder that map features can be selected, created into a new layer and edited.

Note: A Hint for this Week: Relative Paths— In the past, students have had problems with broken data sources: a !!red exclamation point!!shows up next to your layer and next thing you know you’re spending an hour tracking down all of your files to re-link the data sources to the layers.

This is because ArcMap follows two kinds of data paths, and the default - “Store full path names to data sources” - is designed for people using just one computer.

Change it: Customize>ArcMap Options. Then click on the General Tab. In the General Section Click on the box next to “Make Relative paths the default for new map documents”
Go ahead and change it to the default. (But be warned: the default may change back to full paths when you log off computers in the SPA Lab.)

Now you should have no problem moving your maps from computer to computer. Just make sure that wherever you go, you have the actual data sources in the computer (or on a flash drive).

You can also watch the video explanation (this is for version 9.3, but it is a good explanation about what “relative path” does at

PART I: Preliminaries

The layers we used in Lab 1 were prepared which is not usually the case in making maps. In this lab we will learn how to download original data and prepare them to use in ArcGIS.

Assembling Data

Save all files in the lab2 folder.

  1. Go to the class Links Page and select the ESRI "Census-Tiger" link.
  2. On the ESRI ArcData page, click on the State of California in the US map (Or select it from the drop down menu)
  3. From the "Select by County" drop down menu on the left, select San Francisco County. Then click on the "Submit Selection" button.
  4. In the new data window click the "County 2000" box,
  5. Click the "Proceed to Download" button at the bottom of the screen.
  6. In the final window, click "Download File" Select the save option (it is a .zip file called at_tigeresri…)
  7. Repeat the process (steps3-6) for Alameda County.

The two .zip files should be in your computer’s “Downloads” folder. Copy those two zip files and paste them into your Lab 2 folder on your H: Drive. Right click on the first one and use the 7-zip option and select extact to here. (Select “Yes” to replace the file) Repeat for the second zip file.

Now you have to unzip the cty0006001.zip and cty0006075.zip files. Right click on the first zip file and select the 7-zip option and then select the exact here option. Do the same for the next zip file. Each zip file contains 3 files. 1 .dbf, 1 .shp, and 1 .shx

DO NOT CHANGE THE NAME OF THESE FILES IN WINDOWS!! ArcMap has its own manner to organize files.

Open ArcCatalog

Start>All Programs>ArcGISArcCatalog (you can also open this program through ArcGIS using the icon.

Use the Connect to folder icon at the top of the screen. Select you H: Drive.

Now in table of contents in ArcCatalog double click on your H: Drive and navigate to the Lab_2 Folder. Select one of the oddly named .shp files. Click on the “Preview” tab. One of the files is Alameda (one large shape) and the other is San Francisco (two separate shapes). Once you have determined which is which you can right click on the .shp file in the Table of contents and rename the files. “sfCounty” and “alamedaCounty”—if a .shp extension exists at the end, make sure to not delete that. Close ArcCatalog.

Opening ArcMAP

Start>All Programs>ArcGISArcMap10

Save your project as “YourUCLAID_Lab2” in your lab2 folder

SETTING THE COORDINATE SYSTEM

The ESRI shapefiles do not have a coordinate system attached to them. If you try to add them to ArcMap, you will get a warning that the coordinate system is not defined. ArcMap will draw, i.e. display, the layer but will not place it correctly according to its global location. This is a problem if you intend to perform any spatial analysis or add other layers that have defined coordinate systems. We will define the coordinate system for each shapefile.

  1. Open ArcToolbox.
  1. Click the plus sign next to “Data Management Tools” and within Data Management Tools, click the plus sign next to “Projections and Transformations”.
  2. Under the Projections and Transformations toolset, open “Define Projection” tool (double-click to open the tool).
  3. In the first box “Input Dataset or Feature Class” (in the Define Projection dialog box), browse to your sfCounty shapefile.
  4. In the second input box “Coordinate System”, click on the Spatial Reference Properties button (looks like a hand pointing to a sheet of paper). In the XY Coordinate System tab, click on “Select” to select a predefined coordinate system. In the browse for a coordinate system dialog box, double click on Geographic Coordinate Systems and then double-click on North America. Then click on NAD1983.prj(North American Datum) and click on “Add” to select the coordinate system. Click OK and then OK again in the main Define Projection dialog box.

Note: If you go to the main ESRI Tigerline web-page, you will see Data Information. Under the data information, you will see that the coordinate system is listed as NAD83, which is short for “North American Datum 1983”.

  1. After the tool is completed, ArcMap will add the shapefile to your map document.
  2. Repeat for the “alamedaCounty” shapefile.

ADDING DATA TO THE MAP

  1. Click on the "add data" icon on the top toolbar.
  2. Click on the "connect to folder" icon, to connect to your lab2 folder.
  3. From your lab2 folder, add the San Francisco and Alameda County shapefiles that you just downloaded and defined projections to your map if the program has not already done so. The shapefiles extend to the ocean and the bay, which is common for the shapefiles along the coast. These shapefiles are statisticalandnot geographical boundaries.
  4. Download the following shapefiles from the Lab2 PreparedFilesand put the file in the Lab2 folder
  • California boundary (caliDetail)
  • San Francisco Shore boundary (sfShoreExt)
  • San Francisco neighborhoods (planningNeighborhoods) (uncheck the box next to this layer for now)
  • Bay area counties other than San Francisco and Alameda (baCtyOther) (Uncheck the box next to this layer for now)
  • San Francisco Police stations (sfpdStations) (uncheck the box next to this layer for now)

Using the add data icon to add them map:

Note: you can add multiple files at a time by holding down control as you click each file. When you've selected all your files, release the control key and click "Add."

PART II: THE CLIP TOOL

In order to create the original geographic shape of both counties from the shapefiles we downloaded from Census, we will use the Clip tool using the California boundary shapefile as well as the San Francisco shore shapefile, which are both geographic boundaries.

  1. In the toolbar at the top of the screen, go to the Geoprocessing menu, and click on the “Clip” tool.

You can also get to this in the toolbox. Toolbox > analysis tools > extract > clip

THE CLIP DIALOG

  1. Click on "showhelp" the help graphic shows that the clip tool will take one layer and clip it with another layer, creating a new layer. Green dots next to empty fields represent fields that must be filled. Remember that the clip tool extracts input features that overlay the clip features.
  2. Click on the drop-down button next to the “Input Features” field and select the sfCounty feature from the drop down menu.
  3. For the Clip Features select the San Francisco shore shapefile (sfShoreExt).
  4. Rename the output feature in your lab 2 folder as “sfClip.shp” Click ok.
  5. Repeat the process for the alamedaCounty shapefile. This time use the California Boundary shapefile as your Clip Feature. Rename the output feature as “alClip.” For both of these files, you can click between the original and clipped layers to see the difference between these layers.

PART III: DATA SELECTION AND CREATING NEW LAYERS FROM SELECTED DATA

There are three ways to select things in a map.

  1. --by attributes
  2. --by location
  3. --Interactive Selection Method (i.e. manual, tedious, point-and-click selection)

Combining these simple selection tools can be very powerful in selecting, and in emphasizing, particular data.

SELECTION BY ATTRIBUTES

We will begin by selecting the Downtown neighborhood of San Francisco using “Selection by Attributes”.

  1. Check the box next to the planningNeighborhood layer to have it shown on the map. Move this layer towards the top of the layers in your table of contents in order to see what features you will be selecting.
  2. From the top toolbar, select “Selection.”
  3. Choose “Select by attributes.”
  4. In the “Layer” field, select “planningNeighborhoods” from the drop-down menu.
  5. The “Method” drop down box has various options, “Create a new selection” “add to current selection”, etc. for this Lab we are going to use “Create a new selection”
  6. The field below the “Method” field has a number of terms in quotation marks, including: FID, OBJECTID, and NIEGHBORHO. Double-click on “NEIGHBORHO” to enter it into the bottom field.
  7. Click on the “=” button to put an equals sign after Name. Then Click the “Get Unique Values” Button. All the names of SF neighborhoods should appear in the middle field. Scroll down to Downtown/Civic Center and double click on it. Push “OK.”

Note: syntax is crucial here.

Now, the Downtown neighborhood of San Francisco should be selected in a light turquoise

MAKING A NEW LAYER

  1. From the table of contents, with the Downtown neighborhood selected, right click on planningNeighborhoods, and select “Data” and “Export Data.”
  2. Make sure the Export Field says “Selected Features.
  3. Rename the output shapefile as “downtownSF,” and save it in your lab2 folder
  4. In the save dialogue box, change the save as type to “shapefile”
  5. Select “yes” when prompted to add the newly created layer to your map document.
  6. Click the “clear selected features” button to remove the turquiose selection color.

PART IV:ADDING POINT DATA and MORE SELECTION TOOLS

  1. Check the box next to the “sfpdStations” to your map.
  2. From the icons under table of contents, click on the fourth icon from the left. This brings up a screen where you set the layers which the program is allowed to select features from.
  3. Make sure the “sfpdStations” layer is selectable. This is indicated by the turquoise and white box being in color. In the image below, all layers are selectable except for the sfShoreExt. In addition to the selectable and not selectable distinctions, the icon is greyed out in the sfShoreExt. Clicking on that icon changes a layer from selectable to not selectable.
  1. Click back on the first icon to return to the layer list.
  2. From the top toolbar, click on the selection menu and then click on “Select by Location.” We will be selecting features from the “sfpdStations” layer, and the spatial selection method where “target layer(s) features are within the source layer features” where the source layers is the “downtownSF” features layer. Click OK.
  3. Save the selected locations as a new shapefileby right clicking on the sfpdStations layer and selecting data then export data. You are exporting the selected data and exporting it into a whole new shapefile. Call this new shapefile: “downtownSfpdStations.”

PART V: MODIFYING SYMBOLS

Instead of dots, let’s change the symbol for police stations to something more interesting.

  1. Left click on the dot in the Table of Contents menu, currently symbolizing for sfpdStations.
  2. From the new window, enter police into the search box at the top of the screen. A variety of different symbols will appear; select one from these options.
  3. After selecting one, you will need to adjust the size of the symbol to properly fit to your map.
  4. Select a different symbol or change the color of the one you selected to have the downtown police station stand out from the other stations.

PART VI: LABELING DATA ON A MAP

  1. Right click on the downtownSF layer. From the menu, select “Label Features.” The downtown neighborhood is labeled.
  2. To change the format of the label, right click on the downtownSF layer again. Select “Properties.” Then go to the “Labels” Tab. There are a number of possible changes to make regarding how you label your map. Experiment. Feel free to label other items of interest in your map document.
  3. To move or further manipulate the label, right-click on downtownSF and select ‘Convert Labels to Annotation…’. Store the annotations ‘In the map’ and click Convert. The label is now a text box that you have full control over.

PART VII: CREATE A LAYOUT FOR YOUR MAP

Remember to include all map elements: Title, Legend, North Arrow, Scale Bar, change the background color of the frame to a color that resembles water, and Your Name

PART IX: EXPORT YOUR LAYOUT

Export the map as‘YourUCLAID_Lab2.jpg’ to the lab2 folder.

Post to the course webpage.

Fall 2011 GIS Lab 2: Page 1