Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ctruxillo
Regular Visitor

Mapping with R code Leaflet or other packages

Hi I am trying to build a map that I can connect cordinates and fill in the area. I have had success with Rstudio but would prefer to get the code to work in PowerBi.  the Rstudio code I used is 

 

library(dplyr)
library(leaflet)

map<-leaflet(width =500, height= 500) %>%
addTiles() %>%
addPolygons(lng =                c(-76.12483,-75.49118,-75.01104,-75.05677,-75.37360,-76.27835,-77.11451,-76.60171,-76.77809,-76.50045,-76.12483), lat=c(38.56060,39.18615,38.64739,37.87028,37.49547,37.17344,37.33463,38.01968,38.34830,38.59635,38.56060)) %>%
addCircles(lng = c(-76), lat= c(38), color ="red",weight = 70 )

 

map

 

 

 

I am hand writting the cordinates to test but plan on using a datafile instead. The issue I am getting is that Power Bi is reporting  that no visual was created, but this produces one in Rstudio. From my understanding, leaflet is supported in PowerBi (according to Learn which R packages are supported - Power BI | Microsoft Learn). 

ctruxillo_0-1668699058990.png

 

 

Is there something else I would need to add to the code to get it to show up? Are there better packages for the job? Heck, if there is a good power bi specific solution I would love that. Thanks for your input!

1 REPLY 1
Anonymous
Not applicable

Hi @ctruxillo ,

 

Please make sure you have installed the node.js.

Here is a solved post with similar issue like yours, I hope it could help you.

You may refer to offical blogs to learn more details.

For reference:

Run R scripts in Power BI Desktop

 

Best Regards,
Rico Zhou

 

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

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.