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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PowerbiGuest23
Frequent Visitor

Custom Leaflet R visual - Map Not Loading

I'm stuck on successfully creating a custom visual using R and Leaflet.

 

My R code works fine in RStudio, and in PowerBI, I can plot my markers, but I can't figure out how to the the map (addProviderTiles) to render in PowerBI. 

Here are the steps I am taking:

1) pbiviz new <visual name> -t rhtml

2) cd <path>\<visual name>

3) npm install leaflet

4) npm install @types/leaflet --save

5) Update the pbiviz.json file for the following fields: email, name, description, gitHubUrl, supportUrl

6) Import/update script.r file
6) run pbiviz package

 

After importing the visual into PowerBI (see below), it plots the data points with a radius circle, but the map is not rendering. I've tried different provider tiles in my R code, but to no avail. 

 

Can someone point me in the right direction? The tuturials I've found online are dated and following the same steps results in pbiviz package compilation errors. 

PowerbiGuest23_0-1711505889926.png

 

3 REPLIES 3
jaimeroncero
New Member

Good morning, I am trying to create a map with power bi r script, I cannot use shiny and I cannot use leaflet either, can you recommend some option to represent a polygon map from the R script, it has to be interactive?

PowerbiGuest23
Frequent Visitor

Thanks for the input, but I tried granting web access to multiple versions of the map url with no luck. I'm starting to think you can't use leaflet through R in PowerBI custom visuals...

dm-p
Super User
Super User

Hi @PowerbiGuest23,

 

I don't have much experience with the R side of things, but have you updated your capabilities.json to include privileges that allow web access? Normally, the visual host will block any external URLs if these are not set. You can usually confirm this by the presence of an error in the developer console in your browser when debugging. If you add in a suitable domain used by Leaflet for the parameters array, this should hopefully work for you.

 

Hopefully some of this may point you in the right direction 🤞

 

Daniel

, so I presume that if you enable the domain that leaflet uses for its maps then you





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.