rshinygisr-leafletcoordinate-transformation

How to convert coordinates into a recognizable measurement for leaflet maps?


I am using leaflet in a dashboard I created through shiny. I am trying to map the data I have but leaflet doesn't recognize it because the measurement of my lat and long data is in feet and not decimal degrees (ex: x = 33.867022, y = -112.1409750).

I know I have lat and long data in feet measurement (ex: x = 632086.70, y = 1043211.35) because I was easily able to map this in ArcMap by simply using the "display xy" function. Then I was able to convert the measurement format by using the "calculate geometry" function to transform from feet to a decimal degrees measurement. I am trying to automate my maps and would prefer NOT to use ArcMap for this conversion as I would like to stay in one platform (R).

My potential options (I think) and therefore questions are as follows:

1. Convert my data into something leaflet can recognize. Would anyone know the code, steps and/or package I need to use to convert the measurement of my lat and long data from feet to decimal degrees?

2. Tell leaflet to read my data in a different measurement. Is there a way (code, package, etc) to tell leaflet to read my points in feet measurement rather than decimal degrees?

Or any other suggestions???


Solution

  • Thank you for all the help provided... My co-worker figured it out, we used the code below.

    proj4string(d) <- CRS("+proj=tmerc +lat_0=31+lon_0=-111.9166666666667+k=0.9999 +x_0=213360 +y_0=0 +ellps=GRS80 +datum=NAD83+to_meter=0.3048006096012192+no_defs")
    CRS.new <- CRS("+init=epsg:4326") # WGS 84
    d.ch102650 <- spTransform(d, CRS.new)
    

    @IvanSanchez the CRS comment was helpful.