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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KHorseman
Community Champion
Community Champion

Custom Shape Maps Unexpected Error

I can find lots of threads where people have this problem, but I can't find one with an actual solution. All I see is people insisting that it works, but it definitely does not work.

 

When I try to load any custom shape map, such as any of these provided by @deldersveld I get an "Unexpected Error" message. The details say "Failed to execute 'btoa'". In other threads some people can load these files and others can't. @deldersveld says it's a "regional issue" but I don't really know what that means, and I haven't seen anyone offer a way to fix this "regional issue." Does that mean that custom maps just don't work for people who live in certain regions? I find that unbelievable. I am using the latest release of Power BI Desktop, and I am in the United States.

 

I know shape maps are still technically in preview but surely if it works for some people it should work for everyone. Is there seriously no way to fix this? How do I load a custom shape map? Specifically I need a world map of countries.





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

Proud to be a Super User!




1 ACCEPTED SOLUTION

Ok, I think I might know the potential cause of your issue. When you pulled the file off of GitHub, my guess is that you did not save the actual json file. Instead, you probably right-clicked in the ReadMe and did a Save As on the link to the blob. Is that correct?

 

GitHub shows a preview of TopoJson, GeoJson, etc. blobs on their own page. Unless you download the entire repo, you need to click through the link and save the Raw json instead of the blob preview.

 

JSON maps.PNG

View solution in original post

14 REPLIES 14

Post your dataset. Any unicode characters?

@deldersveld It happens with any data set. It even hapens if I type in a random list of countries through Enter Data. Here:

 

CountryAmount
Australia87
Brazil12
Canada3574
China564
France254
India235
Italy5254
Japan84
Mexico4347
Russia89
United States135




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

Proud to be a Super User!




Not sure where your issue lies, but I did not run into an issue with my world-countries.json file. Here's a link to the PBIX as well, so check to see if you can open it: https://www.dropbox.com/s/2eii01rb17ixwhy/WorldCountries.pbix?dl=0

 

WorldCountries.PNG

I loaded up your 20m US Counties json map into the Power BI drilldown chloropleth map, added the GEOID from the file into my database to correspond with the correct county I wanted, did the same as well for the states, and gave each County/State combination in my access database a unique ID. However, when I try to filter out a specific county in a specific state, the map will populate all of the counties in the US with the same county name even though if is not in the correct state. Do you know a way to only have it display only the county that is in the state that I set a filter for?

Yes I can open it with no trouble. I guess I can only see that it works for other people, but I can't make it work for me. Another worthless new feature I can't use in this damned program.





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

Proud to be a Super User!




I literally just typed in the stuff in my sample above, set the Country column's data category to Country/Region, and tried to load world-countries.json into the map. Here's the error details:

 

Feedback Type:
Frown (Error)

Timestamp:
2016-10-24T14:19:49.8800528Z

Local Time:
2016-10-24T10:19:49.8800528-04:00

Product Version:
2.39.4526.362 (PBIDesktop) (x64)

Release:
September 2016

IE Version:
11.321.14393.0

OS Version:
Microsoft Windows NT 10.0.14393.0 (x64 en-US)

CLR Version:
4.6.2. or later [Release Number = 394802]

Workbook Package Info:
1* - en-US, fastCombine: Disabled.

Peak Working Set:
386 MB

Private Memory:
260 MB

Peak Virtual Memory:
33.9 GB

JS Error Message:
Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

Error Message:
An error occurred while rendering the report.

Stack Trace:
Microsoft.Mashup.Host.Document.JavaScriptException: An error occurred while rendering the report.
Error: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
at Error (native)
at saveSliceToDefinition (ms-pbi://pbi.microsoft.com/minerva/scripts/exploreui.js:9328:77)
at Object.saveChangedSliceToDefinition [as save] (ms-pbi://pbi.microsoft.com/minerva/scripts/exploreui.js:9354:25)
at ms-pbi://pbi.microsoft.com/minerva/scripts/exploreui.js:8590:113
at UndoRedoService.register (ms-pbi://pbi.microsoft.com/minerva/scripts/explore.js:6265:159)
at PropertyPaneController.save (ms-pbi://pbi.microsoft.com/minerva/scripts/exploreui.js:8589:93)
at fn (eval at <anonymous> (ms-pbi://pbi.microsoft.com/minerva/scripts/angular.js:1:0), <anonymous>:4:382)
at PropertyCardController.destination.(anonymous function) [as cardChanged] (ms-pbi://pbi.microsoft.com/minerva/scripts/angular.js:9739:22)
at PropertyCardController.sliceChanged (ms-pbi://pbi.microsoft.com/minerva/scripts/exploreui.js:8515:127)
at fn (eval at <anonymous> (ms-pbi://pbi.microsoft.com/minerva/scripts/angular.js:1:0), <anonymous>:4:323)

Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.ClientShared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace)
at Microsoft.Mashup.Client.ClientShared.FeedbackErrorInfo..ctor(String message, Nullable`1 errorCode, String requestId, Exception exception)
at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.<>c__DisplayClass1.<HandleException>b__0()
at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass3.<SendAndMarshalExceptions>b__0(Object null)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.ClientShared.WindowManager.ShowDialog[T](T form, IWin32Window owner)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClassb.<Main>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)


User ID:
73a57705-1f23-4e51-9f3a-7208da732c7f

Session ID:
b9b3d5f6-84b2-47d9-b322-55db2026d8e6

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\khorseman\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot2069757971.zip

Performance Trace Logs:
C:\Users\khorseman\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_forecastEnabled

Disabled Preview Features:
PBI_RedShift
PBI_Impala
PBI_Snowflake
PBI_allowBiDiCrossFilterInDirectQuery
PBI_esriEnabled
PBI_mobileReportAuthoringEnabled

Disabled DirectQuery Options:
DirectQuery_Unrestricted

Recent Actions:
AddEmptyVisualContainer, AddFieldInRole, VisualContainerPersistProperties, AddFieldInRole, AddVisualContainer, AddFieldToVisual, VisualConversion

Formulas:


section Section1;

shared Table1 = let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NY3LCsIwFER/Re66G/NodakFoUI3iquQxaUJGAi3kqSgfr154PKcYWaUgge5ZM3unjDZCB3sQXcKpoT+k0kyKaq4BKTFZvMXpy2mgN5hdoehqtsWY+Nj5fHpqKDsW+WKL6QSNzwH/DpfLlnl2b7dsmYWXLTBEQlNWeByaJ2JTH1gXILWPw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Country = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Country", type text}, {"Amount", Int64.Type}})
in
#"Changed Type";

Active Section Contract:
{"id":0,"name":"ReportSection","displayName":"Page 1","ordinal":0,"visualContainers":[{"x":10,"y":20,"z":1,"width":280,"height":280,"config":"{\"layouts\":[{\"id\":0,\"position\":{\"x\":10,\"y\":20,\"width\":280,\"height\":280,\"z\":1}}],\"singleVisual\":{\"visualType\":\"shapeMap\",\"projections\":{\"Category\":[{\"queryRef\":\"Table1.Country\"}],\"Value\":[{\"queryRef\":\"Sum(Table1.Amount)\"}]},\"prototypeQuery\":{\"Version\":2,\"From\":[{\"Name\":\"t\",\"Entity\":\"Table1\"}],\"Select\":[{\"Column\":{\"Expression\":{\"SourceRef\":{\"Source\":\"t\"}},\"Property\":\"Country\"},\"Name\":\"Table1.Country\"},{\"Aggregation\":{\"Expression\":{\"Column\":{\"Expression\":{\"SourceRef\":{\"Source\":\"t\"}},\"Property\":\"Amount\"}},\"Function\":0},\"Name\":\"Sum(Table1.Amount)\"}]},\"objects\":{\"shape\":[{\"properties\":{\"map\":{\"geoJson\":{\"type\":{\"expr\":{\"Literal\":{\"Value\":\"'shared'\"}}},\"name\":{\"expr\":{\"Literal\":{\"Value\":\"'usa.states.topo'\"}}},\"content\":{\"expr\":{\"ResourcePackageItem\":{\"PackageName\":\"ShapeMap\",\"PackageType\":2,\"ItemName\":\"usa.states.topo\"}}}}},\"projectionEnum\":{\"expr\":{\"Literal\":{\"Value\":\"'albersUsa'\"}}}}}],\"dataPoint\":[{\"properties\":{\"fillRule\":{\"linearGradient2\":{\"max\":{\"color\":{\"expr\":{\"Literal\":{\"Value\":\"'#01B8AA'\"}}}},\"min\":{\"color\":{\"expr\":{\"Literal\":{\"Value\":\"'#ccf1ee'\"}}}}}}}}]}},\"name\":\"VisualContainer\"}"},{"x":441.875759416768,"y":107.2053462940462,"z":2,"width":300,"height":300,"config":"{\"layouts\":[{\"id\":0,\"position\":{\"x\":441.875759416768,\"y\":107.2053462940462,\"width\":300,\"height\":300,\"z\":2}}],\"singleVisual\":{\"visualType\":\"table\",\"projections\":{\"Values\":[{\"queryRef\":\"Table1.Country\"},{\"queryRef\":\"Sum(Table1.Amount)\"}]},\"prototypeQuery\":{\"Version\":2,\"From\":[{\"Name\":\"t\",\"Entity\":\"Table1\"}],\"Select\":[{\"Column\":{\"Expression\":{\"SourceRef\":{\"Source\":\"t\"}},\"Property\":\"Country\"},\"Name\":\"Table1.Country\"},{\"Aggregation\":{\"Expression\":{\"Column\":{\"Expression\":{\"SourceRef\":{\"Source\":\"t\"}},\"Property\":\"Amount\"}},\"Function\":0},\"Name\":\"Sum(Table1.Amount)\"}]}},\"name\":\"VisualContainer1\"}"}],"displayOption":1,"width":1280,"height":720,"config":"{}"}





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

Proud to be a Super User!




Sean
Community Champion
Community Champion

@deldersveld I'm encountering the same issue as @KHorseman (btw I can also open your pbix file and it works fine)

 

However when I try to use any of your TopoJSON files I get that Error => Here's what I'm doing...

 

2016-10-24 - TopoJSON.png

KHorseman
Community Champion
Community Champion

Yep, @Sean could just as well have been taking screenshots off my computer. Identical to what I'm doing.





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

Proud to be a Super User!




Ok, I think I might know the potential cause of your issue. When you pulled the file off of GitHub, my guess is that you did not save the actual json file. Instead, you probably right-clicked in the ReadMe and did a Save As on the link to the blob. Is that correct?

 

GitHub shows a preview of TopoJson, GeoJson, etc. blobs on their own page. Unless you download the entire repo, you need to click through the link and save the Raw json instead of the blob preview.

 

JSON maps.PNG

@deldersveld yep that was it. Thanks. I assumed that a URL that ended in a file name with a file extension was a link to the actual file with that name and extension. Silly me. Apparently github is different from the entire rest of the internet.





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

Proud to be a Super User!




Sean
Community Champion
Community Champion

@deldersveld Thanks! Smiley Happy

 

As @KHorseman said it really looks like you are saving the right file.

 

Next I'll have to give QGIS a try because I'm having to luck with mapshaper converting other GeoJSON files into usable in PBI TopoJSON files. Thanks!

 

2016-10-24 - TopoJSON - Resolved.png

Sean
Community Champion
Community Champion

@deldersveld I have a question about your us-albers.counties.json file?

 

I can't figure out how to plot the correct county in the correct state?

 

Here is some sample data

These are the 3 most popular county names

(btw these are not all their occurences - I kind of narrowed them down to just the SE/4 of the country)

 

County ColumnFull State NamePopulationCounty NameCounty, StateCounty Word
Jefferson CountyAlabama659,479JeffersonJefferson County, AlabamaCounty
Washington CountyAlabama16,877WashingtonWashington County, AlabamaCounty
Jefferson CountyArkansas73,191JeffersonJefferson County, ArkansasCounty
Lincoln CountyArkansas14,031LincolnLincoln County, ArkansasCounty
Washington CountyArkansas216,410WashingtonWashington County, ArkansasCounty
Jefferson CountyFlorida14,194JeffersonJefferson County, FloridaCounty
Washington CountyFlorida24,624WashingtonWashington County, FloridaCounty
Jefferson CountyGeorgia16,320JeffersonJefferson County, GeorgiaCounty
Lincoln CountyGeorgia7,751LincolnLincoln County, GeorgiaCounty
Washington CountyGeorgia20,676WashingtonWashington County, GeorgiaCounty
Jefferson CountyIndiana32,458JeffersonJefferson County, IndianaCounty
Washington CountyIndiana27,780WashingtonWashington County, IndianaCounty
Jefferson CountyKansas18,813JeffersonJefferson County, KansasCounty
Lincoln CountyKansas3,147LincolnLincoln County, KansasCounty
Washington CountyKansas5,629WashingtonWashington County, KansasCounty
Jefferson CountyKentucky756,832JeffersonJefferson County, KentuckyCounty
Lincoln CountyKentucky24,370LincolnLincoln County, KentuckyCounty
Washington CountyKentucky11,875WashingtonWashington County, KentuckyCounty
Jefferson CountyMississippi7,629JeffersonJefferson County, MississippiCounty
Lincoln CountyMississippi34,810LincolnLincoln County, MississippiCounty
Washington CountyMississippi49,688WashingtonWashington County, MississippiCounty
Jefferson CountyMissouri221,396JeffersonJefferson County, MissouriCounty
Lincoln CountyMissouri53,860LincolnLincoln County, MissouriCounty
Washington CountyMissouri25,172WashingtonWashington County, MissouriCounty
Lincoln CountyNorth Carolina79,740LincolnLincoln County, North CarolinaCounty
Washington CountyNorth Carolina12,722WashingtonWashington County, North CarolinaCounty
Jefferson CountyOklahoma6,432JeffersonJefferson County, OklahomaCounty
Lincoln CountyOklahoma34,351LincolnLincoln County, OklahomaCounty
Washington CountyOklahoma51,577WashingtonWashington County, OklahomaCounty
Jefferson CountyTennessee52,123JeffersonJefferson County, TennesseeCounty
Lincoln CountyTennessee33,633LincolnLincoln County, TennesseeCounty
Washington CountyTennessee125,546WashingtonWashington County, TennesseeCounty
Jefferson CountyTexas252,358JeffersonJefferson County, TexasCounty
Washington CountyTexas34,147WashingtonWashington County, TexasCounty
Washington CountyVirginia54,907WashingtonWashington County, VirginiaCounty
Jefferson CountyWest Virginia55,073JeffersonJefferson County, West VirginiaCounty
Lincoln CountyWest Virginia21,559LincolnLincoln County, West VirginiaCounty

 

In both PBI's regular and filled maps and in the ArcGIS visual you basically use the County, State field and you get this result...

(Note that if you don't use this field you'll get incorrect results!)

Topojson - 1.png

 

Now when we go to the topojson file - it would not plot anything using the County, State field

If i use only the County it plot like this - it plots Counties with the same name but in states which are not even included

 

Topojson - 2.png

 

Any advice will be much appreciated!

Thanks in advance!

 

dMac314
Frequent Visitor

@Sean Did you ever find a solution to this? I am having the same issue. 

KHorseman
Community Champion
Community Champion

I would try using a column that concatenates the county and state, e.g. "Hamilton County, OH" rather than the raw county name.





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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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