Populating an Edit Form with Easting & Northing Coords

917
5
09-16-2010 04:24 PM
stuartcassin
New Contributor III
As a dedicated non scripter, I'm trying to create an editform that automatically populates an easting and northing control on the form. I know that vb scripts are easily created to do that using the "updateformfromshape" call, but I have no idea where or how to start.

Can anyone supply the code or at least point me in the right direction?

Thanks in advance

Stuart Cassin
Tags (3)
0 Kudos
5 Replies
EricHajek1
Occasional Contributor
If you do a search in the "customizing arcpad" help for "Project Example", it'll be the eigth one down the list. It's basically an example script on how to project from one coordinate system to another, which is a pretty good place to start.

However, if your map is in the coordinate system whose easting and northing you want to retrieve, you could just pull those values from the feature itself like this:

Dim objSH
Set objSH = Application.Map.Editlayer.Records.Fields.Shape 'Sets the objSH variable to the currently being edited feature's "shape" which contains the X / Y coords.
EditForm.Pages("thePage").Controls("theEastingComboBox").value = objSH.X
EditForm.Pages("thePage").Controls("theNorthingComboBox").value = objSH.Y

You could put the above (modified to suit your project of course) in the onload event of your editform I think. If that doesn't work (which might be the case because the feature hasn't been saved yet, and therefore has no "shape" to reference until OK is hit, I don't remember), then try and just use Map.PointerX and Map.PointerY to get a reference to the current location. They'll be set to the current feature's location if you just used the "create point at GPS location" button.

Hope this helps,
Eric

EDIT: I have no idea how this would work for features that get thier position via averaging or post-processing. Might be easier to just calculate them after the fact in ArcMap unless the field crew really needs to see the exact values.
0 Kudos
stuartcassin
New Contributor III
Thanks for the feedback Eric,

Unfortunately it didn't work and I don't know how to use Map.PointerX / Map.PointerY. As I said, complete novice in scripting so I'm really at a loss as to how to get this going.

Stuart Cassin
0 Kudos
stuartcassin
New Contributor III
Back again. Still trying to get these X Y coord fields populated using Map.Pointer X/Y and really struggling.

I'd really appreciate anyone who could give me some PLAIN ENGLISH instructions on how to achieve this or a sample code. All I'm trying to do is put the X & Y coords of where the screen has been touched into an edit form.

Thanks

Stuart Cassin
0 Kudos
MichaelKraus
New Contributor III
Back again. Still trying to get these X Y coord fields populated using Map.Pointer X/Y and really struggling.

I'd really appreciate anyone who could give me some PLAIN ENGLISH instructions on how to achieve this or a sample code. All I'm trying to do is put the X & Y coords of where the screen has been touched into an edit form.

Thanks

Stuart Cassin


Hi Stuart,

I use the following and no further code is required.  It also puts the easting and northing into the shapefile fields with the same name (long integer / double / etc).

The following is part of the ArcPad form (.apl file) for your shapefile being edited.

<EDIT name="txtEasting" x="1" y="86" width="40" height="12" defaultvalue="Map.PointerX" tooltip="" tabstop="true" border="true" field="EASTING"/>
<EDIT name="txtNorthing" x="42" y="86" width="40" height="12" defaultvalue="Map.PointerY" tooltip="" tabstop="true" border="true" field="NORTHING"/>

Regards,

Michael Kraus.
0 Kudos
stuartcassin
New Contributor III
Hi Michael,

This worked perfectly - thanks!!

Regards

Stuart Cassin
0 Kudos