I have an Applet that automatically updates certain fields every time my user collects data. It was based on the XYZ+ script. My data is projected in UTM, but my users want to be able to record DMS as well. I found a script on the 15th page of http://arcscripts.esri.com/Data/AS15207.pdf that converts to DD.dddd. This is fine and it works great until I try and move it to my Nomad, because there is no C: drive. How do I reference a file at say "\\My Documents\gis\Coordinate System\NAD 1983 UTM Zone 15N.prj" ? "\" being the root directory.Here's my code:Sub FA Set objRS = Map.Selectionlayer.Records objRS.Bookmark = ThisEvent.Bookmark 'define coordinate systems Set pLLCS = Application.CreateAppObject( "CoordSys" ) Set pMCS = Application.CreateAppObject( "CoordSys" ) 'Set up Coordinate Systems \\\\\-----This is where the problem is-----/////////// pMCS.Import("\\My Documents\gis\Coordinate System\NAD 1983 UTM Zone 15N.prj") pLLCS.Import("\\My Documents\gis\Coordinate System\North American Datum 1983.prj") 'Create Map Points and assign coordinate systems Set pMapPt = Application.CreateAppObject("Point") Set pLLPt = Application.CreateAppObject("Point") Set pMapPt.CoordinateSystem = pMCS Set pLLPt.CoordinateSystem = pLLCS 'Set x/y values for original point pMapPt.X = objRS.Fields.Shape.X pMapPt.Y = objRS.Fields.Shape.Y 'transpose the coordinate to lat long Set pLLPt = pLLCS.Project(pMapPt) For Each f in objRS.Fields Select Case Ucase(f.name) CASE "LATSTRING" f.Value = DMS(pLLpt.Y, "y") CASE "LONSTRING" f.Value = DMS(pLLpt.X, "x") End Select Next objRS.Update Set pMapPt = Nothing Set pLLPt = Nothing Set pMCS = Nothing Set pLLCS = Nothing Set objLyr = Nothing Set objRS = Nothing End Sub Function DMS(v, xy) absV = abs(v) degInt = Floor(absV) min = multDenom(absV, degInt) if xy = "x" then degInt = degInt * -1 end if minInt = Floor(min) sec = round(multDenom(min, minInt),4) DMS = degInt & " " & minInt & " " & sec End Function Function Floor(d) dTmp = Round(d) if dTmp > d then dTmp = dTmp - 1 End if Floor = dTmp End Function Function multDenom(d, dInt) d = d - dInt multDenom = d*60 End Function
The code works fine. I just want to include it in case anyone else is trying to do the same thing, or has suggestions on more efficient way. On the desktop I just change 2 lines to: 'Set up Coordinate Systems pMCS.Import("C:\Program Files (x86)\ArcGIS\ArcPad10.0\Coordinate System\Projected Coordinate Systems\UTM\NAD 1983\NAD 1983 UTM Zone 15N.prj") pLLCS.Import("C:\Program Files (x86)\ArcGIS\ArcPad10.0\Coordinate System\Geographic Coordinate Systems\North America\North American Datum 1983.prj")
So how do I reference paths on mobile devices that do not have a root drive letter?