Lecture ERS 120: Principles of GIS - Practice 2: Working with tables - N.D.Bình

Notice how the relevant 'states' attributes have now been added to the 'cities' table. The tables have not been physically linked and the results are only visible in this form within ArcView. To save the new table it either has to be exported and re-imported; or add new fields and use the 'calculator' to input the information. To return the table to its previous form select 'Remove All Joins' from the 'Table' menu. You can now close ArcView - there is no need to keep any of the files you have created within this practical. The use of 'spatial' joins will be examined in next practical session – where by joins are instigated not by common fields within tables but by features occupying the same geographical area within the view display. In this practical you've seen how it is possible to open, edit and save a table associated with a theme, highlight records in either a table or a view, how to query a table and see how to join tables based on linking common fields. We will use these principles later to promote geographical knowledge.

pdf5 trang | Chia sẻ: thucuc2301 | Lượt xem: 662 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Lecture ERS 120: Principles of GIS - Practice 2: Working with tables - N.D.Bình, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Practice 2: Working with tables ArcView Steps .................................................................................................................. 8  Step 1 Opening data .................................................................................................... 8  Step 2 Table properties ............................................................................................... 9  Step 3 Adding data to the table ................................................................................... 9  Step 4 Simple table functionality ............................................................................... 10  Step 5 Selecting features........................................................................................... 10  Step 6 The query builder ........................................................................................... 10  Step 7 Creating new tables ....................................................................................... 11  Step 8 Joining tables ................................................................................................. 11  In this practical you will discover how to open, edit, create and work with tables. Firstly, you will need to start ArcView, start a new project, add a view and set the working directory (to 'c:\') as demonstrated in the last practice. An ArcView project can contain any number oftables - to see which tables are in a project click onthe tables' icon in the 'project window'. ArcView Steps Step 1 Opening data Click the Add Theme button. Navigate to the directory for 'c:\arcv32\arcview\esridata\usa'. Select the following theme:- 'states.shp'. Click OK. This theme will now be added to your view. We are going to edit data within the theme and do not want to overwrite the original file and so we will have to make a copy ofthe data. Make sure the 'states' theme is active by clicking on the theme in the legend (the area will appear raised or 3-D). Go to the 'Theme' menu and select 'Convert to Shapeflle' - as illustrated below:- Call the converted theme 'States' and save it to you u directory. We no longer require the Practice 2: Working with tables ERS 120: Principles of GIS N.D. Bình 9/59 original data - so make the theme active, then go to the 'Edit' menu and select 'Cut Theme.'. Now make the new 'States' theme active and then click on the 'Open Theme Table' button ( ). You should now see all the attribute information relevant for the states theme. Each record (row) represents one state and each field (column) is a variable containing information appertaining to the states. You can use the scroll bars to either scroll down or up to see more records, or scroll right and left to examine the various fields. Step 2 Table properties We are now going to change the table name and edit the fields that are visibl e to us speeding up display of the table within ArcVi ew. Go to the 'Table' menu and select 'Properties'. We can rename the title of the table - let's call it 'American States'. Next, in the visible column click to uncheck all apart from the following: Shape; Area; State name; Pop1990; PopI1997; and Pop90 sqmi. Don't click on the OK just yet. All the other fields will now no longer appear in the table display - although they have NOT been deleted from the database- we just can't see them. Find the field called 'Pop90 sqmi' within the table properties dialog box. Click in the 'Alia.' column next to this entry and type 'Population density 1990'. -Then click OK for your changes to take effect. The field name we changed is now too long to fit within the display properly. We can ext end the size of the field by moving the mouse over the edge of the field name and by clicking and holding the left- mouse button (see figure below), then move the mouse to extend the fields visible area. We can also re-arrange the order of the fields. Click on the name at the top of the column and drag it right or left. This doesn't re- arrange the table itself-just how we see it within ArcView. Experiment by changing the order of the fields. Step 3 Adding data to the table Firstly, we have to start editing the table, go to the 'Table' menu and select 'Start Editing'. To add a field, go to the 'Edit' menu and select 'Add Field'. Type the name of the attribute - in this case 'Pop change' Under 'Type' you can choose the type of data you will be entering: 'Number' for numerical entries; 'String' for text (word) information; or 'Boolean' for true/false entries. We are entering numbers for this field. The 'width' corresponds to the number of characters that can fit within the field, for example 'xxxx' occupies 4 character spaces. Indicate the number of decimal places required - we do not require them so leave it as the default of '0'. Click 'OK' - you should now see your new column added to the right side of the table. Click on the 'Edit' button ( ).We are now ready to enter data into the table. We could do it manually by hand but there are 51 records in this table (shown in the top left hand side ) and so an automated data entry would be much quicker. Make sure the field title (pop_change) is highlighted - it should appear a darker grey than the other field titles), then click on the 'Calculate' button ( ). This will allow us to write an equation that ArcView will solve and enter into the column. We require population change and so double click on the following; 'Pop1999' from the fields list; '-' from the requests; and then on the field 'Pop 1990', Your display should now resemble the figure below. Click on 'OK' to start the calculations. After a few seconds you should see the results fill the 'Pop_change' Practice 2: Working with tables ERS 120: Principles of GIS N.D. Bình 10/59 column. Once finished choose 'Stop Editing' from the table menu and save your edits. Step 4 Simple table functionality We can sort each field either in ascending or descending order using the following buttons ( ). The find record button ( ) can be used to find the first record whose data items contain the input character/numeric string. For example try searching for 'New York' to find the appropriate record. Step 5 Selecting features • a) Select button - use this button to commence 'selection mode' • b) Edit button - click on this to be enable edit mode to input into the table • c) Identify - used to view record fields within vertical viewing box You can select records in the table to work with them. Sort the 'Population_change' field by descending order. Click on California's record (remember you must be in selection mode using the 'Select Button' illustrated at the top of the page) – notice that it is now highlighted yellow - this means the record is selected. If you now look within 'View1' (you may have to minimise the table), the geographical state of California will also be highlighted yellow. We can select multiple records within the table by holding down the 'shift' key while clicking on records. Selecting records can also work the other way round - by selecting states within the view, corresponding records in the table will be highlighted. Click on the 'Select Feature' tool ( ),and then click on a state within the view - the record will now be highlighted within the table. Multiple records can be selected by holding the mouse button when using the 'select feature' tool. Select the states of Alaska and Hawaii (see below) and return to the table. The selected features may not necessarily be visible, so to move the selected records to the top of the table click on the 'Promote' button ( ). If you now click on the 'Switch Selection' button ( ) the highlighted records will be unselected and those that were previously selected will now be highlighted. To select all the records within the table use the 'Select All' button ( ). When you have finished examining the possible ways of selecting records, choose the 'Select None' button ( ) to deselect all records. Step 6 The query builder Feature selection can also be accomplished using an SQL (Structured Query Language) expression using the database fields and values. Click on the 'Query Builder' button ( ) or select 'Query' from within the 'Theme' menu. Double click on the field to query; then single click an operator; and double click on either a value or manually type the required criteria. Options within the 'query builder' include: > Update values: lists and updates all unique values in the chosen field > New set: New selection set - features not m the set are unselected > Add to set: Adds features to existing selected set > Select from set: Selects from existing selected set Use the query builder to select all the states that have suffered a decrease in the population Practice 2: Working with tables ERS 120: Principles of GIS N.D. Bình 11/59 between 1990 and 1997. You can also build a character string query by using double quotations and wildcards (*), for example: Find all states that begin with the letter A ( [Statename1= "A*") Find all states that contain the letter A ( [Statename1= "*A*") Remember to click on the 'New Set' button to create a new selection or 'Add to set' to add this new query to a previous query selection. Experiment using the two different options (for example select all states beginning with "A" using a new set, and then add all stat es beginning with "N"). Try these examples and think of some for yourself. Once you have finished experimenting with the query builder and the use of wildcards - use the 'Select None' button to clear selected features from both the database (table) and graphical (the VIew) displays. Step 7 Creating new tables To create a table from scratch - click on the 'new' button within the 'project window ' and create a new table called 'cities' in your c directory. Once the blank table has opened click on 'Add Field' within the 'Edit ' menu. Repeat to create the following fields: Now go to the 'Edit ' menu and select 'Add Record'. Repeat this to enter the following information (note ArcView is case-sensitive so us e capital1etters exactly as shown below): Step 8 Joining tables You can join a second table to the active table, based on the values of a common field found in both table s. Joins establish a one-to-one, or many-to-one relationship between the destination Practice 2: Working with tables ERS 120: Principles of GIS N.D. Bình 12/59 table (the active table) and the source table (the tab le you are joining into the active table). Typically, the source table contains descriptive attributes of features that you wish to join into a themes table so that you can symbolise, label, query and analyse the features in the theme using the data from your source table. Joins can be accomplished using any data type (String, Number, Boolean or Date). We are now going to join the ' states' and ' cities' tables. Open the ' states' table and then click on the 'State _name' field header (see figure 1 below), then open the ' cities' table and select the 'State_name' field header (see figure 2). Note how now the 'Join' button ( ) is no longer greyed out - click on it. If the 'Join' button is not available then it is most likely because one of the tables is still being edited. The two table s should now be joined - as illustrated within figure 3 below. Notice how the relevant 'states' attributes have now been added to the 'cities' table. The tables have not been physically linked and the results are only visible in this form within ArcView. To save the new table it either has to be exported and re-imported; or add new fields and use the 'calculator' to input the information. To return the table to its previous form select 'Remove All Joins' from the 'Table' menu. You can now close ArcView - there is no need to keep any of the files you have created within this practical. The use of 'spatial' joins will be examined in next practical session – where by joins are instigated not by common fields within tables but by features occupying the same geographical area within the view display. In this practical you've seen how it is possible to open, edit and save a table associated with a theme, highlight records in either a table or a view, how to query a table and see how to join tables based on linking common fields. We will use these principles later to promote geographical knowledge. Last modified: Oct 25, 2009 ERS 120: Introduction to Geographic Information Systems /

Các file đính kèm theo tài liệu này:

  • pdfprac02_tables_658_9869_2053320.pdf