Methodological: Arcgis Tips - January 2007
Methodological: Arcgis Tips - January 2007
Methodological: Arcgis Tips - January 2007
Methodological
ArcCatalog
ArcMap
To avoid disrupted layer paths (meaning that ArcMap cannot locate the
layers), set map properties to store relative path names: File>Map
Properties>Data Source Options, click store relative path names (see entry
on disrupted paths).
Saving a map: always use save as to save a map as a new file, rather than
save a changed version of a previous map file, because map files are easily
corrupted.
o Make sure that youve saved relative path names.
o Its a good idea to save a maps layers together in a geodatabase.
Why is there a red exclamation point next to one of the data layers? Because
the paths among the data sets files have been disrupted so that ArcMap
cannot locate the indicated layers.
o Note: An ArcMap project file (.mxd) makes a set of data paths to
integrate data files into a project. Creating a layer attaches paths to a
data file.
o Saving relative path names and saving the relevant data together in a
geodatabase folder reduces (but does not eliminate) the chances of a
disrupted path occuring.
o How to repair a path in ArcMap: right-click the layer>Source>set to
data source>add. Check that the red exclamation point has
disappeared.
o See Help>Repairing Data Sources in ArcCatalog: right-click on the
layer and inspect its source properties. Click Set Data Source button
and orient the layers data source to the appropriate shapefile. Check
that the layer file symbolizes correctly on the map and that it has no
broken links icon in the Table of Contents. Right-click the layer and
Save as Layer File.
If a shapefile wont display correctly, check in ArcCatalog to see that there is
a .prj file with the shapefiles name. If it doesnt, then select or import an
appropriate coordinate system.
Why does a layer have no attribute table? Floating point grids dont have
attribute tables, so check the field type (Properties>Fields).
How to create a group layer, which enables better organization of a maps
layers:
o Right-click Layers in table of contents.
o Click New Group Layer.
o
o
o
o
Right-click the New Group Layer that results and click Properties.
Click General Tab.
Type the group layer name under Layer Name.
Add a layer to the group by clicking Group tab in the Group Layer.
Properties window, clicking the Add button, navigating to and clicking
the shapefile to be added, clicking the Add button again, doubleclicking the group layer name, and clicking OK.
How to join tables keeping only the matching records (i.e. eliminating null
values)? In the Tables Join dialog box, click Advanced options and click
preserve matching records only.
o Alternatively, eliminate the null values by selecting the appropriate
attributes after doing the tables join (but make sure that subsequent
operations are performed on selected features only or select from
currently selected set if you want to analyze these observations only).
o Or create layer from selected features, or, to save the file of selected
features, click Data>Export and click to display on map (clicking
Source at the bottom of the table of contents to display the new
table).
You can display multiple attributes in maps: Properties>Symbology>Multiple
Attributes.
Why cant I do a spatial join, even though theres a common field?
o If youre using a geodatabase, close ArcCatalog.
o Tables cant be joined if either table has spaces in its filename , or if
the common fields both are not string or both are not numeric .
What if I cant calculate after joining tables? Check to see if the data in
question are numeric. Or you may have to Export Data to create a new
shapefile or geodatabase. Or you may have to exit a current editing session.
Why cant I add a new field to my attribute table?
o You cant do so if youve clicked Edit>Start Editing (i.e. if youre in an
editing session), so to add a new field you have to exit the editing
session.
o You may not be able to do so if youve currently selected a subset of
attributes or locations.
o And you cant do so if the table is currently involved in another ArcMap
or ArcCatalog session.
Why cant I perform an editing session (via the Editor toolbar) in ArcMap?
You may not have shapefiles or feature classes on your map, you may have
read-only data on the map, or the layer may be in use elsewhere such as
ArcCatalog.
o You cant edit attribute table fields with raster data.
To change the label texts font, double-click the label with Select
Elements tool and adjust the format.
o If you need to add the name of the city, country, etc., do so using the
New Text tool.
What if theres, e.g., a map with evacuation zones for various categories of
hurricanes but theres no data category for the existing non-evacuation zone?
o To create a non-evacuation zone that permits multi-layered analysis,
create a non-evacuation zone by unioning a map layer of the total area
with the map layer for the evacuation zones.
How to combine count data with spatial zones?
o Select by location: but doesnt preserve sub-zone data (if relevant to
the issue at hand).
o A spatial join: preserves sub-zone data.
To map data after a join, you have to begin the join process by clicking the
layer that contains the spatial data.
To join by location, both layers must be spatial layers.
o Joining by location can also join tables that do not share a common
field, but, again, both must be spatial layers.
How to find the length of, e.g., roads within a spatial zone? Here are three
ways, plus a general point:
o Select by location: that are contained by the spatial zone (but does not
preserve sub-zone data) and click the appropriate column and click
Statistics or, to create table, click Summarize (with sum option).
o An intersect overlay: preserves sub-zone data. Then click the
appropriate column and click Statistics or, to create table, click
Summarize (with sum option).
o A spatial join.
o In general, confirm the consistency of results obtained from select by
location, intersect overlay, and spatial join, and adjust your strategy
accordingly.
Why wont Summarize or Statistics work for a column in the attribute table?
o Check that the data are in numeric, not string, format.
o It may be because you did the calculations while the spatial-data table
and the attribute table were joined.
o You may have to unjoin the tables and do the calculations within the
appropriate table, and then afterwards do the join.
o
Why dont procedures work in ArcToolBox? Make sure that the output box
includes the output paths full path (e.g.,: C\TEMP\.).
How to calculate not equal to? E.g.: income <> 0
How to use the wildcard (*) to select attributes? E.g., if Zoning has various
commercial categories labeled C-1 to C-5: [Zoning]=C*
In Select by Attributes, the Like rootname* option is useful to select related
variables: [District] like Residential*
Why wont my text (i.e. string) field calculation work? Make sure youve
enclosed the variable in double quotation marks.
Why wont my quantitative field calculation work?
o Make sure youve specified the appropriate type (short integer, long
integer, float, double).
If the appropriate specifications for scale and precision dont
work, try eliminating them (i.e. not providing any values at all)
How to create new key fields to permit census joins: see Peters & McDonald,
Unlocking the Census, pages 64-72.
o
o
E.g., the layer Evacuation categories does not have a category for Nonevacuation zones. How to create this category so that multi-layered analysis
is possible? Union Evacuation categories with the map from which it was
originally derived (e.g., Miami Dade blkgrp).
How to combine, e.g., several hazard risk categories of a common scale
(such as flood, erosion, and storm surge, each 1-5) into a combined total
risk category?
o Use ArcToolBox>Analysis Tools>Union flood & erosion=comb1, union
comb1 & storm surge=totalrisk.
o Save totalrisk by exporting it to geodatabase, imp orting the symbology
from totalrisk into the map layer.
o In the attribute table make a new field (long integer) named risk_sum.
Calculate risk_sum to be the sum of the risk attributes from each
hazard risk category.
o Classify risk_sums scale.
o Symbolize the layer with graduated colors.
Editing:
o For tables that dont have associated geographic features, click
Editor>Start Editing, then edit the attribute table (using the Undo
button to undo an edit). Click Save Edits.
o To add features to a coverage, shapefile, or geodatabase, use the
Create New Feature task on the Editor toolbar.
How to eliminate fields in a table (besides using delete):
o Right-click the layer>Properties/Fields>click the variable
name>uncheck the variable name in the visible box>export and save
the table so that the changes are permanent.
How to create longer, more helpful field names than can be made in an
attribute table column? Properties>Fields>Aliases (changing the alias and
exporting the file).
If theres just one map layer, how to use two labels (e.g., state name and
number of vacant housing units in the state):
o Right-click US States>Properties>Labels>Expression (select VACANT from
Label Fields)>Append (so that Expression contains STATE_NAME and
VACANT)>OK
o Right-click US States>Convert Labels to Annotation (store annotation in
the map; create annotation for selected features)>Convert.
Importance of ObjectID field: If your table lacks an ObjectID field, you won't
be able to:
select the features in the layer on the map in any way. You can select records
in the table window, including selecting using an expression in Select By
Attributes, but this selection set is not reflected on the map.
apply a definition query to display only a subset of records or features.
create relates. You can relate to a table without an ObjectID field from a table
with an ObjectID field, however. In this case, the relate can be used by the
Identify tool to list related records. You can't push selections via the relate.
start and edit session and edit the attributes. However you can edit the table
the layer is based on directly on disk, such as in a text editor if the file is a
.txt file. Your changes will then be reflected on the map next time you refresh
the map.
There are several ways of obtaining an ObjectID field for your data.
If you are working with a table of x,y coordinates and displaying them in
ArcMap, you can export the x,y layer to a new feature class. You can also
convert a table of coordinates into a new point feature class in ArcCatalog.
Both of these procedures create a fully functional feature class with an
ObjectID.
You can use the Make Query Table geoprocessing tool, which allows you to
make the table using an OLE DB connection and to specify a column to use
for the ObjectID or to dynamically add the ObjectID.
With some data sources, you can register data with ArcGIS, which will add an
ObjectID field.
Map Making
When your map document is appropriately situated on the template, note the
map scale and zoom control settings, to which you can return if things go off
kilter as you manipulate the map.
Use the layout zoom toolsnot the corresponding tools on the Tools toolbar
when zooming in or panning in Layout View.
10
How to mask census districts that, e.g., protrude into lakes or into the ocean?
Use a water-body map file to mask the offending districts.
How to create MapTips:
o Right-click layer>Properties>Fields tab>select the Primary Display
Field>c lick Display tab>check Show MapTips>OK
If theres just one map layer, how to use two labels (e.g., state name and
number of vacant housing units in the state) for selected features:
o (1) Right-click US States>Label; (2) Format label; (3) Select features; (4)
Labels>Expression (select VACANT from Label Fields)>Append (so that
Expression contains STATE_NAME and VACANT)>OK
o Right-click US States>Convert Labels to Annotation (store annotation in
the map; create annotation for selected features)>Convert.
o Alternative way to label features selectively: use label tool on draw
toolbar.
Spatial Analyst
You can use the Density function to turn a layer of, e.g., categories of
earthquake building damage into a layer of building damage density:
o Select by Attributes the damaged buildings only.
o Spatial Analyst Density function: select damaged buildings as Input
Point or Polyline Features.
o Area units: square kilometers.
o Other parameters as required.
o OK.
When, e.g., converting a GWR-produced coverage to raster, in the conversion
dialog box specify that the raster data receive the coordinate system of the
relevant map.
How to replace areas of one value or value range with another value? Spatial
Analyst>Raster Calculator or Spatial Analyst Tools>Conditional:
CON([District] < 600,600)
How to replace areas of no data with a specified data value? Raster
Calculator or Spatial Analyst Tools>Conditional: CON(ISNULL([District]),625)
How to assign the mean of a set of values to an area? Raster Calculator or
Spatial Analyst Tools>Cell Statistics (mean being one of several options, the
others being median, standard deviation, minimum, maximum, variety):
MEAN([Oct],[Nov],[Dec])
How to truncate floating-point values into an integer (for purposes of
reclassification)? Map Algebra or Spatial Analyst Tools>Math>Trigonometric:
INT([Elevation])
How to slice a value into zones of equal value or equal interval? Command
Window: Slice_3d <in_raster> <out_raster> <number_zones>
{EQUAL_INTERVAL | EQUAL_AREA} {base_output_zone}
See Raster Calculator or Spatial Analyst Tools>Math>Logical commands such
as EQ, NE, GT, GE, LT, LE, AND, OR, XOR, DIFF, IN{list}, OVER, CAND, COR,
CXOR.
How to use Map Algebra to set a mask? Map Algebra or Spatial Analyst
Tools>Conditional: SetNull
How to append raster data sets? ArcToolBox>Data Management>Merge for
discrete data, Data Management>Mosaic for continuous data.
See Spatial Analyst Tools>Generalization commands such as Aggregate and
Region.
11
3D Analyst
Even after I imported a base height, my raster layer file wont preview as 3D
in ArcCatalog: make sure that Preview is set to 3D, then click on the source
raster file and click on the new raster file.
In ArcScene, my raster layer file wont display as 3D:
o Right-click the layer & click View>Refresh.
o Make sure that the layer file has a base height, then if it does either
click Scene layers>Vertical Exaggeration (to synchronize the z-values
with the x,y coordinates) & click the Full Extent icon, or else import a
coordinate system into Scene layers.
What do I do if Ive extruded a layer but its dimensions are much too large?
Try clicking Scene layers>Vertical Exaggeration>Calculate from Extent.
How can I reverse a 3-D effect (so that, e.g., a bulge turns into a
depression)? Layer Properties>Base Heights>Z -Unit Conversion, then change
1.000 to 1.000 (or vice versa).
o Resetting Vertical Exaggeration may prove helpful.
If a layers attribute table contains measured elevations, extrude the layer by
clicking A constant value or expression to set heights, then click
Calculator>Fields, and select the measured elevation.
How to connect an Excel spreadsheet to ArcCatalog (for ArcView 9.0 and 9.1):
o In Windows2000: Start>Programs>Administrative Tools>Data
Sources.
o In ODBC (Open Database Connectivity) Administrator dialog box: click
User DSN tab, then click Add button. Select Microsoft Excel Drive
(*.xls), then click Finish button.
o In ODBC Excel setup dialog box: type data sources name and
description. Clic k Select Workbook. Go to location of Excel data file
and select.
o OK. OK.
o Start Excel and open the spreadsheet. Select the relevant data.
o Insert>Name>Define, and type a name for the selected data. Save.
Quit Excel.
o In ArcCatalog: use database connection and click Add OLE DB
Connection. Select Microsoft OLE DB Provider for ODBC drivers.
o Click User Data Source Name, the select the Excel file from drop-down
list (and use Refresh if necessary). Click Test Connection. OK.
12
How to create new key fields to permit census joins: see Peters & McDonald,
Unlocking the Census, pages 64-72.
MS-Access
U.S. Census
13
How to comp ute population density: see the course instructions for computing
population density.
How to create new key fields to permit census joins: see Peters & McDonald,
Unlocking the Census, pages 64-72.
How to prepare ArcGIS data for the stand-alone GWR program: (1) create
any new variables (i.e. fields), including X-Y centroids, in ArcMap; (2) check
for possible data errors (e.g., sum race categories to make sure that they
add up to the appropriate total); (3) in Excel delete the datas superfluous
fields; (4) for U.S. Census data keep the following fields: an ID field withou
text such as STFID, X-Y centroids, the GWR variables, and (if the model
requires) a statistical weighting variable; (5) save the reduced data set in
Excel with a .csv extension; and (6) enter the data into GWR.
o No field can contain text, so do not include, e.g., the U.S. Censuss
GEO_ID.
o For some reason, Excel works in converting the data for GWR but
StatTransfer seem not to work.
14
sort the ID-variable before saving and reconverting the data for use in
GWR and ArcMap.
Use Bonferroni-type adjustments for significance values unless the analysis is
frankly exploratory.
GWR in Stata: east(varname)=lon (i.e. x), north(varname)=lat (i.e. y).
After converting the output coverage to a points-shapefile in ArcCatalogs
conversion wizard, spatially join the map-shapefile to the points layer.
How to Display a Reduced-Maps Data together with the Original Map?
o Union the reduced map and the original map, then export and save.
o In the unioned and saved map, create a new field for the variable in
question (e.g., PARM_7x as the counterpart to PARM_7, perhaps
field=double, scale=10, precision=4 [because, for some reason, these
seem to work best]).
o Select by Attributes the reduced maps spatial unit-data for the
variable in question, then Calculate Values for the new field from the
original field (e.g., for PARM_7X from PARM_7).
o Select by attributes the original maps spatial units that were not
included in the reduced map, then Calculate Values such as:
PARM_7X=9999 (or some other number that stands out clearly from
PARM_7s values).
o In the table of contents, double-click or right click 9999s color and
change to something neutral.
Add another data classification interval (e.g., from 7 to 8) to
compensate for the loss of an interval to 9999.
Edit the color ramp to compensate for the fact that a neutral
color replaced a strong upper or lower-end color.
o Symbolize the unioned map: Layer>Properties>Symbology>Format
Label>click 9999 and change to Not Analyzed (or something else
appropriate).
o Save the map: File>Save As
o Note: this procedure wont work with kriged maps.
DEM Sources
www.seamless.usgs.gov
15
Click OK
From within the attribute table, click Options/Export (i.e. not from a layer
in the table of contents but from within the attribute table itself). Then list
the path and type a name for a newly created table containing the centroids.
Click Tools (not ArcToolBox!)>AddXY Data, and specify the projection of the
original data from which the centroids were derived. This will change the
centroids dots from one to two dimensional.
o Via Symbology for the centroids layer you can adjust the symbol size
and color, including to one-dimensional black dots (e.g., smaller size
may display better on map).
16