You are here:
Mapping and visualization
>
Working with layers
About adding x,y coordinate data as a layer
Note:
This topic was updated for 9.3.1.
In addition to data sources, such as a shapefile, you can also add tabular data that contains geographic locations in the form of x,y coordinates to your map.
X,y coordinates describe discrete locations on the earth's surface such as the location of fire hydrants in a city or the points where soil samples were collected. You can easily collect x,y coordinate data using a device.
To add a table of x,y coordinates to your map, the table must contain two fields, one for the x-coordinate and one for the y-coordinate. The values in the fields may represent any coordinate system and units such as latitude and longitude or meters.
The fields must be numeric for them to be displayed. For example, if the coordinate value is stored in degrees, minutes, and seconds in a field (for example, -120 13 58), you'll need to convert the values to decimal degrees and store them in a numeric field. In addition, some characters in field names are not supported, for example, dashes (such as x-coord for the field name), spaces, and brackets. Before adding x,y data, you should edit the field names to remove these characters. For example, you can use the underscore character instead of the dash character in field names.
Once you have added the data to your map, it becomes an XY event layer and behaves like other point feature layers. For instance, you can decide whether you want to display it, symbolize it, set the visible scale, or display a subset of features that meet some criteria.
XY event layers and ObjectID fields
If the table on which an XY event layer is based does not have an ObjectID field, you won't be able to perform certain tasks on the layer. Delimited text files or tables from OLE DB connections are some examples of tables without ObjectID fields.
Without an ObjectID field, you will not 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. However, you can select features in such an XY event layer if you use one of the geoprocessing tools like Select, because those tools create an output feature class (with an ObjectID field) containing the resulting selection.
- Perform operations that utilize the selection set such as navigating from the table to the map.
- Edit the attributes of the layer. 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—including changing the x,y coordinates of the point features. Your changes will then be reflected on the map next time you refresh the map.
Note that you can start an edit session on an XY event layer if the table it is based on has an ObjectID field and if the data source is editable. This will let you edit the layer's attributes in the table window including editing the x,y coordinate fields manually to change the location of the points in the layer.
- Perform any interactive edits, such as select their points in an edit session and move them around, delete them, add new points, and so on, on any XY event layer. This is true whether or not the table it is based on has an ObjectID field.
- Define a relate.
If you want to be able to perform these tasks, you can
export the x,y layer to a new feature class or convert a table of coordinates into a point feature class in ArcCatalog. Both of these procedures create a fully functional feature class with an ObjectID. In addition, 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 dynamically add the ObjectID.
Learn more about ObjectID fields
Converting degrees/minutes/seconds to decimal degrees
To create a point layer from x,y coordinates, the coordinates need to be in decimal degrees. There are several ways to convert degree/minutes/seconds (DMS) data into decimal degrees.
To convert it manually, use the following formula:
Decimal Degrees = Degrees + ((Minutes / 60) + (Seconds / 3600))
For example, 75 59 32.483 W would be -75.9923564 in decimal degrees. DMS is often followed by the hemisphere labels of N, S, E, or W. When converting to decimal degrees, convert longitude values that are in the western hemisphere or latitude values that are in the southern hemisphere to negative decimal degree values.
You can also use an advanced expression in the Field Calculator or use programming to perform the conversion automatically. You can find several sample scripts on edn.esri.com.
How to add x,y coordinate data as a layer
Adding x,y coordinate data as a layer
- Click the Tools menu and click Add XY Data.
- Choose a table that contains x,y coordinate data. If the table is not on the map, click the Browse button to access it from disk.
- Click the X Field drop-down arrow and click the field containing x-coordinate values.
- Click the Y Field drop-down arrow and click the field containing y-coordinate values.
- Click Edit to define the coordinate system and units represented in the x and y fields.
The x,y coordinates will be automatically transformed to match the coordinate system of the data frame.
- Click OK.
- To add x,y data, your coordinates need to be in the projected units or decimal degrees.
- Check the Warn me box if you want to know when the new x,y layer has limited functionality because it does not have an ObjectID field. Without an ObjectID field, you will not be able to make selections, perform relates, edit it, or symbolize it in certain ways. However, you can create a new feature class from this data and be able to perform those tasks.
- To create a permanent dataset (which will have an ObjectID), export your x,y layer to a new feature class. Right-click the x,y layer in the table of contents, point to Data, and click Export Data. To learn more, see Exporting features.
- You can also create a new feature class from the x,y data in ArcCatalog. See the task below for more information.
|
Exporting the x,y layer to a new feature class
See Exporting features.
Creating a point feature class from x,y coordinates
- Right-click a table in the Catalog tree that has columns containing coordinates, point to Create Feature Class, and click From XY Table.
- Click the X Field drop-down arrow and click the name of the column that contains the x-coordinates.
- Click the Y Field drop-down arrow and click the name of the column that contains the y-coordinates.
- If appropriate, click the Z Field drop-down arrow and click the name of the column that contains the z-coordinates.
- Click Spatial Reference of Input Coordinates and define the coordinate system for the input values as necessary.
- Click the Browse button.
- Click the Save as type drop-down arrow and click the format in which to create the new point features.
- Navigate to the folder or geodatabase in which you want to store the new features.
- Type a name for the new data source.
- Click Save.
- Set any Advanced Geometry Options and ArcSDE configuration keywords as necessary.
- Click OK.
A new point data source is created in the appropriate location.