cancel
Showing results for
Did you mean: 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

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

# 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? 4 REPLIES 4  Community Support

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.  Super User

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

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User! Regular Visitor

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?  Helper IV

@someonerandom - did you ever get this to work ?   