Select to view content in your preferred language

Coordinates transformation in ArcGIS Engine

622
3
09-30-2011 01:53 PM
RoderickIglesias
Emerging Contributor
Hi there,

I'm geeting this from my gps:
$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,

this is read this way:
UTC Time: 09:23 13.299
(A) Data is valid
Latitude: 22°38.8947???,North
Longitude: 113°55.2253???,East
Speed: 0.00 (sea mile) 1mile=1852meter
Course: 311.19
Date: 01032007

There is a way to transform the latitude and the longitude directly in ArcGIS Engine so the ArcGIS Desktop read it with no problem?

Thanks in advance.

Greetings...
0 Kudos
3 Replies
JeffMatson
Frequent Contributor
Hi there,

I'm geeting this from my gps:
$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,

this is read this way:
UTC Time: 09:23 13.299
(A) Data is valid
Latitude: 22°38.8947�?�,North
Longitude: 113°55.2253�?�,East
Speed: 0.00 (sea mile) 1mile=1852meter
Course: 311.19
Date: 01032007

There is a way to transform the latitude and the longitude directly in ArcGIS Engine so the ArcGIS Desktop read it with no problem?

Thanks in advance.

Greetings...


You can use the Strings.Split method to split the $GPRMC sentences into separate words, e.g.
 
PrivateSub commEvents_DataReceived(ByVal sender AsObject, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles commEvents.DataReceived
Dim strInput as String = comm3.ReadLine   
Dim words() As String
Dim i As Integer
'split the input into words
words = Strings.Split(strInput, ",")
For i = 0 To 9
Select Case i
Case 1
strUTCTime = words(i)
Case 2
strValid = words(i)
Case 3
strLat = words(i)
Case 4
strNS = words(i)
Case 5
strLon = words(i)
Case 6
strEW = words(i)
Case 7
strSpdKnots = words(i)
Case 8
strHeading = words(i)
Case 9
strUTCDate = words(i)
End Select
Next i
 
'...
'etc
'...
End Sub
0 Kudos
RoderickIglesias
Emerging Contributor
Hi Jeff, thanks for your post...

I already got the part that make the split when the string  gets to the server.

The post that I wrote focus on the longitude and latitude that came in this form:
2238.8947,N,11355.2253,E

and is read in this way:
Latitude: 22°38.8947�?�,North
Longitude: 113°55.2253�?�,East

I need to transfom the coordinates from DMS to Decimal Degrees.

Sorry if I wasn't specified enough before.
0 Kudos
JeffMatson
Frequent Contributor
Hi Jeff, thanks for your post...

I already got the part that make the split when the string gets to the server.

The post that I wrote focus on the longitude and latitude that came in this form:
2238.8947,N,11355.2253,E

and is read in this way:
Latitude: 22°38.8947�?�,North
Longitude: 113°55.2253�?�,East

I need to transfom the coordinates from DMS to Decimal Degrees.

Sorry if I wasn't specified enough before.


It looks like your Lat/Long is in Decimal Minutes, so first split them out into the individual units:
22 (Degrees)
38.8947 (Decimal minutes)

Then divide the decimal minutes by 60 and add it back to the degrees:
(38.8947 / 60) + 22 = 22.648245 decimal degrees


'parse the Lat/Lon input into whole degrees and remainders (decimal minutes in this case)
strLatDeg = Strings.Left(strLat, (Strings.InStr(strLat, ".") - 3))
strLatRem = Strings.Right(strLat, Strings.Len(strLat) - (Strings.InStr(strLat, ".") - 3))
strLonDeg = Strings.Left(strLon, (Strings.InStr(strLon, ".") - 3))
strLonRem = Strings.Right(strLon, Strings.Len(strLon) - (Strings.InStr(strLon, ".") - 3))
'convert the strings into double and divide the remainder by 60
dblLatDeg = CType(strLatDeg, Double)
dblLatRem = CType(strLatRem, Double) / 60
dblLonDeg = CType(strLonDeg, Double)
dblLonRem = CType(strLonRem, Double) / 60
'put into decimal degrees
Lat = dblLatDeg + dblLatRem
Lon = dblLonDeg + dblLonRem
0 Kudos