Updating Areas and Lengths of Features in a Shapefile
by user
Comments
Transcript
Updating Areas and Lengths of Features in a Shapefile
Updating Areas and Lengths of Features in a Shapefile Geodatabases automatically keep track of areas, lengths, and perimeters of features, but shapefiles do not! When you open an attribute table for a shapefile, there may be fields called AREA, PERIMETER, and LENGTH but if you have performed GIS analyses (such as intersect, buffer, dissolve, etc. – functions that modify the shape of the polygons or length of the lines), the values are suspect. Since shapefiles do not automatically update area or perimeters of polygons and lengths of lines, the values in these fields DO NOT record the true area (or perimeter) of the new polygons (or lengths for lines). In a shapefile, these fields must be updated manually. Updating the area, perimeter, and length fields of shapefiles is done in the layer’s attribute table and uses the Field Calculator and a small scrap of Visual Basic for Applications (VBA) software code. Rather than learning VBA, you can just learn how to access the Help explaining this process. In the future, you need only remember how to access the Help to perform the function again. 1. Open the attribute table of the shapefile. 2. If the area, perimeter, or length field does not already exist, use Options > Add Field to create one. For best results, use the Double data type for the field. 3. ArcMap > Help >ArcGIS Desktop Help from the main menu bar. 4. Click the Index tab and type in “area” (see figure on next page). You can also search for perimeter or length to find the Help. 5. Locate the entry “area, calculating for polygons” and double click it. 6. Click on the entry “How to make field calculations” to expand it. 7. Click on the entry “Updating area for a shapefile” to expand and read it (see figure on the third page). 8. Resize and position the windows so that you can see both the Help window and the attribute table side by side. 9. Highlight the scrap of VBA code in the Help window and use Ctrl-C to copy it. 10. Right-click the AREA field and choose Calculate. 11. Check the Advanced box in the calculator window. 12. Paste (Ctrl-V) the code into the large box. 13. Type or copy the final variable name, “dblArea” into the small box at the bottom. 14. As you click the final OK, watch the areas update in the attribute table. Notice that this Help also contains similar instructions for updating perimeters and lengths in shapefiles. This is from ArcGIS Help. Although these instructions differ somewhat from the instructions on the first page, both update shapefile values. Don’t type it, copy and paste code These instructions have been adapted from M. Price, Mastering ArcGIS, 2005 Provided by L. A. Morrissey, RSENR/UVM