This code allows you to take a table of X, Y coordinates in DMS (degrees, minutes, seconds) and create a layer in ArcMap. The input form for the command includes the specifying of a spatial reference to use in correctly positioning the points.

How to use:
  1. Start ArcMap and add some data to the map. Make sure a valid spatial reference is defined.
  2. In the Customize dialog, click on 'Add from file' and select this sample's dll.
  3. Under the Commands tab of the Customize dialog, select the "Add XY (DMS) Data" command from the 'Developer Samples' category, and drag it on to a toolbar. Dismiss the Customize dialog.
  4. Select the command to display the input dialog.
  5. Browse for a table containing X, Y coordinates in DMS format.
  6. Specify the fields containing the X,Y coordinates and the appropriate delimiters.
  7. Check the Spatial Reference (the coordinate system of the current data frame is used by default), and change if necessary.
  8. Specify a layer name to use and click the OK button.


Requires: A data frame with a defined coordinate system and a table of X,Y coordinates in DMS format.

Difficulty: Intermediate

Visual Basic
File Description
frmXYEvent.frm Input form for specifying the parameters.
WindowStuff.bas Basic module containing windows positioning routines.
clsXYEvents.cls Class file containing the command button code.

Key CoClasses: StandaloneTable, XYEvent2FieldsProperties, XYEventSource
Key Interfaces: IStandaloneTable, IXYEvent2FieldsProperties, IXYEventSource
Key Members: IStandaloneTable::Table, IXYEvent2FieldsProperties::XFieldName, IXYEvent2FieldsProperties::YFieldName, IXYEventSource::EventProperties, IXYEventSource::SpatialReference