# Converting ISO 6709 Formatted GPS Coordinates to Decimal Degrees in R

We have a piece of equipment that outputs its GPS coordinates as numeric values to file in an ISO 6709 lat/lon format of Lat = ±DDMM.MMMM & Lon = ±DDDMM.MMMM

Are there any packages with functions (or custom functions) in R that will convert this to a Decimal degrees format? (ie: ±DD.DDDDDD & ±DDD.DDDDDD)

An example would be that lat & lon (2433.056, -8148.443) would be converted to (24.55094, -81.80739).

You could read in the values from the file using something like read.csv or read.delim.

Then to convert from DDMM.MMMM and DDDMM.MMMM you could use something like this (of course modify as needed for the form of your input/outputs):

```convertISO6709 <- function( lat, lon ) {
# will just do lat and lon together, as the process is the same for both
# It's simpler to do the arithmetic on positive numbers, we'll add the signs
#  back in at the end.
latlon <- c(lat,lon)
sgns   <- sign(latlon)
latlon <- abs(latlon)

# grab the MM.MMMM bit, which is always <100. '%%' is modular arithmetic.
mm <- latlon %% 100

# grab the DD bit. Divide by 100 because of the MM.MMMM bit.
dd <- (latlon - mm)/100

# convert to decimal degrees, don't forget to add the signs back!
out_latlon <- (dd+mm/60) * sgns
return(out_latlon)
}
```

### What's the benefit of encapsulating only one basic field into a struct in C?

I saw some C code like this:

### JSP IllegalAccessException can not access public member

In a JSP-File I have the following call to get to one item of a Map: