Adds a point to the editable point layer of the current map.
object.AddFeatureXY ( X, Y [,ShowForm] ) |
- x
- Required. A Double that represents the X coordinate of the point, in the coordinate system of the current map.
- y
- Required. A Double that represents the Y coordinate of the point, in the coordinate system of the current map.
- ShowForm
- Optional. A Boolean that specifies whether to display the feature properties dialog box (or edit form) after adding the feature.
Boolean
ShowForm is a boolean specifying whether to display the feature properties dialog box (or edit form) after adding the feature. Default is true. [Optional].
Be sure to confirm there is an editable point layer in the current map before calling AddFeatureXY. This can be accomplished via the EditLayer property of the Map object. Calling AddFeatureXY when there is not an editable point layer will cause ArcPad to crash.
Snapping will not be applied to a feature added via this method. The feature will added at the location specified by the X and Y arguments.
Adds a new point with the coordinates of the current GPS position to the layer GPSPoints.
AddFeatureXY Example (VBScript) | Copy Code |
---|---|
Sub AddGPSPoint 'Check if the layer can be made editable If Not Application.Map.Layers("GPSPoints").CanEdit Then MsgBox "GPSPoints cannot be edited.",vbExclamation,"Error" Exit Sub End If 'If the layer is not already editable, make it editable If Not Application.Map.Layers("GPSPoints").Editable Then Application.Map.Layers("GPSPoints").Editable = True End If 'Attempt to add a new point to the currently editable point layer at the current GPS location 'Return an error message if the attempt fails If Not Application.Map.AddFeatureXY(Application.GPS.X, Application.GPS.Y) Then MsgBox "Error adding GPS Point.",vbExclamation,"Error" Exit Sub End If End Sub |
AddFeatureXY Example (JScript) | Copy Code |
---|---|
function AddGPSPoint() { //Check if the layer can be made editable try { if (!Application.Map.Layers("GPSPoints").CanEdit) { Application.MessageBox("GPSPoints cannot be edited.",apExclamation,"Error"); return; } } catch (e) { Application.MessageBox("Error accessing GPSPoints layer.\nError is: " + e) return; } //If the layer is not already editable, make it editable if (!Application.Map.Layers("GPSPoints").Editable) Application.Map.Layers("GPSPoints").Editable = true; //Attempt to add the new point to the currently editable point layer at the current GPS location //Return an error message if the attempt fails if (!Application.Map.AddFeatureXY (Application.GPS.X, Application.GPS.Y)) Application.MessageBox("Error adding GPS Point.", apExclamation, "Error"); //Clean up objNewPoint = null; } |