cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
someonerandom
Regular Visitor

How to use this R function to convert easting northing to long lat

Hi,

 

I have around 900 gpd data points that i wish to convert to long/lat to use in the bing maps for visualisations.

 

I have googled to see how and this link below seems to provide the answer and how to i need

https://tonyladson.wordpress.com/2016/08/15/converting-from-utm-to-lat-long/ 


the code im supposed to use contains an R function however i cannot figure out how to use it, im not new to powerbi but i have no idea how to use a R function or for this code below to use my data,

 

library(dplyr)
library(ggmap)

# Source the UTM2deg function

source("https://gist.githubusercontent.com/TonyLadson/f37aab3e2ef517188a7f27166307c985/raw/0822970769bc90fcc28052a91b375399d665286e/UTM2deg.R")


# Some sample data

test_df <-
  structure(list(Location = c("Summerhill Road, Craigieburn", "Roseneath Street, Yarra Bend"
  ), Northing = c(5839684, 5815224), Easting = c(320312, 324192)), .Names = c("Location", "Northing", "Easting"
                                                          ), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
                                                          ))


# Add columns of lat and lon using the UTM2deg function

test_df <- bind_cols(test_df, UTM2deg(test_df$Easting, test_df$Northing, zone = 55))
test_df

# Centre of the map
map_center <- test_df %>% 
  summarise(lon = mean(lon), lat = mean(lat))

# plot 
ggmap(get_map(map_center, zoom = 11, source = 'osm', maptype = 'terrain'), darken = c(0.3, 'black'), extent = 'device') +
  geom_point(data = test_df, aes(lon, lat), colour = 'red', size = 2) +
  geom_label(data = test_df, aes(lon, lat, label = Location), colour = 'red', fontface = 'bold', hjust = 0, vjust = -0.5)

 

My data is stored on sharepoint online the data list is called GPSHOLEDATA and this is how my data is displayed, how do i make the function above use my data so i can add a lat long column for each easting and northing? could someone break it down for me and explain it too me?

 

someonerandom_0-1612395504104.png

 

 

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @someonerandom ,


On the one hand, you need to have a further understanding of R, here is the corresponding blog link: Power BI Introduction: Working with R Scripts in Power BI Desktop — Part 3 - Simple Talk (red-gate.c...
On the other hand, you can try other conversion methods:Lat Long Converter for Power BI (efficiency365.com)

 

 

If the problem is still not resolved, please let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PhilipTreacy
Super User
Super User

Hi @someonerandom 

If you have no experience of R why not just use the batch conversion available here

Geodetic Calculators (ga.gov.au)

to convert the data?

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks for the link Philip,

There is a bunch of software to do this, however the reason is this is the start of a project that will hopefully expand, meaning more gps data, so i wish to have the calculations worked out in powerbi automatically, mostly i make apps and simple dashboards. This is the first time ive heard of and had to use an R function.

Could you break it down for me?

@someonerandom - did you ever get this to work ?

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Top Solution Authors