Select to view content in your preferred language

ArcPad 10 with NMEA GPS: Auto Populating the Attribute Table

5164
3
11-03-2014 10:58 AM
ChanceAlford
Deactivated User


We are using ArcPad 10 with a NMEA GPS device.  We would like to collect features and populate the attribute table using NMEA values with the following:

Northing Easting PDOP Time

Any ideas?

0 Kudos
3 Replies
RebeccaStrauch__GISP
MVP Emeritus

Chance,

My code is from an older version of ArcPad, and is a custom .vbs script.  There are more parts to this script, and it's calling a few other functions, but this may help.   Warning, this is NOT complete code.

To grab the data, I create the point (objNewPoint), and capture the GPS.X, GPS.Y, GPS.Z and the GPS.Properties("PDOP")  (and SOG = speed on ground...we're in an airplane), that is I capture the GPS info.  For my purposes, I write them to global variables (e.g. PtZ, PtLat, etc) that I pass on to my other script that writes them to the file.

Sub CreatePoint(strLayerName)

'create  location object at gps location

  Dim objNewPoint,PtZ,PtLat,PtLon,PtX,PtY,PtPDOP,PtSOG

  Set objNewPoint = Application.CreateAppObject("point")

  objNewPoint.X = GPS.X

  objNewPoint.Y = GPS.Y

  objNewPoint.Z = GPS.Z

'added to get more accurate data in attribute table

  PtZ   = objNewPoint.Z

  PtLat = GPS.Latitude

  PtLon = GPS.Longitude

  PtX   = objNewPoint.X

  PtY   = objNewPoint.Y

  PtPDOP= GPS.Properties("PDOP")

  PtSOG = GPS.Properties("SOG")

'add feature to shapefile and bring up data entry menu

  If strLayerName = "animals" Then

    If Not Application.Map.AddFeature(objNewPoint) Then

      MsgBox "Error adding GPS Point.",vbExclamation,"Error"

      objToolButton.Click

      Exit Sub

    End If

  Else

'add feature to shapefile, no menu

    If Not Application.Map.AddFeature (objNewPoint,"False") Then

      MsgBox "Error adding GPS Point.",vbExclamation,"Error"

      Exit Sub

    End If

  End If

'populate gps and other hidden fields

  Call PopulateCommonfields(strLayerName,PtZ,PtLat,PtLon,PtX,PtY,PtPDOP,PtSOG)

'clear point object

  Set objNewPoint = Nothing

End Sub

Then, I call another script o write to my shape file  (removed most of the script....by the objRS lines are the most important).

sub PopulateCommonFields(strLayerName,PtZ,PtLat,PtLon,PtX,PtY,PtPDOP,PtSOG)

'*** use to populate the common fields for  shapefile ***'

  Dim objSelLayer, objRS

  Set objSelLayer = Application.Map.SelectionLayer

  Set objRS = objSelLayer.Records

  objRS.Bookmark = Map.SelectionBookmark

'populate common fields

    objRS.Fields.Item("Altitude").value = PtZ

    objRS.Fields.Item("Latitude").value = PtLat

    objRS.Fields.Item("Longitude").value = PtLon

    objRS.Fields.Item("Xcoord").value = PtX

    objRS.Fields.Item("Ycoord").value = PtY

    objRS.Fields.Item("Pdop").value = PtPDOP

    objRS.Fields.Item("PlaneMPH").value = PtSOG

  objRS.Update

  Set objRS = Nothing

End Sub

If you are strictly trying to do this with application builder, I don't have much experience with v8-10....but this may give you a hint on what you need to do.

by the way, my code still runs in 10.x, it was just written in 6.x/7.x.

0 Kudos
HannahFerrier
Deactivated User

Have you looked into using QuickFields? QuickFields allow you to set up values to populate fields in your data automatically - including GPS data. You can build multiple expressions to apply to the one dataset to populate all of the variables you want.

Building your expressions in the Expression Builder - they should look something like this:

pdop.PNG

See the ArcPad Help for more information.

HTH,

Hannah

MosquitoGIS
Frequent Contributor

I know I am a little late in the game here, but more information is always good to have for late comers.  I just recently saw a post that gave a link to here Add XYZ to Table .  If you read in the summary, it is an applet that you can download and open the code for to get all sorts of data from the GPS.  You can chop it up and take what you need.  A really good starting point to get the data you may need if you are doing it via Code.  Rebecca looks like she has it covered, and Hannah suggested the easier route of QuickFields, but here is just another reference for that info as well as some other for accessing GPS data.