Select to view content in your preferred language

Retrieve XY Coordinate

2046
2
08-25-2010 05:49 AM
JayKappy
Frequent Contributor
I have a project that I am creating that I need to get the XY from a point that has just been created.
Example:  THe user adds a new point feature in ArcPAD.  I need to write the XY to varaible...a message box would be fine as well as I woudl be able to write that to a variable eventually.

I am trying this and keep getting 0 for the X value

Any thoughts on how to retrieve the XY....NOTE this is before the feature gets saved...so its a pending XY value

THanks in advance

Dim objRS4, objSelLayer4, objEFPageOneControls4, objEditForm4
Set objSelLayer4 = Map.SelectionLayer
Set objRS4 = objSelLayer4.Records

objRS4.Bookmark = Map.SelectionBookmark

Set objEditForm4 = application.map.layers("Supports").forms("EDITFORM")
MessageBox "The X coord is " & objEditForm4.Fields.Shape.X
Tags (3)
0 Kudos
2 Replies
JayKappy
Frequent Contributor
I got this to work but I want my Coordinates in LAt Long....Is there a way to convert these Hennepin County Minnesota Coordiantes to Lat Long

BUT THIS ONLY WORKS on existing points....I cannot get this to work on a new point that was just dropped by the user....Can this be done?

Is there soem point down or point up event that I can use?

Dim objLyr, objRS, pMapPt

'get xy of selected feature

Set objLyr = Application.Map.SelectionLayer
Set objRS = objLyr.Records
objRS.BookMark = Map.SelectionBookmark

Set pMapPt = Application.CreateAppObject("Point")
pMapPt.X = objRS.Fields.Shape.X
pMapPt.Y = objRS.Fields.Shape.Y

objLyr.forms("EDITFORM").Pages("PAGE1").Controls("txtX").value = cstr(pMapPt.X) 
objLyr.forms("EDITFORM").Pages("PAGE1").Controls("txtY").value = cstr(pMapPt.Y) 
0 Kudos
by Anonymous User
Not applicable
Here are afew lines from a tool I have written in the past. This explains populating a field/control with eastings and northings base don whether the user map clicks or uses the GPS. It doesn't answer your question about lat and long, but I'm sure it's possible...

If Application.UserProperties ("AddPoint_ToolUsed")="addpoint" then
  objEFPageOneControls("EASTING").value = FormatNumber(Map.PointerX,2,-2,-2,0)'FormatNumber(Map.PointerX,2)
  objEFPageOneControls("NORTHING").value = FormatNumber(Map.PointerY,2,-2,-2,0)'FormatNumber(Map.PointerY,2)
  Application.UserProperties ("AddPoint_ToolUsed")=""
else
  objEFPageOneControls("EASTING").value = FormatNumber(GPS.X,2,-2,-2,0)'FormatNumber(GPS.X,2)
  objEFPageOneControls("NORTHING").value = FormatNumber(GPS.y,2,-2,-2,0)'FormatNumber(GPS.Y,2)
end if
0 Kudos